From 638035249e62c9e5b5a29dcced4d3ea70486e064 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 19 Jul 2024 13:13:19 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E3=80=91MALL=EF=BC=9A=E5=AE=A2=E6=9C=8D=E8=81=8A=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mall/promotion/kefu/components/KeFuMessageList.vue | 3 +++ src/views/mall/promotion/kefu/index.vue | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/views/mall/promotion/kefu/components/KeFuMessageList.vue b/src/views/mall/promotion/kefu/components/KeFuMessageList.vue index eeb951dd..d3632e63 100644 --- a/src/views/mall/promotion/kefu/components/KeFuMessageList.vue +++ b/src/views/mall/promotion/kefu/components/KeFuMessageList.vue @@ -207,6 +207,7 @@ const refreshMessageList = async (message?: any) => { } pushMessage(message) } else { + // TODO @puhui999:不基于 page 做。而是流式分页;通过 createTime 排序查询; queryParams.pageNo = 1 await getMessageList() } @@ -220,6 +221,8 @@ const refreshMessageList = async (message?: any) => { } } +/** 获得新会话的消息列表 */ +// TODO @puhui999:可优化:可以考虑本地做每个会话的消息 list 缓存;然后点击切换时,读取缓存;然后异步获取新消息,merge 下; const getNewMessageList = async (val: KeFuConversationRespVO) => { // 会话切换,重置相关参数 queryParams.pageNo = 1 diff --git a/src/views/mall/promotion/kefu/index.vue b/src/views/mall/promotion/kefu/index.vue index 03deb895..e6b4976f 100644 --- a/src/views/mall/promotion/kefu/index.vue +++ b/src/views/mall/promotion/kefu/index.vue @@ -64,6 +64,7 @@ watchEffect(() => { // 2.2 消息类型:KEFU_MESSAGE_TYPE if (type === WebSocketMessageTypeConstants.KEFU_MESSAGE_TYPE) { // 刷新会话列表 + // TODO @puhui999:不应该刷新列表,而是根据消息,本地 update 列表的数据; getConversationList() // 刷新消息列表 keFuChatBoxRef.value?.refreshMessageList(JSON.parse(jsonMessage.content)) @@ -72,6 +73,7 @@ watchEffect(() => { // 2.3 消息类型:KEFU_MESSAGE_ADMIN_READ if (type === WebSocketMessageTypeConstants.KEFU_MESSAGE_ADMIN_READ) { // 刷新会话列表 + // TODO @puhui999:不应该刷新列表,而是根据消息,本地 update 列表的数据; getConversationList() } } catch (error) {