diff --git a/apps/daxpay-admin/src/store/notify.ts b/apps/daxpay-admin/src/store/notify.ts index 567060e91..26946d332 100644 --- a/apps/daxpay-admin/src/store/notify.ts +++ b/apps/daxpay-admin/src/store/notify.ts @@ -1,7 +1,8 @@ -import { defineStore } from 'pinia'; import { ref } from 'vue'; -import { NotifyUserApi, type NotifyNoticeBrief } from '#/api/system/notify/user.api'; +import { defineStore } from 'pinia'; + +import { type NotifyNoticeBrief, NotifyUserApi } from '#/api/system/notify/user.api'; /** * 站内通知 store(当前登录用户视角) @@ -64,7 +65,7 @@ export const useNotifyStore = defineStore('notify', () => { } /** SSE 连接实例(模块级, 避免响应式开销) */ - let eventSource: null | EventSource = null; + let eventSource: EventSource | null = null; /** * 建立 SSE 实时推送连接 @@ -80,7 +81,7 @@ export const useNotifyStore = defineStore('notify', () => { withCredentials: true, }); // 收到推送即刷新未读数与铃铛列表 - eventSource.onmessage = () => { + eventSource.onmessage! = () => { refresh().catch(() => {}); }; } catch { @@ -96,11 +97,19 @@ export const useNotifyStore = defineStore('notify', () => { eventSource = null; } + /** + * 重置 store(setup 语法需手动实现 $reset, 退出登录时由 resetAllStores 调用) + */ + function $reset() { + list.value = []; + unreadCount.value = 0; + disconnectSSE(); + } + return { + $reset, connectSSE, disconnectSSE, - fetchList, - fetchUnreadCount, ignore, list, markAllRead, diff --git a/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue b/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue index a505c235c..d40a61885 100644 --- a/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue +++ b/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue @@ -132,7 +132,7 @@ (); - // 项目文档地址(文档 / 问题与帮助均跳转至此) + // 项目文档地址(文档跳转至此) const DOC_URL = 'https://doc.daxpay.cn'; const router = useRouter(); @@ -55,11 +55,6 @@ openWindow(DOC_URL, { target: '_blank' }); } - /** 打开问题 & 帮助 */ - function openIssue() { - openWindow(DOC_URL, { target: '_blank' }); - } - /** 打开锁屏密码弹窗 */ function openLockModal() { lockModalOpen.value = true; @@ -89,10 +84,6 @@ openDocs(); break; } - case 'issue': { - openIssue(); - break; - } case 'lock': { openLockModal(); break; @@ -150,13 +141,6 @@ {{ $t('ui.widgets.document') }} - - -
- - {{ $t('ui.widgets.qa') }} -
-