messages.vue
4.17 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<template>
<div class="app-container">
<div class="wcard">
<ul class="mesUl">
<li v-for="item in messageList" :key="item.id" :class="{'done':item.readFlag=='1'}" @click="readMessage(item)">
<div>{{ item.name }}</div>
<!-- <span class="date">{{ item.belongTime }}</span>-->
</li>
<li v-if="messageList.length<=0" class="done">
暂无公告!
</li>
</ul>
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:page-sizes="[15,30,45,60]"
:total="total"
@pagination="getList"
/>
</div>
</div>
</template>
<script setup name="Messages">
import { onMounted, reactive, ref } from 'vue'
import { getMessage, reader, notice } from '@/api/system/homePage'
import _ from 'lodash'
import { useRouter } from 'vue-router'
const router = useRouter()
const messageList = ref([])
const queryParams = ref({
pageNum: 1,
pageSize: 10
})
const total = ref(0)
onMounted(() => {
// getMessageList()
getList()
})
async function getList() {
const res = await notice(queryParams.value)
messageList.value = res.rows
total.value = res.total
console.log(res)
}
//
// async function getMessageList() {
// const res = await getMessage(queryParams)
//
// _.each(res.rows, (d) => {
// switch (d.type) {
// case 30001:
// d.name = '你有一条会员缴费等待审批,点击去处理!'
// d.path = '/member/audit'
// break
// case 30002:
// d.name = '你有一条级位考试等待审批,点击去处理!'
// d.path = '/level/approval'
// break
// case 30003:
// d.name = '你有一条段位考试等待审批,点击去处理!'
// d.path = '/rank/approval'
// break
// case 30004:
// d.name = '你有一条会员调动等待审批,点击去处理!'
// d.path = '/member/mobillize'
// break
// case 30005:
// d.name = '你有一条单位会员认证等待审批,点击去处理!'
// d.path = '/member/audit'
// break
// case 30006:
// d.name = '你有一条段位成绩等待审批,点击去处理!'
// d.path = '/rank/score/approval'
// break
// case 40001:
// d.name = '你有一条级位申请待提交,点击去处理!'
// d.path = '/level/apply/modify/:examId'
// break
// case 40002:
// d.name = '你有一条段位位申请待提交,点击去处理!'
// d.path = '/rank/apply/modify/:examId'
// break
// }
// })
// messageList.value = res.rows
// total.value = res.total
// }
async function readMessage(item) {
await router.push({
path: '/view',
query: { id: item.noteId }
})
// await reader({ id: item.noteId })
// item.readFlag = '1'
}
</script>
<style scoped lang="scss">
.wcard {
background: #fff;
padding: 15px;
overflow: hidden;
position: relative;
.po-title {
position: absolute;
h3 {
font-size: 18px;
color: #2B3133;
margin: 0;
}
h2 {
color: #014A9F;
font-size: 30px;
margin: 6px 0;
}
p {
color: #7B7F83;
font-size: 18px;
margin: 0;
}
}
}
.mesUl {
li {
position: relative;
line-height: 45px;
padding-left: 40px;
display: flex;
justify-content: space-between;
color: #666;
cursor: pointer;
& > div {
width: 80%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 16px;
}
&:before {
width: 6px;
content: '';
height: 6px;
position: absolute;
left: 20px;
top: 0;
bottom: 0;
margin: auto;
background: #AD181F;
border-radius: 50%;
}
&:hover {
background: #f4f4f4;
}
.link {
display: inline-block;
}
.date {
font-size: 12px;
float: right;
color: #999;
width: 20%;
text-align: right;
padding-right: 15px;
}
}
li.done {
&:before {
background: #f4f4f4;
}
}
}
</style>