diff --git a/src/api/login.ts b/src/api/login.ts index 134ecfa1..ac53f3c0 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -53,10 +53,7 @@ export function register(data: any) { */ export function logout() { closePush(); - if ( - import.meta.env.VITE_APP_MESSAGE_ENABLED === 'true' - && import.meta.env.VITE_APP_MESSAGE_TRANSPORT.toLowerCase() !== 'websocket' - ) { + if (import.meta.env.VITE_APP_MESSAGE_ENABLED === 'true' && import.meta.env.VITE_APP_MESSAGE_TRANSPORT.toLowerCase() === 'sse') { request({ url: import.meta.env.VITE_APP_MESSAGE_PATH + '/close', method: 'get' diff --git a/src/api/system/message/index.ts b/src/api/system/message/index.ts new file mode 100644 index 00000000..88663019 --- /dev/null +++ b/src/api/system/message/index.ts @@ -0,0 +1,10 @@ +import request from '@/utils/request'; +import { AxiosPromise } from 'axios'; +import { MessageBoxVO } from './types'; + +export function getMessageBox(): AxiosPromise { + return request({ + url: '/system/message/box', + method: 'get' + }); +} diff --git a/src/api/system/message/types.ts b/src/api/system/message/types.ts new file mode 100644 index 00000000..18a6591f --- /dev/null +++ b/src/api/system/message/types.ts @@ -0,0 +1,17 @@ +export interface MessageVO extends BaseEntity { + messageId: number | string; + category: string; + type: string; + source: string; + title: string; + message: string; + content?: string; + data?: Record | null; + path?: string; +} + +export interface MessageBoxVO { + systemList: MessageVO[]; + noticeList: MessageVO[]; + workflowList: MessageVO[]; +} diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 726c285d..e614865c 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -30,7 +30,7 @@
@@ -107,7 +107,6 @@ const appStore = useAppStore(); const userStore = useUserStore(); const settingsStore = useSettingsStore(); const noticeStore = storeToRefs(useNoticeStore()); -const newNotice = ref(0); const { proxy } = getCurrentInstance() as ComponentInternalInstance; @@ -158,14 +157,6 @@ const handleCommand = (command: string) => { commandMap[command](); } }; -//用深度监听 消息 -watch( - () => noticeStore.state.value.notices, - (newVal) => { - newNotice.value = newVal.filter((item: any) => !item.read).length; - }, - { deep: true } -);