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, }, }, /**