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

@@ -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);