Commit 6edbea353dfeda82a9b24ad723abe05ce2b0eedc

Authored by “wangming”
1 parent 80d8fbe3

1

pages/my/adminMessageList/adminMessageList.vue
1 1 <template>
2 2 <view class="page">
3 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 6 <view class="info">
6 7 <view class="title">
7 8 {{it.MessageEntity.Title}}
... ... @@ -10,10 +11,10 @@
10 11 {{it.MessageEntity.BodyText}}
11 12 </view>
12 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 16 </view>
16   - <view class="isRead" style="color: greenyellow;" v-else>
  17 + <view class="isRead" style="background: #009e00;" v-else>
17 18 已读
18 19 </view>
19 20 </view>
... ... @@ -26,8 +27,8 @@
26 27 export default {
27 28 data() {
28 29 return {
29   - messageList:[],
30   - isAdmin:false
  30 + messageList: [],
  31 + isAdmin: false
31 32 }
32 33 },
33 34 onShow() {
... ... @@ -44,16 +45,15 @@
44 45 if (uni.getStorageSync('user')) {
45 46 let userCode = uni.getStorageSync("user")
46 47 console.log(userCode)
47   - if(userCode.userInfo.userId === 'admin'){
  48 + if (userCode.userInfo.userId === 'admin') {
48 49 this.isAdmin = true
49 50 }
50 51 console.log('用户已登录!')
51   - }
52   - else {
  52 + } else {
53 53 uni.showToast({
54 54 title: '请登录',
55 55 icon: 'none',
56   - duration:1500
  56 + duration: 1500
57 57 })
58 58 // setTimeout(() => {
59 59 // uni.reLaunch({
... ... @@ -63,23 +63,23 @@
63 63 }
64 64 },
65 65 // 获取消息通知
66   - getAdminNoticeTell(){
  66 + getAdminNoticeTell() {
67 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 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 80 let link = JSON.parse(it.bodyJson)
81 81 // let id = it.Id
82   - console.log('link',link.link)
  82 + console.log('link', link.link)
83 83 // uni.navigateTo({
84 84 // url:link.link + `?data=${JSON.stringify(link.reid)}`
85 85 // })
... ... @@ -93,7 +93,7 @@
93 93 // }
94 94 // })
95 95 uni.navigateTo({
96   - url:link.link + `?data=${JSON.stringify(link.reid)}`
  96 + url: link.link + `?data=${JSON.stringify(link.reid)}`
97 97 })
98 98 // request({
99 99 // url:`/api/extend/demo/UpdateIsReadEnd?MessageId=${id}`,
... ... @@ -114,18 +114,20 @@
114 114 </script>
115 115  
116 116 <style lang="scss" scoped>
117   - .page{
  117 + .page {
118 118 width: 100%;
119 119 height: 100vh;
120 120 overflow: scroll;
121 121 background-color: #f3f3f3;
122 122 }
123   - .list-box{
  123 +
  124 + .list-box {
124 125 width: 96%;
125 126 margin: 0 auto;
126 127 overflow-y: scroll;
127 128 }
128   - .item{
  129 +
  130 + .item {
129 131 width: 100%;
130 132 background-color: white;
131 133 border-radius: 30rpx;
... ... @@ -134,25 +136,32 @@
134 136 display: flex;
135 137 justify-content: space-between;
136 138 align-items: center;
137   - .info{
  139 +
  140 + .info {
138 141 display: flex;
139 142 flex-direction: column;
  143 +
140 144 // align-items: center;
141   - .title{
  145 + .title {
142 146 font-size: 36rpx;
143 147 font-weight: bold;
144 148 }
145   - .desc{
  149 +
  150 + .desc {
146 151 // width: 400rpx;
147 152 overflow: hidden;
148 153 white-space: nowrap;
149 154 text-overflow: ellipsis;
150   - margin-left: 20rpx;
  155 + margin-left: 18rpx;
151 156 }
152 157 }
153   - .isRead{
  158 +
  159 + .isRead {
154 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 167 -</style>
  168 +</style>
159 169 \ No newline at end of file
... ...
pages/my/messageList/messageList.vue
1 1 <template>
2 2 <view class="page">
3 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 6 <view class="info">
6 7 <view class="title">
7 8 {{it.MessageContent.Title}}
... ... @@ -10,10 +11,10 @@
10 11 {{it.MessageContent.BodyText}}
11 12 </view>
12 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 16 </view>
16   - <view class="isRead" style="color: greenyellow;" v-else>
  17 + <view class="isRead" style="background: #009e00;" v-else>
17 18 已读
18 19 </view>
19 20 </view>
... ... @@ -26,8 +27,8 @@
26 27 export default {
27 28 data() {
28 29 return {
29   - messageList:[],
30   - isAdmin:false,
  30 + messageList: [],
  31 + isAdmin: false,
31 32 baseUrl: 'http://deyanggaoxin.fengshiyun.com'
32 33 }
33 34 },
... ... @@ -41,16 +42,15 @@
41 42 if (uni.getStorageSync('user')) {
42 43 let userCode = uni.getStorageSync("user")
43 44 console.log(userCode)
44   - if(userCode.userInfo.userId === 'admin'){
  45 + if (userCode.userInfo.userId === 'admin') {
45 46 this.isAdmin = true
46 47 }
47 48 console.log('用户已登录!')
48   - }
49   - else {
  49 + } else {
50 50 uni.showToast({
51 51 title: '请登录',
52 52 icon: 'none',
53   - duration:1500
  53 + duration: 1500
54 54 })
55 55 // setTimeout(() => {
56 56 // uni.reLaunch({
... ... @@ -60,36 +60,36 @@
60 60 }
61 61 },
62 62 // 获取消息通知
63   - getNoticeTell(){
  63 + getNoticeTell() {
64 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 71 this.messageList = res.data
72 72 }
73 73 })
74 74 },
75 75 // 获取消息通知
76   - getAdminNoticeTell(){
  76 + getAdminNoticeTell() {
77 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 84 this.messageList = res.data
85 85 }
86 86 })
87 87 },
88 88 // 跳转到消息详情
89   - toDetail(it,id){
  89 + toDetail(it, id) {
90 90 let link = JSON.parse(it.bodyJson)
91 91 // let id = it.Id
92   - console.log('link',link.link)
  92 + console.log('link', link.link)
93 93 // uni.navigateTo({
94 94 // url:link.link + `?data=${JSON.stringify(link.reid)}`
95 95 // })
... ... @@ -103,30 +103,30 @@
103 103 // }
104 104 // })
105 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 112 console.log('成功修改')
113   - if(link.type === '公文办理通知'){
  113 + if (link.type === '公文办理通知') {
114 114 this.download(link.link)
115   - }else{
  115 + } else {
116 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 122 this.download(link.link)
123   - }else if(link.type === '表单填报通知'){
  123 + } else if (link.type === '表单填报通知') {
124 124 uni.navigateTo({
125   - url:link.link + `?id=${link.reid}`
  125 + url: link.link + `?id=${link.reid}`
126 126 })
127   - }else{
  127 + } else {
128 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 134 },
135 135 download(it) {
136 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 176 </script>
177 177  
178 178 <style lang="scss" scoped>
179   - .page{
  179 + .page {
180 180 width: 100%;
181 181 height: 100vh;
182 182 background-color: #f3f3f3;
183 183 }
184   - .list-box{
  184 +
  185 + .list-box {
185 186 width: 96%;
186 187 margin: 0 auto;
187 188 overflow-y: scroll;
188 189 }
189   - .item{
  190 +
  191 + .item {
190 192 width: 100%;
191 193 background-color: white;
192 194 border-radius: 30rpx;
... ... @@ -195,15 +197,18 @@
195 197 display: flex;
196 198 justify-content: space-between;
197 199 align-items: center;
198   - .info{
  200 +
  201 + .info {
199 202 display: flex;
200 203 flex-direction: column;
  204 +
201 205 // align-items: center;
202   - .title{
  206 + .title {
203 207 font-size: 36rpx;
204 208 font-weight: bold;
205 209 }
206   - .desc{
  210 +
  211 + .desc {
207 212 // width: 400rpx;
208 213 overflow: hidden;
209 214 white-space: nowrap;
... ... @@ -211,9 +216,13 @@
211 216 margin-left: 20rpx;
212 217 }
213 218 }
214   - .isRead{
  219 +
  220 + .isRead {
215 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 228 -</style>
  229 +</style>
220 230 \ No newline at end of file
... ...