Commit 63803524 by YunaiV

【代码评审】MALL:客服聊天

parent e8a0eb08
......@@ -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
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment