Browse Source

客服对话

chenjj 3 months ago
parent
commit
e07975e4d3
1 changed files with 5 additions and 7 deletions
  1. 5 7
      src/views/message/index.vue

+ 5 - 7
src/views/message/index.vue

@@ -289,13 +289,13 @@ const scrollToBottom = () => {
   }
 }
 
-const getMList = async () => {
+const getMList = async (type) => {
   try {
     const res = await getList({
       system: 3
     })
     filteredUsers.value = res.rows;
-    res.rows[0] && selectUser(res.rows[0])
+    type && res.rows[0] && selectUser(res.rows[0])
   } catch (error) {
 
   }
@@ -336,11 +336,9 @@ const soketInit = () => {
         nextTick(() => {
             scrollToBottom()
         })
-      }else{
-        getMList();//获取用户列表
       }
-      if(res.type ==='msgUnreadCount'){
-        getMList();//获取用户列表
+      if(res.type ==='msgUnreadCount' || currentUser.value.conversationRecordId !== res.data.conversationRecordId){
+        getMList(false);//获取用户列表
       }
     })
 
@@ -352,7 +350,7 @@ const soketInit = () => {
 
 onMounted(() => {
  
-  getMList();//获取用户列表
+  getMList(true);//获取用户列表
 
   setTimeout(() => {
     // 添加滚动监听