feat(pages): call-log-page

This commit is contained in:
yangsy
2025-11-18 20:22:26 +08:00
parent 799a5af857
commit 0c3e9c24f9
7 changed files with 288 additions and 21 deletions

View File

@@ -31,12 +31,15 @@ const router = createRouter({
},
{
path: 'log',
redirect: '/log/vimp-log',
children: [
{
path: 'vimp-log',
component: () => import('@/pages/vimp-log-page.vue'),
},
{
path: 'call-log',
component: () => import('@/pages/call-log-page.vue'),
},
],
},
{
@@ -62,32 +65,30 @@ const router = createRouter({
const whiteList = ['/debug'];
router.beforeEach((to, from, next) => {
router.beforeEach((to) => {
const userStore = useUserStore();
const isAuthed = !!userStore.userLoginResult?.token;
// 放行白名单
const inWhiteList = whiteList.some((path) => to.path.startsWith(path));
if (inWhiteList) {
next();
return;
return true;
}
// 已登录用户不允许进入登录页(手动访问 /login 会重定向到首页)
if (to.path === '/login') {
if (isAuthed) {
next({ path: '/' });
return { path: '/' };
} else {
next();
return true;
}
return;
}
// 其它路由按登录态控制
if (!isAuthed) {
next('/login');
} else {
next();
// 其它路由按登录态控制
if (!isAuthed) {
return { path: '/login' };
} else {
return true;
}
}
});