feat: 导航体验优化 — 控制台入口提升 + AppLayout 返回前台链接

BlogLayout 导航菜单新增"控制台"按钮(登录后可见,普通用户→控制台,管理员→管理后台),
移除下拉菜单中冗余的控制台项。AppLayout 侧边栏新增"返回首页"和"AI 助手"入口。
路由调整:根路径指向 AI 助手,/blog 指向博客首页。

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
nojava
2026-05-24 21:23:09 +08:00
parent 6c8b31e38a
commit 4488c24601
4 changed files with 185 additions and 11 deletions
+8
View File
@@ -3,6 +3,14 @@
<el-container>
<el-aside width="200px">
<el-menu :default-active="$route.path" router>
<el-menu-item index="/blog">
<el-icon><HomeFilled /></el-icon>
<span>返回首页</span>
</el-menu-item>
<el-menu-item index="/">
<el-icon><ChatDotRound /></el-icon>
<span>AI 助手</span>
</el-menu-item>
<el-menu-item index="/app/dashboard">
<el-icon><DataAnalysis /></el-icon>
<span>控制台</span>
+5 -3
View File
@@ -4,12 +4,15 @@
<div class="header-content">
<router-link to="/" class="logo">Jog</router-link>
<el-menu mode="horizontal" :ellipsis="false" class="nav-menu">
<el-menu-item index="home">
<router-link to="/">首页</router-link>
<el-menu-item index="blog">
<router-link to="/blog">博客</router-link>
</el-menu-item>
<el-menu-item index="ai-assistant">
<router-link to="/ai-assistant">AI 助手</router-link>
</el-menu-item>
<el-menu-item v-if="userStore.isLoggedIn" @click="$router.push(userStore.isAdmin ? '/admin' : '/app/dashboard')">
控制台
</el-menu-item>
</el-menu>
<div class="header-right">
<template v-if="userStore.isLoggedIn">
@@ -20,7 +23,6 @@
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="$router.push('/app/dashboard')">控制台</el-dropdown-item>
<el-dropdown-item v-if="userStore.isAdmin" @click="$router.push('/admin')">管理后台</el-dropdown-item>
<el-dropdown-item divided @click="handleLogout">退出登录</el-dropdown-item>
</el-dropdown-menu>
+8 -8
View File
@@ -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()
}