123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <template>
- <view class="container">
- <view class="contentBox">
- <z-paging ref="paging" v-model="listData" @query="onGetOrderList" refresher-update-time-key="list" :auto="false">
- <view class="listInfoBox">
- <view class="listInfo" v-for="(item, index) in listData" :key="index" @tap="onViewTo(item.notificationId)">
- <view class="listDetailBox">
- <text class="listDate">{{item.creationTime}}</text>
- </view>
- <rich-text :nodes="item.title" class="listTitle"></rich-text>
- </view>
- </view>
- </z-paging>
- </view>
- </view>
- </template>
- <script>
- var that;
- export default {
- data() {
- return {
- listData: [],
- isReLoad: false,
- type: 0,
- titleName: '通知公告'
- }
- },
- onLoad(options) {
- that = this;
- that.type = options.type;
- that.titleName = that.type == 0 ? '通知公告' : '宣传视频'
- that.$nextTick(function() {
- uni.setNavigationBarTitle({
- title: that.titleName
- })
- that.$refs.paging.reload()
- })
- },
- methods: {
- onGetOrderList(pageNo, pageSize) {
- that.$admin.req({
- method: 'GET',
- url: '/api/v1/Snapshot/notification?NotifyType=' + that.type + '&QueryIndex=' + (pageNo - 1) + '&QueryCount=' + pageSize
- }).then(res => {
- if (res && res.length > 0) {
- res.forEach((item, index) => {
- item.creationTime = that.$util.formatTime(new Date(item.creationTime));
- })
- that.$refs.paging.complete(res);
- } else if (res && res.length == 0) {
- that.$refs.paging.complete([]);
- } else {
- that.$util.msg('网络出错!');
- that.$refs.paging.complete(false);
- }
- typeof fun === 'function' && fun();
- }, err => {
- if (!that.isReLoad) {
- that.isReLoad = true;
- that.onGetOrderList(pageNo, pageSize);
- } else {
- that.$util.msg(err);
- that.$refs.paging.complete(false);
- }
- })
- },
- onViewTo(id) {
- uni.navigateTo({
- url: '/pagesPointsBase/Publicize/View?type='+ that.type +'&id=' + encodeURIComponent(id)
- })
- },
- }
- }
- </script>
- <style lang="less">
- .container {
- background-color: #f3f3f3;
- }
- .contentBox {
- position: relative;
- height: calc(100%);
- }
- .listInfo {
- padding: 30rpx 20rpx;
- background-color: #fff;
- border-bottom: 2rpx #eee solid;
- }
-
- .listDetailBox {
- color: #666666;
- font-size: 24rpx;
- display: block;
- text-align: right;
- text-align: right;
- }
-
- .listDate {
- font-size: 24rpx;
- }
- .listTitle {
- color: #000405;
- font-size: 32rpx;
- line-height: 46rpx;
- white-space: pre-line;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- /*行向垂直排列*/
- -webkit-line-clamp: 2;
- width: 100%;
- }
- </style>
|