Files
ctms-client/pages/ctms/tabbar/notice/index.vue
fm453 c62d15b288 首次完整推送,
V:1.20240808.006
2024-08-13 18:32:37 +08:00

83 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="container">
<view v-if="!totalCount" class="content">
暂时没有消息通知
</view>
<uni-collapse v-else v-model="showIndexs">
<uni-collapse-item :name='"notice-"+index' :title='""+(index+1)+""+notice.title'
v-for="(notice,index) in notices" :data-nid="notice.id" :key="index" thumb="./static/logo.png">
<uni-list>
<uni-list-item :title="notice.content" :note="'更新于 : '+notice.updateTime"></uni-list-item>
</uni-list>
</uni-collapse-item>
</uni-collapse>
<view class="pagination">
<uni-pagination :show-icon="false" :total="totalCount" :pageSize='psize' v-model='page' title="分页栏"
@change="newPage" />
</view>
</view>
</template>
<script>
import utils from "@/utils/common.js";
import ctms from '@/apis/ctms/index.js';
export default {
data() {
return {
showIndexs: [],
notices: {},
totalCount: 0,
psize: 10,
page: 1
}
},
onLoad() {
this.checkNotice()
},
onPullDownRefresh() {
this.page = 1;
this.checkNotice();
setTimeout(() => {
uni.stopPullDownRefresh();
}, 3000);
},
methods: {
//刷新列表
checkNotice() {
var _that = this;
ctms.notice.list(this.page, this.psize).then(
function(res) {
if (res) {
_that.notices = res.notices;
for (var index in res.notices) {
if (res.notices[index]['is_show']) {
_that.showIndexs.push('notice-' + index);
}
}
_that.totalCount = res.total;
} else {
_that.orders = {}
_that.totalCount = 0;
}
}
);
},
//分页器动作
newPage(e) {
var page = e.current;
this.page = page;
this.checkNotice();
}
}
}
</script>
<style>
.content {
text-align: center;
height: 400upx;
margin-top: 200upx;
}
</style>