congjiang před 1 měsícem
rodič
revize
2a5f1dd42e

+ 5 - 6
src/stores/modules/webSocketStore.js

@@ -470,14 +470,14 @@ export const useWebSocketStore = defineStore("webSocketStore", {
         messageList[sessionId] = [];
       }
       messageList[sessionId] = messageList[sessionId].map(item => {
-        if (!item.id && item.msgId + '' === msg?.msgId + '') return {...item, id: msg.id, msgId: undefined};
+        if (!item.id && item.msgId + '' === msg?.msgId + '') return {...item, id: msg.id, msgId: undefined, err: !msg.id?true:undefined};
         if (item.id + '' === msg?.msgId + '') return {...item, content: "", url: ""};
         return item;
       });
       // 检测当前消息
       if (this.toUserInfo.uuid === sessionId) { 
         this.messages = this.messages.map(item => {
-          if (!item.id && item.msgId + '' === msg?.msgId + '') return {...item, id: msg.id, msgId: undefined};
+          if (!item.id && item.msgId + '' === msg?.msgId + '') return {...item, id: msg.id, msgId: undefined, err: !msg.id?true:undefined};
           if (item.id + '' === msg?.msgId + '') return {...item, content: "", url: ""};
           return item;
         });
@@ -863,10 +863,9 @@ export const useWebSocketStore = defineStore("webSocketStore", {
           this.chatGroupAuth[item] = 1;
           return;
         }
-        if(item.uuid && item.messageType == MsgType.MESSAGE_TYPE_GROUP){
-          this.chatGroupAuth[item.uuid] = 1
-        }
-      })
+        this.chatGroupAuth[item.uuid] = 1
+      });
+      console.log(this.chatGroupAuth)
     },
     // 校验会话权限
     verifyChatAuth(uuid){

+ 1 - 0
src/views/im/chat/index.vue

@@ -46,6 +46,7 @@
               <div v-if="!item.isTemp || item.from == walletStore.account"> 
                 <!-- 文本消息 -->
                 <div class="content" v-if="item.contentType === MsgType.MSG_TYPE.TEXT" @click="onLongPress(item)">
+                  <span v-if="item.err" style="color: red;font-size: small;">{{item.messageType == MsgType.MESSAGE_TYPE_USER?'对方已不是您的好友':'您已不在群里'}}</span>
                   {{ item.content }}
                 </div>
 

+ 5 - 2
src/views/im/hook/messagesHook.js

@@ -166,9 +166,12 @@ export const handleMessageHook = async (payload, wsStore) => {
     }
   }catch(e){}
 
-  // 处理消息已到达
+  // 处理消息已到达, 更新消息id
   if (message.messageType === MsgType.MESSAGE_RECEIPT) { 
-    // 更新消息id
+    // 检测是否在群内或是好友
+    if (!msg.id) {
+      
+    }
     wsStore.modifyMessageId(message, msg)
     return;
   }

+ 2 - 2
src/views/im/index.vue

@@ -198,8 +198,8 @@ const getuserList = async (refresh=false) => {
     //   type: "user"
     // }));
     systemStore.ImsessionList = [...list.value];
-    // 记录用户群组
-    // wsStore.updateGroupAuth(res.data || []);
+    // 更新用户权限
+    wsStore.updateGroupAuth(res.data || []);
   }else{
     list.value = systemStore.ImsessionList
   }