feat: 导航体验优化 — 控制台入口提升 + AppLayout 返回前台链接
BlogLayout 导航菜单新增"控制台"按钮(登录后可见,普通用户→控制台,管理员→管理后台), 移除下拉菜单中冗余的控制台项。AppLayout 侧边栏新增"返回首页"和"AI 助手"入口。 路由调整:根路径指向 AI 助手,/blog 指向博客首页。 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,9 +19,9 @@ const routes = [
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'Home',
|
||||
component: () => import('@/views/Home.vue'),
|
||||
meta: { title: '首页' },
|
||||
name: 'AiAssistant',
|
||||
component: () => import('@/views/AiAssistant.vue'),
|
||||
meta: { title: 'AI 助手' },
|
||||
},
|
||||
{
|
||||
path: 'article/:id',
|
||||
@@ -30,10 +30,10 @@ const routes = [
|
||||
meta: { title: '文章详情' },
|
||||
},
|
||||
{
|
||||
path: 'ai-assistant',
|
||||
name: 'AiAssistant',
|
||||
component: () => import('@/views/AiAssistant.vue'),
|
||||
meta: { title: 'AI 助手' },
|
||||
path: 'blog',
|
||||
name: 'Blog',
|
||||
component: () => import('@/views/Home.vue'),
|
||||
meta: { title: '博客' },
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -125,7 +125,7 @@ router.beforeEach((to, from, next) => {
|
||||
if (to.meta.requiresAuth && !token) {
|
||||
next({ name: 'Login', query: { redirect: to.fullPath } })
|
||||
} else if (to.meta.requiresAdmin && userInfo?.role !== 'ADMIN') {
|
||||
next({ name: 'Home' })
|
||||
next({ name: 'Blog' })
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user