5bbfac44
易尊强
28号下午提交
|
1
2
3
|
<template>
<view class="page">
<view class="list-box">
|
6edbea35
“wangming”
1
|
4
5
|
<view class="item" v-for="(it,index) in messageList" :key="index"
@click="toDetail(it.MessageEntity,it.MessageReceiveEntity.MessageId)">
|
5bbfac44
易尊强
28号下午提交
|
6
7
8
9
10
11
12
13
|
<view class="info">
<view class="title">
{{it.MessageEntity.Title}}
</view>
<view class="desc">
{{it.MessageEntity.BodyText}}
</view>
</view>
|
6edbea35
“wangming”
1
|
14
|
<view class="isRead" style="background: red;" v-if="it.MessageReceiveEntity.IsRead === 0">
|
5bbfac44
易尊强
28号下午提交
|
15
16
|
未读
</view>
|
6edbea35
“wangming”
1
|
17
|
<view class="isRead" style="background: #009e00;" v-else>
|
5bbfac44
易尊强
28号下午提交
|
18
19
20
21
22
23
24
25
26
27
28
29
|
已读
</view>
</view>
</view>
</view>
</template>
<script>
import request from '@/utils/request.js'
export default {
data() {
return {
|
6edbea35
“wangming”
1
|
30
31
|
messageList: [],
isAdmin: false
|
5bbfac44
易尊强
28号下午提交
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
}
},
onShow() {
this.getUser()
this.getAdminNoticeTell()
},
onLoad() {
this.getUser()
this.getAdminNoticeTell()
},
methods: {
// 获取用户信息
getUser() {
if (uni.getStorageSync('user')) {
let userCode = uni.getStorageSync("user")
console.log(userCode)
|
6edbea35
“wangming”
1
|
48
|
if (userCode.userInfo.userId === 'admin') {
|
5bbfac44
易尊强
28号下午提交
|
49
50
51
|
this.isAdmin = true
}
console.log('用户已登录!')
|
6edbea35
“wangming”
1
|
52
|
} else {
|
5bbfac44
易尊强
28号下午提交
|
53
54
55
|
uni.showToast({
title: '请登录',
icon: 'none',
|
6edbea35
“wangming”
1
|
56
|
duration: 1500
|
5bbfac44
易尊强
28号下午提交
|
57
58
59
60
61
62
63
64
65
|
})
// setTimeout(() => {
// uni.reLaunch({
// url: '/pages/login/index'
// })
// })
}
},
// 获取消息通知
|
6edbea35
“wangming”
1
|
66
|
getAdminNoticeTell() {
|
5bbfac44
易尊强
28号下午提交
|
67
|
request({
|
6edbea35
“wangming”
1
|
68
69
70
71
72
73
|
url: '/api/extend/demo/GetMessageList',
method: 'get',
data: {}
}).then(res => {
console.log('通知列表', res)
if (res.code == 200) {
|
5bbfac44
易尊强
28号下午提交
|
74
75
76
77
78
|
this.messageList = JSON.parse(JSON.stringify(res.data))
}
})
},
// 跳转到消息详情
|
6edbea35
“wangming”
1
|
79
|
toDetail(it, id) {
|
5bbfac44
易尊强
28号下午提交
|
80
81
|
let link = JSON.parse(it.bodyJson)
// let id = it.Id
|
6edbea35
“wangming”
1
|
82
|
console.log('link', link.link)
|
5bbfac44
易尊强
28号下午提交
|
83
84
85
86
87
88
89
90
91
92
93
94
|
// uni.navigateTo({
// url:link.link + `?data=${JSON.stringify(link.reid)}`
// })
// this.API.updateInfo({MessageId:id}).then(res=>{
// console.log("修改已读",res)
// if(res.code == 200){
// console.log('成功修改')
// uni.navigateTo({
// url:link.link + `?data=${JSON.stringify(link.reid)}`
// })
// }
// })
|
80d8fbe3
易尊强
2/29下午
|
95
|
uni.navigateTo({
|
6edbea35
“wangming”
1
|
96
|
url: link.link + `?data=${JSON.stringify(link.reid)}`
|
5bbfac44
易尊强
28号下午提交
|
97
|
})
|
80d8fbe3
易尊强
2/29下午
|
98
99
100
101
102
103
104
105
106
107
108
109
110
|
// request({
// url:`/api/extend/demo/UpdateIsReadEnd?MessageId=${id}`,
// method:'put',
// data:{}
// }).then(res=>{
// console.log("修改已读",res)
// if(res.code == 200){
// console.log('成功修改')
// uni.navigateTo({
// url:link.link + `?data=${JSON.stringify(link.reid)}`
// })
// }
// })
|
5bbfac44
易尊强
28号下午提交
|
111
112
113
114
115
116
|
}
}
}
</script>
<style lang="scss" scoped>
|
6edbea35
“wangming”
1
|
117
|
.page {
|
5bbfac44
易尊强
28号下午提交
|
118
|
width: 100%;
|
80d8fbe3
易尊强
2/29下午
|
119
120
|
height: 100vh;
overflow: scroll;
|
5bbfac44
易尊强
28号下午提交
|
121
122
|
background-color: #f3f3f3;
}
|
6edbea35
“wangming”
1
|
123
124
|
.list-box {
|
5bbfac44
易尊强
28号下午提交
|
125
126
127
128
|
width: 96%;
margin: 0 auto;
overflow-y: scroll;
}
|
6edbea35
“wangming”
1
|
129
130
|
.item {
|
5bbfac44
易尊强
28号下午提交
|
131
132
133
134
135
136
137
138
|
width: 100%;
background-color: white;
border-radius: 30rpx;
padding: 30rpx;
margin-top: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
|
6edbea35
“wangming”
1
|
139
140
|
.info {
|
5bbfac44
易尊强
28号下午提交
|
141
142
|
display: flex;
flex-direction: column;
|
6edbea35
“wangming”
1
|
143
|
|
80d8fbe3
易尊强
2/29下午
|
144
|
// align-items: center;
|
6edbea35
“wangming”
1
|
145
|
.title {
|
5bbfac44
易尊强
28号下午提交
|
146
147
148
|
font-size: 36rpx;
font-weight: bold;
}
|
6edbea35
“wangming”
1
|
149
150
|
.desc {
|
5bbfac44
易尊强
28号下午提交
|
151
152
153
154
|
// width: 400rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
|
6edbea35
“wangming”
1
|
155
|
margin-left: 18rpx;
|
5bbfac44
易尊强
28号下午提交
|
156
157
|
}
}
|
6edbea35
“wangming”
1
|
158
159
|
.isRead {
|
5bbfac44
易尊强
28号下午提交
|
160
|
color: red;
|
6edbea35
“wangming”
1
|
161
162
163
164
|
margin-right: 10rpx;
padding: 6rpx 18rpx;
border-radius: 5px;
color: #f3f3f3;
|
5bbfac44
易尊强
28号下午提交
|
165
166
|
}
}
|
6edbea35
“wangming”
1
|
167
|
</style>
|