From 1b2826068097d8f1fcfb061ba6a2c1eb1ded7268 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Mon, 25 Nov 2024 11:59:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=B3=BB=E7=BB=9F=E5=85=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=8F=82=E6=95=B0=E8=B7=AF=E7=94=B1=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.ts | 7 ++++++- src/store/modules/app.ts | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/router/index.ts b/src/router/index.ts index 4ac48d3f..b16ea27c 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -182,7 +182,12 @@ router.beforeEach(async (to, from, next) => { next({ name: 'Index' }); } - const token = getToken(); + let token = getToken(); + + // 免用户登录认证 + if (!appStore.loginAuth) { + token = '== Not Login Auth =='; + } // 没有token if (!token) { diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index f44eae2f..fe11126c 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -20,6 +20,8 @@ type AppStore = { buildTime: string; /**系统引导使用 */ bootloader: boolean; + // 用户登录认证 + loginAuth: boolean; // 序列号 serialNum: string; /**应用版权声明 */ @@ -52,6 +54,7 @@ const useAppStore = defineStore('app', { version: `-`, buildTime: `-`, bootloader: false, + loginAuth: false, serialNum: `-`, copyright: `Copyright ©2023 For ${import.meta.env.VITE_APP_NAME}`, logoType: 'icon', @@ -85,6 +88,7 @@ const useAppStore = defineStore('app', { if (this.bootloader) { removeToken(); } + this.loginAuth = res.data.loginAuth === 'true'; this.serialNum = res.data.serialNum; this.appName = res.data.title; this.copyright = res.data.copyright;