From 9831b2579bec0b07b1f08afe648caaf1a5ac6c0e Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 22 Oct 2023 17:45:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E4=BC=9A=E8=AF=9D=E5=B7=B2=E8=AF=BB=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/chat.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/stores/chat.ts b/src/stores/chat.ts index ceb7653f..14cdef80 100644 --- a/src/stores/chat.ts +++ b/src/stores/chat.ts @@ -313,6 +313,12 @@ export const useChatStore = defineStore('chat', () => { if (item) { item.unreadCount += 1 } + // 如果新消息的 roomId 和 当前显示的 room 的 Id 一致,就更新已读 + } else { + // 且当前路由在 聊天 内 + if (route?.path && route?.path === '/') { + apis.markMsgRead({ roomId: currentRoomId.value }).send() + } } // 如果当前路由不是聊天,就开始计数