消息
This commit is contained in:
@@ -2,7 +2,13 @@
|
||||
<div class="message">
|
||||
<div class="message-item" v-for="(item, index) in list" :key="index">
|
||||
<h2>{{ item.createTime }}</h2>
|
||||
<div>{{ item.msg }}</div>
|
||||
<div v-if="item.channel !== '0'">{{ item.msg }}</div>
|
||||
<div v-else>
|
||||
<i v-for="(item, index) in item.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>
|
||||
<AiEmpty v-if="!list.length && isMore"></AiEmpty>
|
||||
</div>
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user