This commit is contained in:
2026-02-08 18:43:20 +08:00
parent ed95bdddac
commit eff83a9f68
11 changed files with 132 additions and 39 deletions
+4 -4
View File
@@ -1,4 +1,4 @@
#VITE_API_BASE_URL = http://localhost:5202/api
#VITE_SIGNALR_BASE_URL = http://localhost:5202/chat/
VITE_API_BASE_URL = https://im.test.nxsir.cn/api
VITE_SIGNALR_BASE_URL = https://im.test.nxsir.cn/chat/
VITE_API_BASE_URL = http://localhost:5202/api
VITE_SIGNALR_BASE_URL = http://localhost:5202/chat/
#VITE_API_BASE_URL = https://im.test.nxsir.cn/api
#VITE_SIGNALR_BASE_URL = https://im.test.nxsir.cn/chat/
@@ -5,12 +5,13 @@ import { useChatStore } from "@/stores/chat";
import { messageHandler } from "@/handler/messageHandler";
import { generateSessionId } from "../sessionIdTools";
import { useConversationStore } from "@/stores/conversation";
import { MESSAGE_TYPE } from "@/constants/MessageType";
export const SignalRMessageHandler = (data) => {
const msg = data.data;
const chatStore = useChatStore()
const browserNotification = useBrowserNotification();
const sessionId = generateSessionId(msg.senderId, msg.receiverId);
const sessionId = generateSessionId(msg.senderId, msg.receiverId, msg.chatType == MESSAGE_TYPE.GROUP);
messageHandler(msg);
chatStore.pushAndSortMessagesAsync([msg], sessionId);
const conversation = useConversationStore().conversations.find(x => x.targetId == msg.senderId);
@@ -178,7 +178,7 @@ input.value = ''; // 清空输入框
updateMsg.isError = true;
}finally{
updateMsg.isLoading = false;
chatStore.pushAndSortMessagesAsync([updateMsg], generateSessionId(msg.senderId, msg.receiverId), true);
chatStore.pushAndSortMessagesAsync([updateMsg], generateSessionId(msg.senderId, msg.receiverId, msg.chatType == MESSAGE_TYPE.GROUP), true);
msg.isLoading = false;
}