From faa3533306c8a22aa2ce7cacb4be87cc27d70be8 Mon Sep 17 00:00:00 2001 From: xsx <825657193@qq.com> Date: Thu, 3 Jul 2025 16:40:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E6=9E=81=E7=AB=AF=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E6=B6=88=E6=81=AF=E4=B8=B2=E6=89=B0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- im-uniapp/pages/chat/chat-box.vue | 4 +++- im-web/src/components/chat/ChatBox.vue | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/im-uniapp/pages/chat/chat-box.vue b/im-uniapp/pages/chat/chat-box.vue index 958fa3f..926d58b 100644 --- a/im-uniapp/pages/chat/chat-box.vue +++ b/im-uniapp/pages/chat/chat-box.vue @@ -309,9 +309,11 @@ export default { this.isReceipt = false; // 填充对方id this.fillTargetId(msgInfo, this.chat.targetId); + // 防止发送期间用户切换会话导致串扰 + const chat = this.chat; this.sendMessageRequest(msgInfo).then((m) => { m.selfSend = true; - this.chatStore.insertMessage(m, this.chat); + this.chatStore.insertMessage(m, chat); // 会话置顶 this.moveChatToTop(); }).finally(() => { diff --git a/im-web/src/components/chat/ChatBox.vue b/im-web/src/components/chat/ChatBox.vue index 67a5f8c..bcf1add 100644 --- a/im-web/src/components/chat/ChatBox.vue +++ b/im-web/src/components/chat/ChatBox.vue @@ -456,13 +456,12 @@ export default { msgInfo.receipt = this.isReceipt; } this.lockMessage = true; + const chat = this.chat; this.sendMessageRequest(msgInfo).then((m) => { m.selfSend = true; - this.chatStore.insertMessage(m, this.chat); - // 会话置顶 + this.chatStore.insertMessage(m, chat); this.moveChatToTop(); }).finally(() => { - // 解除锁定 this.scrollToBottom(); this.isReceipt = false; resolve();