lex 2 rokov pred
rodič
commit
8d5749a3a8

+ 1 - 1
src/layout/components/components/contacts-list.vue

@@ -81,7 +81,7 @@ export default {
     },
     selectHandler(item) {
       this.$emit("select", {
-        targetId: item.userId,
+        targetId: item.friendId,
         conversationType: 1,
         channelId: ""
       });

+ 2 - 0
src/layout/components/components/message-list.vue

@@ -346,6 +346,7 @@ export default {
      * @param option 会话
      */
     handleSwitchConversation(option) {
+      console.log(option, "option");
       if (!option) {
         this.conversation = null;
         return;
@@ -651,6 +652,7 @@ export default {
       const currentConversation = option || core.currentConversation;
       if (currentConversation && currentConversation !== this.conversation) {
         core.getConversation(currentConversation).then(res => {
+          console.log(res, "updateMessageList");
           if (res) {
             this.loadData(res);
           }

+ 13 - 7
src/layout/components/modal/chat.js

@@ -19,25 +19,31 @@ const getInitData = async list => {
     });
     const group = await imGroupQueryDetail(tempList);
     const tempGroup = group.data || [];
+
+    const temp = [];
     list.forEach(item => {
+      const tempItem = {};
       const findItem = tempGroup.find(item2 => item2.id === item.targetId);
 
       if (item == ConversationType.GROUP) {
-        item.memberCount = 0; // memberCount 为群成员数量
+        tempItem.memberCount = 0; // memberCount 为群成员数量
       }
-      if (findItem) {
-        item.name = findItem.name;
-        item.portraitUri =
+      // console.log(findItem, "findItem items");
+      if (findItem.id) {
+        tempItem.name = findItem.name;
+        tempItem.portraitUri =
           findItem.avatar || item.conversationType === 1
             ? teacherLogo
             : groupLogo;
       } else {
-        item.name = "";
-        item.portraitUri =
+        tempItem.name = "";
+        tempItem.portraitUri =
           item.conversationType === 1 ? teacherLogo : groupLogo;
       }
+      console.log({ ...item, ...tempItem }, "tempItem");
+      temp.push({ ...item, ...tempItem });
     });
-    return list;
+    return temp;
   } catch {
     //
     return [];