diff --git a/src/saas/AppCountryAlbum/Message.vue b/src/saas/AppCountryAlbum/Message.vue index d1f9dc78..6ec1ab6c 100644 --- a/src/saas/AppCountryAlbum/Message.vue +++ b/src/saas/AppCountryAlbum/Message.vue @@ -2,7 +2,13 @@

{{ item.createTime }}

-
{{ item.msg }}
+
{{ item.msg }}
+
+ + {{ item.value }} + + +
@@ -49,16 +55,22 @@ if (this.current > 1) { this.list = [...this.list, ...res.data.records].map(v => { let msg = v.content - if (v.channel === '2') { - msg = '' - JSON.parse(v.content).forEach((item, index) => { - msg = msg + `${item.key}:${item.value}人` + (JSON.parse(v.content).length === index + 1 ? '' : ',') - }) - } else { - msg = '' - JSON.parse(v.content).forEach((item, index) => { - msg = msg + `${item.key}:${item.value}` + (JSON.parse(v.content).length === index + 1 ? '' : ',') - }) + if (v.channel === '0') { + if (v.content.split('$').length === 3) { + msg = v.content.split('$').map((v, index) => { + if (index === 1) { + return { + type: 1, + value: v.split('=')[1] + } + } + + return { + type: 0, + value: v + } + }) + } } return { ...v, @@ -69,16 +81,22 @@ } else { this.list = res.data.records.map(v => { let msg = v.content - if (v.channel === '2') { - msg = '' - JSON.parse(v.content).forEach((item, index) => { - msg = msg + `${item.key}:${item.value}人` + (JSON.parse(v.content).length === index + 1 ? '' : ',') - }) - } else { - msg = '' - JSON.parse(v.content).forEach((item, index) => { - msg = msg + `${item.key}:${item.value}` + (JSON.parse(v.content).length === index + 1 ? '' : ',') - }) + if (v.channel === '0') { + if (v.content.split('$').length === 3) { + msg = v.content.split('$').map((v, index) => { + if (index === 1) { + return { + type: 1, + value: v.split('=')[1] + } + } + + return { + type: 0, + value: v + } + }) + } } return { ...v, @@ -119,7 +137,11 @@ text-align: center; } - div { + i { + font-style: normal; + } + + & > div { margin: 0 32px; padding: 32px; box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.02); diff --git a/src/saas/AppCountryAlbum/components/Home.vue b/src/saas/AppCountryAlbum/components/Home.vue index bb4194d2..8d3e05f1 100644 --- a/src/saas/AppCountryAlbum/components/Home.vue +++ b/src/saas/AppCountryAlbum/components/Home.vue @@ -34,9 +34,15 @@
-
+
最新 - {{ msgInfo.msg }} + {{ msgInfo.content }} +
+ + {{ item.value }} + + +
暂无消息

{{ msgInfo.createTime || '' }}

@@ -140,12 +146,28 @@ this.$http.post('/api/sysmessage/latestnews').then(res => { if (res.code === 0) { if (res.data) { - let msg = '' - JSON.parse(res.data.content).forEach((item, index) => { - msg = msg + `${item.key}:${item.value}` + (JSON.parse(res.data.content).length === index + 1 ? '' : ',') - }) this.msgInfo = res.data + let msg = res.data.content + + if (res.data.channel === '0') { + if (res.data.content.split('$').length === 3) { + msg = res.data.content.split('$').map((v, index) => { + if (index === 1) { + return { + type: 1, + value: v.split('=')[1] + } + } + + return { + type: 0, + value: v + } + }) + } + } this.msgInfo.msg = msg + console.log(msg) } } })