feat(initialization): 更新 Python 版本并优化初始化流程
-将 Python 版本从 3.13.0 更改为3.12.0 - 添加路由守卫,确保在生产环境中也能正确进入初始化页面 - 在初始化页面中增加服务启动相关逻辑 - 优化环境检查和启动服务的代码结构 - 调整后端服务启动方式,增加调试用的强制启动功能
This commit is contained in:
@@ -4,7 +4,9 @@ import type { RouteRecordRaw } from 'vue-router'
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/initialization',
|
||||
redirect: () => {
|
||||
return '/initialization'
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/initialization',
|
||||
@@ -85,4 +87,23 @@ const router = createRouter({
|
||||
routes,
|
||||
})
|
||||
|
||||
// 添加路由守卫,确保在生产环境中也能正确进入初始化页面
|
||||
router.beforeEach((to, from, next) => {
|
||||
console.log('路由守卫:', { to: to.path, from: from.path })
|
||||
|
||||
// 如果访问的不是初始化页面,且没有初始化标记,则重定向到初始化页面
|
||||
if (to.path !== '/initialization') {
|
||||
const isInitialized = localStorage.getItem('app-initialized')
|
||||
console.log('检查初始化状态:', isInitialized)
|
||||
|
||||
if (!isInitialized) {
|
||||
console.log('应用未初始化,重定向到初始化页面')
|
||||
next('/initialization')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user