This commit is contained in:
yanran200730
2022-05-31 16:47:43 +08:00
parent 49f2b3fb63
commit 81dae85b86
2 changed files with 72 additions and 28 deletions

View File

@@ -34,9 +34,15 @@
<image @click="linkTo('./Message')" class="right-top__right" src="../images/gengduo1.png" />
</div>
<div class="right-info">
<div class="right-info__news" v-if="msgInfo.msg">
<div class="right-info__news" v-if="msgInfo.content">
<span>最新</span>
<i>{{ msgInfo.msg }}</i>
<i v-if="msgInfo.channel !== '0'">{{ msgInfo.content }}</i>
<div style="display: inline" v-else>
<i v-for="(item, index) in msgInfo.msg" :key="index">
<i v-if="item.type === 0">{{ item.value }}</i>
<AiOpenData style="display: inline" v-else type="userName" :openid="item.value"></AiOpenData>
</i>
</div>
</div>
<i v-else>暂无消息</i>
<p>{{ msgInfo.createTime || '' }}</p>
@@ -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)
}
}
})