From 936069d5d9897a3e30bcb4b36bca91c911d0ce78 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Tue, 8 Jul 2025 19:13:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=82=B9=E5=87=BBlogo10=E6=AC=A1?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useActivateDebug.ts | 37 +++++++++++++++++++++++++++++++++++++ src/layouts/default.vue | 5 ++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/hooks/useActivateDebug.ts diff --git a/src/hooks/useActivateDebug.ts b/src/hooks/useActivateDebug.ts new file mode 100644 index 0000000..3553cdb --- /dev/null +++ b/src/hooks/useActivateDebug.ts @@ -0,0 +1,37 @@ +import { ElMessageBox } from 'element-plus' +import { useSystemStore } from 'stores/systemStore' +import { ref } from 'vue' + +export const useActivateDebug = () => { + const systemStore = useSystemStore() + const logoClickCount = ref(0) + let clickTimeout: NodeJS.Timeout | null = null + + const handleLogoClick = () => { + if (clickTimeout) { + clearTimeout(clickTimeout) + } + logoClickCount.value++ + if (logoClickCount.value === 10) { + console.log('isDebug', systemStore.isDebug) + ElMessageBox.confirm('确认重新加载?', '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + closeOnClickModal: false, + type: 'warning', + }) + .finally(() => { + logoClickCount.value = 0 // 重置计数器 + }) + .then(() => { + location.reload() + }) + } + clickTimeout = setTimeout(() => { + logoClickCount.value = 0 // 重置计数器 + }, 1000) + } + return { + handleLogoClick, + } +} diff --git a/src/layouts/default.vue b/src/layouts/default.vue index a96b7a4..6fef414 100644 --- a/src/layouts/default.vue +++ b/src/layouts/default.vue @@ -4,6 +4,7 @@ import WifiConnSvg from 'assets/images/wifi-conn.svg' import WifiUnconnSvg from 'assets/images/wifi-unconn.svg' import NetReconnection from 'components/system/NetReconnection.vue' import { ElMessageBox } from 'element-plus' +import { useActivateDebug } from 'hooks/useActivateDebug' import { delToken } from 'libs/token' import { formatDateTime } from 'libs/utils' import { authRoutes } from 'router/routes' @@ -20,6 +21,8 @@ import { useSealStore } from '@/stores/sealStore' import { useSystemStore } from '@/stores/systemStore' import SystemLog = System.SystemLog +const { handleLogoClick } = useActivateDebug() + // const routes = generateRoutes() // const childrenRoutes = routes.find(r => r.path === '/')?.children || [] const { locale } = useI18n() @@ -224,7 +227,7 @@ const handleCloseAll = async () => {