From 2391e5b8060f20647223f9c434fd0dd4d5b9f7e0 Mon Sep 17 00:00:00 2001 From: MoeSnowyFox Date: Thu, 14 Aug 2025 00:12:42 +0800 Subject: [PATCH] =?UTF-8?q?:technologist:=20=E6=96=B0=E5=A2=9Eenv.dev,?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E5=8C=BA=E5=88=86=E7=8E=AF=E5=A2=83=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B,=20dev=E7=8E=AF=E5=A2=83=E5=BF=BD=E7=95=A5=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E5=AE=88=E5=8D=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/.env | 1 + frontend/.env.development | 1 + frontend/src/router/index.ts | 10 ++++++++++ 3 files changed, 12 insertions(+) create mode 100644 frontend/.env create mode 100644 frontend/.env.development diff --git a/frontend/.env b/frontend/.env new file mode 100644 index 0000000..bcaaf67 --- /dev/null +++ b/frontend/.env @@ -0,0 +1 @@ +VITE_APP_ENV='prod' \ No newline at end of file diff --git a/frontend/.env.development b/frontend/.env.development new file mode 100644 index 0000000..b43e393 --- /dev/null +++ b/frontend/.env.development @@ -0,0 +1 @@ +VITE_APP_ENV='dev' \ No newline at end of file diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 0daeb61..370f4ef 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -3,6 +3,7 @@ import type { RouteRecordRaw } from 'vue-router' import { isAppInitialized } from '@/utils/config' + const routes: RouteRecordRaw[] = [ { path: '/', @@ -96,6 +97,14 @@ router.beforeEach(async (to, from, next) => { // 如果访问的不是初始化页面,且没有初始化标记,则重定向到初始化页面 if (to.path !== '/initialization') { + // 在开发环境下跳过初始化检查 + const isDev = import.meta.env.VITE_APP_ENV === 'dev' + if (isDev) { + console.log('开发环境,跳过初始化检查') + next() + return + } + const initialized = await isAppInitialized() console.log('检查初始化状态:', initialized) @@ -109,4 +118,5 @@ router.beforeEach(async (to, from, next) => { next() }) + export default router