From 1f8b830d2732e7dab4dbe1313ca8ffe498dcb5a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=A1=E5=A4=8D=E4=B9=A0?= <2353956224@qq.com> Date: Mon, 13 Apr 2026 14:51:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/App.vue b/src/App.vue index 4a7a172..a61848c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,6 +71,22 @@ const isDev = window.location.port === '5173' const noticeStore = useNoticeStore() noticeStore.fetchNotices() +// 定期检查新通知 +let noticeCheckInterval = null +const startNoticeCheck = () => { + // 每 5 分钟检查一次新通知 + noticeCheckInterval = setInterval(() => { + noticeStore.fetchNotices() + }, 5 * 60 * 1000) +} + +const stopNoticeCheck = () => { + if (noticeCheckInterval) { + clearInterval(noticeCheckInterval) + noticeCheckInterval = null + } +} + // Lifecycle onMounted(() => { // Set Title @@ -161,6 +177,10 @@ onMounted(() => { loadConfig() + // 启动定期检查新通知 + startNoticeCheck() + console.log('[App] 已启动通知检查') + // Health Check startHealthCheck() }) @@ -170,6 +190,8 @@ onUnmounted(() => { window.removeEventListener('storage', handleStorageChange) window.removeEventListener('config-updated', handleConfigUpdate) window.removeEventListener('auth-expired', handleAuthExpired) + stopNoticeCheck() + console.log('[App] 已停止通知检查') stopHealthCheck() })