diff --git a/apps/web-antd/src/views/im/home/store/friendStore.ts b/apps/web-antd/src/views/im/home/store/friendStore.ts index 9a193ab56..bf959b836 100644 --- a/apps/web-antd/src/views/im/home/store/friendStore.ts +++ b/apps/web-antd/src/views/im/home/store/friendStore.ts @@ -670,6 +670,9 @@ export const useFriendStore = defineStore('imFriendStore', { const existingIndex = this.friendRequests.findIndex((item) => item.id === payload.requestId) if (existingIndex !== -1) { const existing = this.friendRequests.splice(existingIndex, 1)[0] + if (!existing) { + return + } const next = { ...existing, fromUserId: payload.operatorUserId, diff --git a/apps/web-antd/src/views/im/home/store/messageStore.ts b/apps/web-antd/src/views/im/home/store/messageStore.ts index 87bfcd511..f372780f1 100644 --- a/apps/web-antd/src/views/im/home/store/messageStore.ts +++ b/apps/web-antd/src/views/im/home/store/messageStore.ts @@ -488,13 +488,17 @@ export const useMessageStore = defineStore('imMessageStore', { const messages = this.getMessageList(conversationInfo.type, conversationInfo.targetId) const existingIndex = messages.findIndex((existing) => isSameMessage(existing, message)) if (existingIndex !== -1) { + const existing = messages[existingIndex] + if (!existing) { + continue + } // 1.3 已存在消息合并服务端状态 - applyServerMessageUpdate(messages[existingIndex], message) + applyServerMessageUpdate(existing, message) if (existingIndex === messages.length - 1) { recomputeConversationLast(conversation, messages) syncConversationAtFlags(conversation, message) } - addChanged(conversation, messages[existingIndex], { + addChanged(conversation, existing, { mergeClientRecord: hasServerClientMessageId }) continue @@ -580,14 +584,18 @@ export const useMessageStore = defineStore('imMessageStore', { const existingIndex = messages.findIndex((item) => isSameMessage(item, message)) // 3. 已存在消息走覆盖更新 if (existingIndex !== -1) { - applyServerMessageUpdate(messages[existingIndex], message) + const existing = messages[existingIndex] + if (!existing) { + return Promise.resolve() + } + applyServerMessageUpdate(existing, message) if (existingIndex === messages.length - 1) { recomputeConversationLast(conversation, messages) syncConversationAtFlags(conversation, message) } return getDb() .transaction(['messages', 'conversations', 'settings'], 'readwrite', async (tx) => { - await this.saveMessageRecord(messages[existingIndex], conversationInfo.type, tx, { + await this.saveMessageRecord(existing, conversationInfo.type, tx, { mergeClientRecord: hasIncomingClientMessageId }) await conversationStore.saveConversationRecord(conversation, tx) @@ -876,6 +884,9 @@ export const useMessageStore = defineStore('imMessageStore', { } // 2. 从内存移除消息 const [removed] = messages.splice(index, 1) + if (!removed) { + return + } revokeBlobUrlsInContent(removed.content) if (index === messages.length) { recomputeConversationLast(conversation, messages) diff --git a/apps/web-antd/src/views/im/manager/message/content-preview.vue b/apps/web-antd/src/views/im/manager/message/content-preview.vue index 94a114a63..5a59ce528 100644 --- a/apps/web-antd/src/views/im/manager/message/content-preview.vue +++ b/apps/web-antd/src/views/im/manager/message/content-preview.vue @@ -38,8 +38,8 @@ const props = defineProps<{ type?: number; }>(); -const payload = computed | undefined>(() => - parseMessage>(props.content || ''), +const payload = computed>(() => + parseMessage>(props.content ?? ''), ); const textContent = computed(() => payload.value?.content || ''); diff --git a/apps/web-antd/src/views/im/manager/statistics/components/trend-chart.vue b/apps/web-antd/src/views/im/manager/statistics/components/trend-chart.vue index de5cc2501..33ddc401a 100644 --- a/apps/web-antd/src/views/im/manager/statistics/components/trend-chart.vue +++ b/apps/web-antd/src/views/im/manager/statistics/components/trend-chart.vue @@ -1,5 +1,5 @@ diff --git a/apps/web-ele/src/layouts/basic.vue b/apps/web-ele/src/layouts/basic.vue index 5cdcec8a3..1a322ef23 100644 --- a/apps/web-ele/src/layouts/basic.vue +++ b/apps/web-ele/src/layouts/basic.vue @@ -13,6 +13,7 @@ import { AntdProfileOutlined, BookOpenText, CircleHelp, + IconifyIcon, SvgGithubIcon, } from '@vben/icons'; import { @@ -27,7 +28,7 @@ import { preferences, usePreferences } from '@vben/preferences'; import { useAccessStore, useUserStore } from '@vben/stores'; import { formatDateTime, openWindow } from '@vben/utils'; -import { ElMessage } from 'element-plus'; +import { ElMessage, ElTooltip } from 'element-plus'; import { getUnreadNotifyMessageCount, @@ -156,6 +157,12 @@ function handleNotificationOpen(open: boolean) { handleNotificationGetUnreadCount(); } +/** 打开 IM 聊天 */ +function handleOpenImHome() { + const { href } = router.resolve({ name: 'ImHome' }); + window.open(href, '_blank'); +} + // 租户列表 const tenants = ref([]); const tenantEnable = computed( @@ -276,6 +283,17 @@ watch( /> +