From 21aba7b31dc2b3c9aa5697a6c4f3c97f8eadc8bd Mon Sep 17 00:00:00 2001 From: zuohuaijun Date: Wed, 18 Dec 2024 14:41:06 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8E1=E3=80=81=E5=88=86=E7=A6=BB?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E3=80=81=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E8=B4=A6=E5=8F=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=88=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83=E4=B8=8D=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=B4=A6=E5=8F=B7=E5=AF=86=E7=A0=81=EF=BC=89=20=202?= =?UTF-8?q?=E3=80=81=E6=9B=B4=E6=94=B9=E5=89=8D=E7=AB=AF=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E6=8B=A6=E6=88=AA=E6=96=B9=E5=BC=8F=EF=BC=8C=E6=96=B9=E4=BE=BF?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=85=AC=E5=85=B1=E8=B7=AF=E7=94=B1=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Web/.env | 8 +------- Web/.env.development | 8 +++++++- Web/.env.production | 8 +++++++- Web/src/router/index.ts | 2 +- Web/src/router/route.ts | 2 ++ 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Web/.env b/Web/.env index a04f4831..bcf55693 100644 --- a/Web/.env +++ b/Web/.env @@ -10,11 +10,5 @@ VITE_OPEN_CDN = false # public path 配置线上环境路径(打包)、本地通过 http-server 访问时,请置空即可 VITE_PUBLIC_PATH = -# 登陆界面默认用户 -VITE_DEFAULT_USER = superadmin - -# 登陆界面默认密码 -VITE_DEFAULT_USER_PASSWORD = Admin.NET++010101 - -# 国密SM公钥 +# 国密SM公钥(保持空即可,自动从后台获取) VITE_SM_PUBLIC_KEY = \ No newline at end of file diff --git a/Web/.env.development b/Web/.env.development index ff6ad002..6607f248 100644 --- a/Web/.env.development +++ b/Web/.env.development @@ -2,4 +2,10 @@ ENV = development # 本地环境接口地址 -VITE_API_URL = http://localhost:5005 \ No newline at end of file +VITE_API_URL = http://localhost:5005 + +# 登陆界面默认用户 +VITE_DEFAULT_USER = superadmin + +# 登陆界面默认密码 +VITE_DEFAULT_USER_PASSWORD = Admin.NET++010101 \ No newline at end of file diff --git a/Web/.env.production b/Web/.env.production index 5ca1b6bd..34e0e2fb 100644 --- a/Web/.env.production +++ b/Web/.env.production @@ -2,4 +2,10 @@ ENV = production # 线上环境接口地址 -VITE_API_URL = \ No newline at end of file +VITE_API_URL = + +# 登陆界面默认用户 +VITE_DEFAULT_USER = + +# 登陆界面默认密码 +VITE_DEFAULT_USER_PASSWORD = \ No newline at end of file diff --git a/Web/src/router/index.ts b/Web/src/router/index.ts index 1ce79814..240a2b78 100644 --- a/Web/src/router/index.ts +++ b/Web/src/router/index.ts @@ -97,7 +97,7 @@ router.beforeEach(async (to, from, next) => { NProgress.configure({ showSpinner: false }); if (to.meta.title) NProgress.start(); const token = Session.get('token'); - if (to.path === '/login' && !token) { + if (to.meta.isPublic && !token) { next(); NProgress.done(); } else { diff --git a/Web/src/router/route.ts b/Web/src/router/route.ts index 499a3b1a..90e0ca54 100644 --- a/Web/src/router/route.ts +++ b/Web/src/router/route.ts @@ -27,6 +27,7 @@ declare module 'vue-router' { isIframe?: boolean; roles?: string[]; icon?: string; + isPublic?: boolean; } } @@ -115,6 +116,7 @@ export const staticRoutes: Array = [ component: () => import('/@/views/login/index.vue'), meta: { title: '登录', + isPublic: true, }, }, /**