IM/frontend/web/src/handler/messageHandler.js
nanxun a31735dbe2 前端:
修复了已知问题
后端:
修复了已知问题
2026-01-22 15:25:54 +08:00

14 lines
532 B
JavaScript

import { useConversationStore } from "@/stores/conversation"
export const messageHandler = (msg) => {
const conversationStore = useConversationStore();
const conversation = conversationStore.conversations.find(x => x.targetId == msg.senderId || x.targetId == msg.receiverId);
conversation.lastMessage = msg.content;
if (conversation.targetId == msg.receiverId) {
conversation.unreadCount = 0;
} else {
conversation.unreadCount += 1;
}
conversation.dateTime = new Date().toISOString();
}