msgList.vue
1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<template>
<view>
<z-paging ref="paging" v-model="dataList" @query="queryList" emptyViewImg="/static/nodata.png">
<!-- z-paging默认铺满全屏,此时页面所有view都应放在z-paging标签内,否则会被盖住 -->
<!-- 需要固定在页面顶部的view请通过slot="top"插入,包括自定义的导航栏 -->
<uni-section title="通知公告" padding>
<view class="msglist">
<view class="msgitem" v-for="n in dataList" :key="n.id" @click="goDetail(n)">
<!-- <text class="dot" :class="{'done':n.readFlag=='1'}"></text> -->
<view class="tt esp">{{n.name}}</view>
<view class="date">{{ n.belongTime }}</view>
</view>
</view>
</uni-section>
</z-paging>
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import * as api from '@/common/api.js';
import {
onLoad
} from '@dcloudio/uni-app';
const dataList = ref([])
const paging = ref(null)
const current = ref(2)
function queryList(pageNum, pageSize) {
api.notice({
pageNum,
pageSize
}).then(res => {
paging.value.complete(res.rows);
})
}
function goDetail(n){
uni.navigateTo({
url: `/pages/index/newsDetail?noteId=${n.noteId}`
});
}
function readMessage(item) {
uni.navigateTo({
url: item.path
});
api.reader({
id: item.id
}).then(res => {
item.readFlag = '1'
})
}
</script>
<style lang="scss" scoped>
:deep(.uni-section) {
background-color: transparent;
}
:deep(.uni-section .uni-section-header__content) {
font-size: 36rpx;
color: #29343C;
}
</style>