Commit 6edbea353dfeda82a9b24ad723abe05ce2b0eedc

Authored by “wangming”
1 parent 80d8fbe3

1

pages/my/adminMessageList/adminMessageList.vue
1 <template> 1 <template>
2 <view class="page"> 2 <view class="page">
3 <view class="list-box"> 3 <view class="list-box">
4 - <view class="item" v-for="(it,index) in messageList" :key="index" @click="toDetail(it.MessageEntity,it.MessageReceiveEntity.MessageId)"> 4 + <view class="item" v-for="(it,index) in messageList" :key="index"
  5 + @click="toDetail(it.MessageEntity,it.MessageReceiveEntity.MessageId)">
5 <view class="info"> 6 <view class="info">
6 <view class="title"> 7 <view class="title">
7 {{it.MessageEntity.Title}} 8 {{it.MessageEntity.Title}}
@@ -10,10 +11,10 @@ @@ -10,10 +11,10 @@
10 {{it.MessageEntity.BodyText}} 11 {{it.MessageEntity.BodyText}}
11 </view> 12 </view>
12 </view> 13 </view>
13 - <view class="isRead" style="color: red;" v-if="it.MessageReceiveEntity.IsRead === 0"> 14 + <view class="isRead" style="background: red;" v-if="it.MessageReceiveEntity.IsRead === 0">
14 未读 15 未读
15 </view> 16 </view>
16 - <view class="isRead" style="color: greenyellow;" v-else> 17 + <view class="isRead" style="background: #009e00;" v-else>
17 已读 18 已读
18 </view> 19 </view>
19 </view> 20 </view>
@@ -26,8 +27,8 @@ @@ -26,8 +27,8 @@
26 export default { 27 export default {
27 data() { 28 data() {
28 return { 29 return {
29 - messageList:[],  
30 - isAdmin:false 30 + messageList: [],
  31 + isAdmin: false
31 } 32 }
32 }, 33 },
33 onShow() { 34 onShow() {
@@ -44,16 +45,15 @@ @@ -44,16 +45,15 @@
44 if (uni.getStorageSync('user')) { 45 if (uni.getStorageSync('user')) {
45 let userCode = uni.getStorageSync("user") 46 let userCode = uni.getStorageSync("user")
46 console.log(userCode) 47 console.log(userCode)
47 - if(userCode.userInfo.userId === 'admin'){ 48 + if (userCode.userInfo.userId === 'admin') {
48 this.isAdmin = true 49 this.isAdmin = true
49 } 50 }
50 console.log('用户已登录!') 51 console.log('用户已登录!')
51 - }  
52 - else { 52 + } else {
53 uni.showToast({ 53 uni.showToast({
54 title: '请登录', 54 title: '请登录',
55 icon: 'none', 55 icon: 'none',
56 - duration:1500 56 + duration: 1500
57 }) 57 })
58 // setTimeout(() => { 58 // setTimeout(() => {
59 // uni.reLaunch({ 59 // uni.reLaunch({
@@ -63,23 +63,23 @@ @@ -63,23 +63,23 @@
63 } 63 }
64 }, 64 },
65 // 获取消息通知 65 // 获取消息通知
66 - getAdminNoticeTell(){ 66 + getAdminNoticeTell() {
67 request({ 67 request({
68 - url:'/api/extend/demo/GetMessageList',  
69 - method:'get',  
70 - data:{}  
71 - }).then(res=>{  
72 - console.log('通知列表',res)  
73 - if(res.code == 200){ 68 + url: '/api/extend/demo/GetMessageList',
  69 + method: 'get',
  70 + data: {}
  71 + }).then(res => {
  72 + console.log('通知列表', res)
  73 + if (res.code == 200) {
74 this.messageList = JSON.parse(JSON.stringify(res.data)) 74 this.messageList = JSON.parse(JSON.stringify(res.data))
75 } 75 }
76 }) 76 })
77 }, 77 },
78 // 跳转到消息详情 78 // 跳转到消息详情
79 - toDetail(it,id){ 79 + toDetail(it, id) {
80 let link = JSON.parse(it.bodyJson) 80 let link = JSON.parse(it.bodyJson)
81 // let id = it.Id 81 // let id = it.Id
82 - console.log('link',link.link) 82 + console.log('link', link.link)
83 // uni.navigateTo({ 83 // uni.navigateTo({
84 // url:link.link + `?data=${JSON.stringify(link.reid)}` 84 // url:link.link + `?data=${JSON.stringify(link.reid)}`
85 // }) 85 // })
@@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
93 // } 93 // }
94 // }) 94 // })
95 uni.navigateTo({ 95 uni.navigateTo({
96 - url:link.link + `?data=${JSON.stringify(link.reid)}` 96 + url: link.link + `?data=${JSON.stringify(link.reid)}`
97 }) 97 })
98 // request({ 98 // request({
99 // url:`/api/extend/demo/UpdateIsReadEnd?MessageId=${id}`, 99 // url:`/api/extend/demo/UpdateIsReadEnd?MessageId=${id}`,
@@ -114,18 +114,20 @@ @@ -114,18 +114,20 @@
114 </script> 114 </script>
115 115
116 <style lang="scss" scoped> 116 <style lang="scss" scoped>
117 - .page{ 117 + .page {
118 width: 100%; 118 width: 100%;
119 height: 100vh; 119 height: 100vh;
120 overflow: scroll; 120 overflow: scroll;
121 background-color: #f3f3f3; 121 background-color: #f3f3f3;
122 } 122 }
123 - .list-box{ 123 +
  124 + .list-box {
124 width: 96%; 125 width: 96%;
125 margin: 0 auto; 126 margin: 0 auto;
126 overflow-y: scroll; 127 overflow-y: scroll;
127 } 128 }
128 - .item{ 129 +
  130 + .item {
129 width: 100%; 131 width: 100%;
130 background-color: white; 132 background-color: white;
131 border-radius: 30rpx; 133 border-radius: 30rpx;
@@ -134,25 +136,32 @@ @@ -134,25 +136,32 @@
134 display: flex; 136 display: flex;
135 justify-content: space-between; 137 justify-content: space-between;
136 align-items: center; 138 align-items: center;
137 - .info{ 139 +
  140 + .info {
138 display: flex; 141 display: flex;
139 flex-direction: column; 142 flex-direction: column;
  143 +
140 // align-items: center; 144 // align-items: center;
141 - .title{ 145 + .title {
142 font-size: 36rpx; 146 font-size: 36rpx;
143 font-weight: bold; 147 font-weight: bold;
144 } 148 }
145 - .desc{ 149 +
  150 + .desc {
146 // width: 400rpx; 151 // width: 400rpx;
147 overflow: hidden; 152 overflow: hidden;
148 white-space: nowrap; 153 white-space: nowrap;
149 text-overflow: ellipsis; 154 text-overflow: ellipsis;
150 - margin-left: 20rpx; 155 + margin-left: 18rpx;
151 } 156 }
152 } 157 }
153 - .isRead{ 158 +
  159 + .isRead {
154 color: red; 160 color: red;
155 - margin-right: 40rpx; 161 + margin-right: 10rpx;
  162 + padding: 6rpx 18rpx;
  163 + border-radius: 5px;
  164 + color: #f3f3f3;
156 } 165 }
157 } 166 }
158 -</style> 167 -</style>
  168 +</style>
159 \ No newline at end of file 169 \ No newline at end of file
pages/my/messageList/messageList.vue
1 <template> 1 <template>
2 <view class="page"> 2 <view class="page">
3 <view class="list-box"> 3 <view class="list-box">
4 - <view class="item" v-for="(it,index) in messageList" :key="index" @click="toDetail(it.MessageContent,it.MessageInfo.MessageId)"> 4 + <view class="item" v-for="(it,index) in messageList" :key="index"
  5 + @click="toDetail(it.MessageContent,it.MessageInfo.MessageId)">
5 <view class="info"> 6 <view class="info">
6 <view class="title"> 7 <view class="title">
7 {{it.MessageContent.Title}} 8 {{it.MessageContent.Title}}
@@ -10,10 +11,10 @@ @@ -10,10 +11,10 @@
10 {{it.MessageContent.BodyText}} 11 {{it.MessageContent.BodyText}}
11 </view> 12 </view>
12 </view> 13 </view>
13 - <view class="isRead" style="color: red;" v-if="it.MessageInfo.IsRead === 0"> 14 + <view class="isRead" style="background: red;" v-if="it.MessageReceiveEntity.IsRead === 0">
14 未读 15 未读
15 </view> 16 </view>
16 - <view class="isRead" style="color: greenyellow;" v-else> 17 + <view class="isRead" style="background: #009e00;" v-else>
17 已读 18 已读
18 </view> 19 </view>
19 </view> 20 </view>
@@ -26,8 +27,8 @@ @@ -26,8 +27,8 @@
26 export default { 27 export default {
27 data() { 28 data() {
28 return { 29 return {
29 - messageList:[],  
30 - isAdmin:false, 30 + messageList: [],
  31 + isAdmin: false,
31 baseUrl: 'http://deyanggaoxin.fengshiyun.com' 32 baseUrl: 'http://deyanggaoxin.fengshiyun.com'
32 } 33 }
33 }, 34 },
@@ -41,16 +42,15 @@ @@ -41,16 +42,15 @@
41 if (uni.getStorageSync('user')) { 42 if (uni.getStorageSync('user')) {
42 let userCode = uni.getStorageSync("user") 43 let userCode = uni.getStorageSync("user")
43 console.log(userCode) 44 console.log(userCode)
44 - if(userCode.userInfo.userId === 'admin'){ 45 + if (userCode.userInfo.userId === 'admin') {
45 this.isAdmin = true 46 this.isAdmin = true
46 } 47 }
47 console.log('用户已登录!') 48 console.log('用户已登录!')
48 - }  
49 - else { 49 + } else {
50 uni.showToast({ 50 uni.showToast({
51 title: '请登录', 51 title: '请登录',
52 icon: 'none', 52 icon: 'none',
53 - duration:1500 53 + duration: 1500
54 }) 54 })
55 // setTimeout(() => { 55 // setTimeout(() => {
56 // uni.reLaunch({ 56 // uni.reLaunch({
@@ -60,36 +60,36 @@ @@ -60,36 +60,36 @@
60 } 60 }
61 }, 61 },
62 // 获取消息通知 62 // 获取消息通知
63 - getNoticeTell(){ 63 + getNoticeTell() {
64 request({ 64 request({
65 - url:'/api/extend/demo/GetMyMessage',  
66 - method:'get',  
67 - data:{}  
68 - }).then(res=>{  
69 - console.log('通知列表',res)  
70 - if(res.code == 200){ 65 + url: '/api/extend/demo/GetMyMessage',
  66 + method: 'get',
  67 + data: {}
  68 + }).then(res => {
  69 + console.log('通知列表', res)
  70 + if (res.code == 200) {
71 this.messageList = res.data 71 this.messageList = res.data
72 } 72 }
73 }) 73 })
74 }, 74 },
75 // 获取消息通知 75 // 获取消息通知
76 - getAdminNoticeTell(){ 76 + getAdminNoticeTell() {
77 request({ 77 request({
78 - url:'/api/extend/demo/GetMessageList',  
79 - method:'get',  
80 - data:{}  
81 - }).then(res=>{  
82 - console.log('通知列表',res)  
83 - if(res.code == 200){ 78 + url: '/api/extend/demo/GetMessageList',
  79 + method: 'get',
  80 + data: {}
  81 + }).then(res => {
  82 + console.log('通知列表', res)
  83 + if (res.code == 200) {
84 this.messageList = res.data 84 this.messageList = res.data
85 } 85 }
86 }) 86 })
87 }, 87 },
88 // 跳转到消息详情 88 // 跳转到消息详情
89 - toDetail(it,id){ 89 + toDetail(it, id) {
90 let link = JSON.parse(it.bodyJson) 90 let link = JSON.parse(it.bodyJson)
91 // let id = it.Id 91 // let id = it.Id
92 - console.log('link',link.link) 92 + console.log('link', link.link)
93 // uni.navigateTo({ 93 // uni.navigateTo({
94 // url:link.link + `?data=${JSON.stringify(link.reid)}` 94 // url:link.link + `?data=${JSON.stringify(link.reid)}`
95 // }) 95 // })
@@ -103,30 +103,30 @@ @@ -103,30 +103,30 @@
103 // } 103 // }
104 // }) 104 // })
105 request({ 105 request({
106 - url:`/api/extend/demo/UpdateIsReadEnd?MessageId=${id}`,  
107 - method:'put',  
108 - data:{}  
109 - }).then(res=>{  
110 - console.log("修改已读",res)  
111 - if(res.code == 200){ 106 + url: `/api/extend/demo/UpdateIsReadEnd?MessageId=${id}`,
  107 + method: 'put',
  108 + data: {}
  109 + }).then(res => {
  110 + console.log("修改已读", res)
  111 + if (res.code == 200) {
112 console.log('成功修改') 112 console.log('成功修改')
113 - if(link.type === '公文办理通知'){ 113 + if (link.type === '公文办理通知') {
114 this.download(link.link) 114 this.download(link.link)
115 - }else{ 115 + } else {
116 uni.navigateTo({ 116 uni.navigateTo({
117 - url:link.link + `?data=${JSON.stringify(link.reid)}` 117 + url: link.link + `?data=${JSON.stringify(link.reid)}`
118 }) 118 })
119 } 119 }
120 -  
121 - if(link.type === '公文办理通知'){ 120 +
  121 + if (link.type === '公文办理通知') {
122 this.download(link.link) 122 this.download(link.link)
123 - }else if(link.type === '表单填报通知'){ 123 + } else if (link.type === '表单填报通知') {
124 uni.navigateTo({ 124 uni.navigateTo({
125 - url:link.link + `?id=${link.reid}` 125 + url: link.link + `?id=${link.reid}`
126 }) 126 })
127 - }else{ 127 + } else {
128 uni.navigateTo({ 128 uni.navigateTo({
129 - url:link.link + `?data=${JSON.stringify(link.reid)}` 129 + url: link.link + `?data=${JSON.stringify(link.reid)}`
130 }) 130 })
131 } 131 }
132 } 132 }
@@ -134,41 +134,41 @@ @@ -134,41 +134,41 @@
134 }, 134 },
135 download(it) { 135 download(it) {
136 uni.downloadFile({ 136 uni.downloadFile({
137 - url: this.baseUrl + it,//下载地址接口返回  
138 - success: (data) => {  
139 - if (data.statusCode === 200) {  
140 - //文件保存到本地  
141 - uni.saveFile({  
142 - tempFilePath: data.tempFilePath, //临时路径  
143 - success: function(res) {  
144 - uni.showToast({  
145 - icon: 'none',  
146 - mask: true,  
147 - title: '文件已保存:' + res.savedFilePath, //保存路径  
148 - duration: 3000, 137 + url: this.baseUrl + it, //下载地址接口返回
  138 + success: (data) => {
  139 + if (data.statusCode === 200) {
  140 + //文件保存到本地
  141 + uni.saveFile({
  142 + tempFilePath: data.tempFilePath, //临时路径
  143 + success: function(res) {
  144 + uni.showToast({
  145 + icon: 'none',
  146 + mask: true,
  147 + title: '文件已保存:' + res.savedFilePath, //保存路径
  148 + duration: 3000,
  149 + });
  150 + setTimeout(() => {
  151 + //打开文档查看
  152 + uni.openDocument({
  153 + filePath: res.savedFilePath,
  154 + success: function(res) {
  155 + // console.log('打开文档成功');
  156 + }
149 }); 157 });
150 - setTimeout(() => {  
151 - //打开文档查看  
152 - uni.openDocument({  
153 - filePath: res.savedFilePath,  
154 - success: function(res) {  
155 - // console.log('打开文档成功');  
156 - }  
157 - });  
158 - }, 3000)  
159 - }  
160 - });  
161 - }  
162 - },  
163 - fail: (err) => {  
164 - that.loadelshow = false  
165 - console.log(err);  
166 - uni.showToast({  
167 - icon: 'none',  
168 - mask: true,  
169 - title: '失败请重新下载', 158 + }, 3000)
  159 + }
170 }); 160 });
171 - }, 161 + }
  162 + },
  163 + fail: (err) => {
  164 + that.loadelshow = false
  165 + console.log(err);
  166 + uni.showToast({
  167 + icon: 'none',
  168 + mask: true,
  169 + title: '失败请重新下载',
  170 + });
  171 + },
172 }); 172 });
173 }, 173 },
174 } 174 }
@@ -176,17 +176,19 @@ @@ -176,17 +176,19 @@
176 </script> 176 </script>
177 177
178 <style lang="scss" scoped> 178 <style lang="scss" scoped>
179 - .page{ 179 + .page {
180 width: 100%; 180 width: 100%;
181 height: 100vh; 181 height: 100vh;
182 background-color: #f3f3f3; 182 background-color: #f3f3f3;
183 } 183 }
184 - .list-box{ 184 +
  185 + .list-box {
185 width: 96%; 186 width: 96%;
186 margin: 0 auto; 187 margin: 0 auto;
187 overflow-y: scroll; 188 overflow-y: scroll;
188 } 189 }
189 - .item{ 190 +
  191 + .item {
190 width: 100%; 192 width: 100%;
191 background-color: white; 193 background-color: white;
192 border-radius: 30rpx; 194 border-radius: 30rpx;
@@ -195,15 +197,18 @@ @@ -195,15 +197,18 @@
195 display: flex; 197 display: flex;
196 justify-content: space-between; 198 justify-content: space-between;
197 align-items: center; 199 align-items: center;
198 - .info{ 200 +
  201 + .info {
199 display: flex; 202 display: flex;
200 flex-direction: column; 203 flex-direction: column;
  204 +
201 // align-items: center; 205 // align-items: center;
202 - .title{ 206 + .title {
203 font-size: 36rpx; 207 font-size: 36rpx;
204 font-weight: bold; 208 font-weight: bold;
205 } 209 }
206 - .desc{ 210 +
  211 + .desc {
207 // width: 400rpx; 212 // width: 400rpx;
208 overflow: hidden; 213 overflow: hidden;
209 white-space: nowrap; 214 white-space: nowrap;
@@ -211,9 +216,13 @@ @@ -211,9 +216,13 @@
211 margin-left: 20rpx; 216 margin-left: 20rpx;
212 } 217 }
213 } 218 }
214 - .isRead{ 219 +
  220 + .isRead {
215 color: red; 221 color: red;
216 - margin-right: 40rpx; 222 + margin-right: 10rpx;
  223 + padding: 6rpx 18rpx;
  224 + border-radius: 5px;
  225 + color: #f3f3f3;
217 } 226 }
218 } 227 }
219 -</style> 228 -</style>
  229 +</style>
220 \ No newline at end of file 230 \ No newline at end of file