wkw 1 month ago
parent
commit
892b7f66c7
2 changed files with 16 additions and 9 deletions
  1. 1 1
      src/stores/modules/webSocketStore.js
  2. 15 8
      src/views/im/hook/messagesHook.js

+ 1 - 1
src/stores/modules/webSocketStore.js

@@ -785,7 +785,7 @@ export const useWebSocketStore = defineStore("webSocketStore", {
       // 处理群个人昵称
       if (message.messageType == MsgType.MESSAGE_NICKNAME_GROUP){
         this.modifyMessage(message,(val)=>{
-          return msg.uuid == val.fromUuid?{
+          return msg.uuid == val.fromUuids?{
             fromUsername: msg.name
           } : (msg.uuid == val.toUuid ? {
             toUsername: msg.name

+ 15 - 8
src/views/im/hook/messagesHook.js

@@ -15,7 +15,7 @@ const formatMessageExt = (message, ext) => {
       ...message,
       content:ext.content,
       msgId: ext.msgId,
-      fromUuid: ext.fromUuid,
+      fromUuids: ext.fromUuid,
       cc : ext.cc, // @群成员  0:全部
       id : ext.id, // 真实消息id
       quote : ext.quote, //引用的消息id
@@ -214,7 +214,8 @@ export const handleMessageHook = async (payload, wsStore) => {
       wsStore.pushMessage({
         ...message,
         toUuid: message.to,
-        fromUuid: msg && msg.fromUuid ? msg.fromUuid : message.from,
+        fromUuid: message.from,
+        fromUuids: msg?.fromUuid,
         align: 'left',
         content: `${(msg.fromUsername || '对方')}撤回了一条消息`,
         fromAvatar: message.avatar,
@@ -265,7 +266,8 @@ export const handleMessageHook = async (payload, wsStore) => {
       messageType: MsgType.MESSAGE_TYPE_GROUP,
       fromAvatar: message.avatar,
       toUuid: message.to,
-      fromUuid: msg && msg.fromUuid ? msg.fromUuid : message.from,
+      fromUuid: message.from,
+      fromUuids: msg?.fromUuid,
     });
     notifications(wsStore);
     return;
@@ -285,7 +287,8 @@ export const handleMessageHook = async (payload, wsStore) => {
       ...message,
       align: sender.uuid != wsStore.toUserInfo.uuid?'right':'left',
       toUuid: message.to,
-      fromUuid: msg && msg.fromUuid ? msg.fromUuid : message.from,
+      fromUuid: message.from,
+      fromUuids: msg?.fromUuid,
       content: message.contentType === Constant.REJECT_AUDIO_ONLINE || message.contentType === Constant.REJECT_VIDEO_ONLINE ? '[对方拒绝]' : '[通话结束]',
       sender,
       fromAvatar: message.avatar,
@@ -299,7 +302,8 @@ export const handleMessageHook = async (payload, wsStore) => {
     wsStore.pushMessage(formatMessageExt({
       ...message,
       toUuid: message.to,
-      fromUuid: msg && msg.fromUuid ? msg.fromUuid : message.from,
+      fromUuid: message.from,
+      fromUuids: msg?.fromUuid,
       align: 'left',
       fromAvatar: message.avatar,
     }, msg));
@@ -319,7 +323,8 @@ export const handleMessageHook = async (payload, wsStore) => {
       ...message,
       file: audioUrl,
       toUuid: message.to,
-      fromUuid: msg && msg.fromUuid ? msg.fromUuid : message.from,
+      fromUuid: message.from,
+      fromUuids: msg?.fromUuid,
       align: 'left',
       fromAvatar: message.avatar,
     }, msg));
@@ -336,7 +341,8 @@ export const handleMessageHook = async (payload, wsStore) => {
       ...message,
       file: url,
       toUuid: message.to,
-      fromUuid: msg && msg.fromUuid ? msg.fromUuid : message.from,
+      fromUuid: message.from,
+      fromUuids: msg?.fromUuid,
       align: 'left',
       fromAvatar: message.avatar,
     }, msg));
@@ -353,7 +359,8 @@ export const handleMessageHook = async (payload, wsStore) => {
       ...message,
       file: url,
       toUuid: message.to,
-      fromUuid: msg && msg.fromUuid ? msg.fromUuid : message.from,
+      fromUuid: message.from,
+      fromUuids: msg?.fromUuid,
       align: 'left',
       fromAvatar: message.avatar,
     }, msg));