|
|
@@ -31,6 +31,8 @@ const StoragePage = () => import('@/views/storage/index.vue')
|
|
|
const VectorStorePage = () => import('@/views/vector/index.vue')
|
|
|
const SkillsPage = () => import('@/views/skills/index.vue')
|
|
|
const Workspace = () => import('@/views/workspace/index.vue')
|
|
|
+const UnauthorizedPage = () => import('@/views/system/401.vue')
|
|
|
+const NotFoundPage = () => import('@/views/system/404.vue')
|
|
|
|
|
|
const routes = [
|
|
|
{
|
|
|
@@ -178,6 +180,16 @@ const routes = [
|
|
|
name: 'Chat',
|
|
|
component: Chat,
|
|
|
meta: { menuCode: 'sys_ai_chat' }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/401',
|
|
|
+ name: 'Unauthorized',
|
|
|
+ component: UnauthorizedPage
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/404',
|
|
|
+ name: 'NotFound',
|
|
|
+ component: NotFoundPage
|
|
|
}
|
|
|
]
|
|
|
|
|
|
@@ -200,9 +212,7 @@ router.beforeEach(async (to, _from, next) => {
|
|
|
await permissionStore.initializePermissions()
|
|
|
|
|
|
if (!permissionStore.hasMenuAccess(menuCode)) {
|
|
|
- // 有权限菜单优先作为落点,避免无权限直达页面出现空白。
|
|
|
- const fallbackPath = permissionStore.getFirstAccessibleRoutePath()
|
|
|
- next(fallbackPath === to.path ? '/' : fallbackPath)
|
|
|
+ next('/401')
|
|
|
return
|
|
|
}
|
|
|
|
|
|
@@ -213,6 +223,11 @@ router.beforeEach(async (to, _from, next) => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+router.addRoute({
|
|
|
+ path: '/:pathMatch(.*)*',
|
|
|
+ redirect: '/404'
|
|
|
+})
|
|
|
+
|
|
|
router.afterEach(() => {
|
|
|
NProgress.done()
|
|
|
})
|