- 新增完整首页视图,展示核心功能、品类覆盖及使用流程 - 设计首页响应式布局及样式,优化多终端展示效果 - 修改AdminLayout中返回前台链接为/design路径 - 删除AppHeader中顶部设计、生成、管理后台菜单链接 - 在用户下拉菜单新增管理后台入口,点击跳转/admin - 新增路由/home和/design页面,完善路由配置 - 将登录、注册、生成页跳转路径由根目录改为/design,增强用户体验
178 lines
4.4 KiB
Vue
178 lines
4.4 KiB
Vue
<template>
|
|
<div class="admin-layout">
|
|
<aside class="admin-sidebar">
|
|
<div class="sidebar-header">
|
|
<router-link to="/admin" class="admin-logo">
|
|
<span class="logo-icon">⚙</span>
|
|
<span class="logo-text">管理后台</span>
|
|
</router-link>
|
|
</div>
|
|
<nav class="sidebar-nav">
|
|
<router-link to="/admin" class="nav-item" exact-active-class="active">
|
|
<el-icon><DataBoard /></el-icon>
|
|
<span>仪表盘</span>
|
|
</router-link>
|
|
<router-link to="/admin/configs" class="nav-item" active-class="active">
|
|
<el-icon><Setting /></el-icon>
|
|
<span>系统配置</span>
|
|
</router-link>
|
|
<router-link to="/admin/users" class="nav-item" active-class="active">
|
|
<el-icon><User /></el-icon>
|
|
<span>用户管理</span>
|
|
</router-link>
|
|
<router-link to="/admin/categories" class="nav-item" active-class="active">
|
|
<el-icon><Grid /></el-icon>
|
|
<span>品类管理</span>
|
|
</router-link>
|
|
<router-link to="/admin/designs" class="nav-item" active-class="active">
|
|
<el-icon><PictureFilled /></el-icon>
|
|
<span>设计管理</span>
|
|
</router-link>
|
|
<router-link to="/admin/prompts" class="nav-item" active-class="active">
|
|
<el-icon><ChatLineSquare /></el-icon>
|
|
<span>提示词管理</span>
|
|
</router-link>
|
|
</nav>
|
|
<div class="sidebar-footer">
|
|
<router-link to="/design" class="back-link">
|
|
<el-icon><Back /></el-icon>
|
|
<span>返回前台</span>
|
|
</router-link>
|
|
</div>
|
|
</aside>
|
|
<div class="admin-main">
|
|
<header class="admin-header">
|
|
<div class="header-title">{{ pageTitle }}</div>
|
|
<div class="header-user">
|
|
<span>{{ userStore.userInfo?.nickname || '管理员' }}</span>
|
|
</div>
|
|
</header>
|
|
<div class="admin-content">
|
|
<router-view />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import { useRoute } from 'vue-router'
|
|
import { DataBoard, Setting, User, Grid, PictureFilled, Back, ChatLineSquare } from '@element-plus/icons-vue'
|
|
import { useUserStore } from '@/stores/user'
|
|
|
|
const route = useRoute()
|
|
const userStore = useUserStore()
|
|
|
|
const pageTitle = computed(() => {
|
|
const titles: Record<string, string> = {
|
|
'AdminDashboard': '仪表盘',
|
|
'AdminConfigs': '系统配置',
|
|
'AdminUsers': '用户管理',
|
|
'AdminCategories': '品类管理',
|
|
'AdminDesigns': '设计管理',
|
|
'AdminPrompts': '提示词管理',
|
|
}
|
|
return titles[route.name as string] || '管理后台'
|
|
})
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.admin-layout {
|
|
display: flex;
|
|
min-height: 100vh;
|
|
background: #f0f2f5;
|
|
}
|
|
|
|
.admin-sidebar {
|
|
width: 220px;
|
|
background: #1d1e2c;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.sidebar-header {
|
|
padding: 20px;
|
|
border-bottom: 1px solid rgba(255,255,255,0.08);
|
|
|
|
.admin-logo {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
text-decoration: none;
|
|
color: #fff;
|
|
|
|
.logo-icon { font-size: 22px; }
|
|
.logo-text { font-size: 18px; font-weight: 600; letter-spacing: 2px; }
|
|
}
|
|
}
|
|
|
|
.sidebar-nav {
|
|
flex: 1;
|
|
padding: 12px 0;
|
|
|
|
.nav-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
padding: 12px 24px;
|
|
color: rgba(255,255,255,0.65);
|
|
text-decoration: none;
|
|
font-size: 14px;
|
|
transition: all 0.2s;
|
|
|
|
&:hover { color: #fff; background: rgba(255,255,255,0.06); }
|
|
&.active {
|
|
color: #fff;
|
|
background: #5B7E6B;
|
|
border-right: 3px solid #A8D5BA;
|
|
}
|
|
}
|
|
}
|
|
|
|
.sidebar-footer {
|
|
padding: 16px;
|
|
border-top: 1px solid rgba(255,255,255,0.08);
|
|
|
|
.back-link {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
color: rgba(255,255,255,0.5);
|
|
text-decoration: none;
|
|
font-size: 13px;
|
|
padding: 8px;
|
|
border-radius: 6px;
|
|
transition: all 0.2s;
|
|
|
|
&:hover { color: #fff; background: rgba(255,255,255,0.06); }
|
|
}
|
|
}
|
|
|
|
.admin-main {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.admin-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
height: 56px;
|
|
padding: 0 24px;
|
|
background: #fff;
|
|
border-bottom: 1px solid #e8e8e8;
|
|
|
|
.header-title { font-size: 16px; font-weight: 600; color: #1d1e2c; }
|
|
.header-user { font-size: 14px; color: #666; }
|
|
}
|
|
|
|
.admin-content {
|
|
flex: 1;
|
|
padding: 24px;
|
|
overflow-y: auto;
|
|
}
|
|
</style>
|