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