From 68736ab913924e4a47ba0e2e44b3b5521cba4641 Mon Sep 17 00:00:00 2001 From: ch Date: Tue, 14 Jun 2022 11:31:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=B6=88=E6=81=AF=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/msb-im.js | 8 +++++++- src/views/chat/message.vue | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/utils/msb-im.js b/src/utils/msb-im.js index 5866b2c..1041cbb 100644 --- a/src/utils/msb-im.js +++ b/src/utils/msb-im.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-05-18 14:54:47 * @LastEditors: ch - * @LastEditTime: 2022-06-13 22:14:45 + * @LastEditTime: 2022-06-14 11:24:01 * @Description: file content */ import '@/utils/poto-req'; @@ -283,6 +283,11 @@ class MsbIm { if (item.lastMessage) { item.lastMessage.payload = JSON.parse(item.lastMessage.payload || {}); } + let historyData = this.sessionData; + let hisIndex = historyData.findIndex((i) => i.id === item.id); + if (hisIndex < 0) { + item.messageList = []; + } // let historyData = this.sessionData; // let hisIndex = historyData.findIndex((i) => i.id === item.id); // if (hisIndex >= 0) { @@ -304,6 +309,7 @@ class MsbIm { async getHistoryMsg() { const curSessionIdx = this.sessionData.findIndex((i) => i.id === this.curSessionId); const curSession = this.sessionData[curSessionIdx]; + console.log(curSession, this.curSessionId, 'this.curSessionId'); const msgList = curSession.messageList || []; const par = { traceId: CreateUUID(), diff --git a/src/views/chat/message.vue b/src/views/chat/message.vue index d9a03eb..e7c9f19 100644 --- a/src/views/chat/message.vue +++ b/src/views/chat/message.vue @@ -3,7 +3,7 @@ class="message-item" :class="{ [`--${messageType[props.message.type]}`]: true, - '--self': props.message.fromId !== props.session.fromId, + '--self': props.message.fromId == props.session.fromId, }" >