From 3ab876abbe6613cdc7c431f92185b809f7a4781f Mon Sep 17 00:00:00 2001 From: ch Date: Mon, 13 Jun 2022 21:35:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E8=BD=AC=E7=A7=BB?= =?UTF-8?q?=E4=BC=9A=E8=AF=9D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/msb-im.js | 12 +++++++++--- src/views/chat/index.vue | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/utils/msb-im.js b/src/utils/msb-im.js index ab6b843..ca341fe 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 18:54:30 + * @LastEditTime: 2022-06-13 21:32:46 * @Description: file content */ import '@/utils/poto-req'; @@ -34,6 +34,7 @@ const fromatPotoReq = (traceId, traceType, content) => { message: res.getMessage(), }; }; + class MsbIm { defaultOption = { ioKey: 'traceId', @@ -281,13 +282,12 @@ class MsbIm { if (hisIndex >= 0) { historyData[hisIndex].lastMessage = item.lastMessage; historyData[hisIndex].unreadCount++; - newData.push(historyData); + newData.push(historyData[hisIndex]); } else { item.messageList = []; newData = [...newData, item]; } }); - this.setSessionData(newData); return Promise.resolve(result); } @@ -459,5 +459,11 @@ class MsbIm { } return Promise.resolve(result); } + close() { + this.socket.close(); + this.socket = null; + this.isOpen = false; + this.setSessionData([]); + } } export default MsbIm; diff --git a/src/views/chat/index.vue b/src/views/chat/index.vue index cc3d89b..c37a5af 100644 --- a/src/views/chat/index.vue +++ b/src/views/chat/index.vue @@ -300,6 +300,7 @@ reason: res.value, }) .then((res) => { + currentSessionId.value = null; Im.setCurSessionId(null); Im.getSessionList(); });