From ae4a4284c9ea8e150c7d70df826c551be1f6a51f Mon Sep 17 00:00:00 2001 From: ch Date: Tue, 14 Jun 2022 11:11:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A8=E5=BD=93=E5=89=8D=E4=BC=9A?= =?UTF-8?q?=E8=AF=9D=E9=A1=B5=E9=9D=A2=E5=88=B7=E6=96=B0=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/plugins/msbIm.js | 8 +++++- src/pages/account/message/chat/index.vue | 35 ++++++++++++++++++------ 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/common/plugins/msbIm.js b/src/common/plugins/msbIm.js index ae46f24..ed1dae3 100644 --- a/src/common/plugins/msbIm.js +++ b/src/common/plugins/msbIm.js @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-05-18 14:54:47 * @LastEditors: ch - * @LastEditTime: 2022-06-13 22:18:23 + * @LastEditTime: 2022-06-14 10:52:01 * @Description: file content */ import { CreateUUID, FormatDate, ToAsyncAwait } from "@/common/utils"; @@ -282,6 +282,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) { @@ -303,6 +308,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/pages/account/message/chat/index.vue b/src/pages/account/message/chat/index.vue index ef6d0b0..188cfc0 100644 --- a/src/pages/account/message/chat/index.vue +++ b/src/pages/account/message/chat/index.vue @@ -2,7 +2,7 @@ * @Author: ch * @Date: 2022-03-26 14:32:03 * @LastEditors: ch - * @LastEditTime: 2022-06-10 19:09:45 + * @LastEditTime: 2022-06-14 11:10:03 * @Description: file content -->