|
@@ -4,6 +4,7 @@ import { $root as protobuf } from "@/common/proto/proto";
|
|
|
import * as Constant from "@/common/constant/Constant";
|
|
|
import { useWalletStore } from "@/stores/modules/walletStore";
|
|
|
import { getMessageApi } from "@/api/path/im.api"
|
|
|
+import { MSG_TYPE, MSG_TYPE_MAP } from "@/common/constant/msgType";
|
|
|
|
|
|
export const useWebSocketStore = defineStore("webSocketStore", {
|
|
|
// 状态定义
|
|
@@ -133,7 +134,7 @@ export const useWebSocketStore = defineStore("webSocketStore", {
|
|
|
});
|
|
|
|
|
|
console.log("收到消息:", message);
|
|
|
- if([1,2].includes(message.messageType)){
|
|
|
+ if(MSG_TYPE_MAP.includes(message.messageType)){
|
|
|
// 更新状态
|
|
|
this.messages.push({
|
|
|
...message,
|
|
@@ -231,7 +232,7 @@ export const useWebSocketStore = defineStore("webSocketStore", {
|
|
|
fromUsername: walletStore.username,
|
|
|
from: walletStore.account,
|
|
|
};
|
|
|
- if([1,2].includes(data.messageType)){
|
|
|
+ if(MSG_TYPE_MAP.includes(data.messageType)){
|
|
|
this.messages.push({
|
|
|
...data,
|
|
|
toUsername: data.friendUsername
|