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) {