From d3fef49af2de134b301c57df1ee9693fe1b46a0f Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Mon, 11 May 2026 20:17:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/layouts/components/Footer/index.vue | 147 +++++++++++++++--- 1 file changed, 125 insertions(+), 22 deletions(-) diff --git a/frontend/src/layouts/components/Footer/index.vue b/frontend/src/layouts/components/Footer/index.vue index 44ef1b6..ee136af 100644 --- a/frontend/src/layouts/components/Footer/index.vue +++ b/frontend/src/layouts/components/Footer/index.vue @@ -1,32 +1,135 @@ - +import { computed } from 'vue' +import { HOME_URL } from '@/config' +import { useAuthStore } from '@/stores/modules/auth' +import { useModeStore } from '@/stores/modules/mode' // 引入模式 store +import { useTabsStore } from '@/stores/modules/tabs' +import { useRouter } from 'vue-router' +import { initDynamicRouter } from '@/routers/modules/dynamicRouter' +const router = useRouter() +const authStore = useAuthStore() +const modeStore = useModeStore() +const tabsStore = useTabsStore() + +const title = computed(() => { + return modeStore.currentMode === '' ? '选择模块' : modeStore.currentMode + '模块' +}) +const activateInfo = authStore.activateInfo +const isActivateOpen = import.meta.env.VITE_ACTIVATE_OPEN +const modeList = [ + { + name: '模拟式模块', + code: '模拟式', + key: 'simulate', + activated: isActivateOpen === 'true' ? activateInfo.simulate.permanently === 1 : true + }, + { + name: '数字式模块', + code: '数字式', + key: 'digital', + activated: isActivateOpen === 'true' ? activateInfo.digital.permanently === 1 : true + }, + { + name: '比对式模块', + code: '比对式', + key: 'contrast', + activated: isActivateOpen === 'true' ? activateInfo.contrast.permanently === 1 : true + } +] +const handelOpen = async (item: string, key: string) => { + if (isActivateOpen === 'true' && activateInfo[key].permanently !== 1) { + ElMessage.warning(`${item}模块未激活`) + return + } + await authStore.setShowMenu() + modeStore.setCurrentMode(item) // 将模式code存入 store + // 强制刷新页面 + await tabsStore.closeMultipleTab() + await initDynamicRouter() + + // 只有当目标路径与当前路径不同时才跳转 + if (router.currentRoute.value.path !== HOME_URL) { + await router.push({ path: HOME_URL }) + } else { + // 如果已在目标页面,手动触发组件更新 + window.location.reload() // 或者采用其他方式刷新数据 + } + +} +