feat: add 404 page

This commit is contained in:
engigu
2025-09-20 14:18:02 +08:00
parent 0ecad7f23d
commit 5ca071cb89
2 changed files with 73 additions and 5 deletions
+10 -5
View File
@@ -64,11 +64,11 @@ const router = createRouter({
// name: 'hostedmessage',
// component: () => import('../views/tabsTools/hostedMessage/hostedMessage.vue')
// },
// {
// path: '/:catchAll(.*)',
// name: '404',
// component: () => import('../views/404.vue')
// },
{
path: '/:catchAll(.*)',
name: '404',
component: () => import('../components/404.vue')
},
]
})
@@ -77,6 +77,11 @@ router.beforeEach((to, from, next) => {
const token = localStorage.getItem(CONSTANT.STORE_TOKEN_NAME);
const isAuthenticated = Boolean(token && token.trim() !== '');
// 404页面不需要登录验证
if (to.name === '404') {
next();
return;
}
if (!isAuthenticated && to.path !== '/login') {