From a986a8d6fb5e44f7044469f5f420ce0d7b5bf235 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 26 十一月 2025 11:36:02 +0800
Subject: [PATCH] 11
---
src/App.vue | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index 1f5f36d..57f6d29 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -4,8 +4,15 @@
import { useDesign } from '@/hooks/web/useDesign'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import routerSearch from '@/components/RouterSearch/index.vue'
+import {useUserStore} from "@/store/modules/user";
+import {useTagsViewStore} from "@/store/modules/tagsView";
+import {getAccessToken} from "@/utils/auth";
defineOptions({ name: 'APP' })
+
+const userStore = useUserStore()
+
+const tagsViewStore = useTagsViewStore()
const { getPrefixCls } = useDesign()
const prefixCls = getPrefixCls('app')
@@ -23,6 +30,26 @@
appStore.setIsDark(isDarkTheme)
}
setDefaultTheme()
+
+/** 鍒濆鍖� **/
+onMounted(() => {
+ window.addEventListener('unload', handleUnload);
+})
+
+onBeforeUnmount(() => {
+ window.removeEventListener('unload', handleUnload);
+})
+
+const handleUnload = async () => {
+ //await userStore.loginOut()
+ if (getAccessToken()) {
+ const loginouturl = import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/system/auth/logout' + '?token=' + getAccessToken()
+ navigator.sendBeacon(loginouturl, JSON.stringify(""))
+ }
+
+ tagsViewStore.delAllViews()
+}
+
</script>
<template>
<ConfigGlobal :size="currentSize">
--
Gitblit v1.9.3