feat: 将默认首页改为日历页面
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 16s
Docker Build & Deploy / Deploy to Production (push) Successful in 5s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 16s
Docker Build & Deploy / Deploy to Production (push) Successful in 5s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
- 添加根路径 / 重定向到日历页面 calendar-v2 - 修改已登录用户访问登录页时的跳转目标为日历页面 - 现在访问 http://localhost:5173/ 会直接进入日历页面
This commit is contained in:
@@ -4,6 +4,12 @@ import { useAuthStore } from '@/stores/auth'
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
redirect: { name: 'calendar-v2' },
|
||||
meta: { requiresAuth: true }
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
@@ -119,8 +125,8 @@ router.beforeEach((to, from, next) => {
|
||||
// 需要认证但未登录,跳转到登录页
|
||||
next({ name: 'login', query: { redirect: to.fullPath } })
|
||||
} else if (to.name === 'login' && authStore.isAuthenticated) {
|
||||
// 已登录用户访问登录页,跳转到首页
|
||||
next({ name: 'statistics-v2' })
|
||||
// 已登录用户访问登录页,跳转到日历页面
|
||||
next({ name: 'calendar-v2' })
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user