5a7ad8de11
- OSS 文件存储(RustFS / S3 v4 兼容,零依赖手写 SigV4): 上传/列表/删除走桶 arcticnewone,/uploads 代理服务 + 本地回退; server/utils/sigv4.ts 纯函数 + AWS 测试向量验证 - 业务动态配置:settings 表 + /api/settings(公开) + /api/admin/settings(PATCH), useSiteSettings 组合式,footer/contact/tools/app.vue/侧边栏/工具页全部接入, 后台 /admin/settings 修改前台即时生效(站点/联系/社交/工具箱/页脚/SEO) - 后台全面优化:Admin* 设计系统(按钮/输入/表单/卡片/徽标/弹窗/确认/空态/骨架/ 分页/页头/Toast)14 组件;Dashboard 增强;各列表页搜索/筛选/批量删除/分页; 布局与侧边栏分组;统一 toast/确认反馈 - 个人中心全新重设计:顶部资料卡 + 统计、精致化改密/删号(二次确认)、 收藏封面网格、评论卡片、移动端适配 - deploy.sh 支持 OSS 凭据注入(NUXT_OSS_*);.env.example 更新 - 测试 17 例全过(含 SigV4 AWS 向量、settings 默认结构)
108 lines
3.3 KiB
Vue
108 lines
3.3 KiB
Vue
<script setup lang="ts">
|
|
/**
|
|
* 后台左侧导航栏:按「内容 / 数据 / 系统」分组,底部返回前台。
|
|
* 高亮当前路由;点击任意导航项时向父级发出 navigate 事件(移动端关闭侧栏)。
|
|
*/
|
|
import { useRoute } from '#app'
|
|
import { useSiteSettings } from '~/composables/useSiteSettings'
|
|
|
|
const route = useRoute()
|
|
const emit = defineEmits<{ navigate: [] }>()
|
|
const { settings } = useSiteSettings()
|
|
|
|
interface SidebarItem {
|
|
to: string
|
|
label: string
|
|
icon: string
|
|
}
|
|
|
|
interface SidebarGroup {
|
|
label: string
|
|
items: SidebarItem[]
|
|
}
|
|
|
|
const groups: SidebarGroup[] = [
|
|
{
|
|
label: '内容',
|
|
items: [
|
|
{ to: '/admin', label: 'Dashboard', icon: 'ph:gauge' },
|
|
{ to: '/admin/news', label: '动态管理', icon: 'ph:newspaper' },
|
|
{ to: '/admin/work', label: '作品管理', icon: 'ph:image-square' },
|
|
],
|
|
},
|
|
{
|
|
label: '数据',
|
|
items: [
|
|
{ to: '/admin/users', label: '用户管理', icon: 'ph:users-three' },
|
|
{ to: '/admin/comments', label: '评论管理', icon: 'ph:chat-circle-text' },
|
|
{ to: '/admin/contacts', label: '联系留言', icon: 'ph:envelope-simple' },
|
|
{ to: '/admin/subscribers', label: '订阅管理', icon: 'ph:paper-plane-tilt' },
|
|
],
|
|
},
|
|
{
|
|
label: '系统',
|
|
items: [
|
|
{ to: '/admin/uploads', label: '图片管理', icon: 'ph:image' },
|
|
{ to: '/admin/audit', label: '操作日志', icon: 'ph:list-checks' },
|
|
{ to: '/admin/settings', label: '站点设置', icon: 'ph:gear-six' },
|
|
],
|
|
},
|
|
]
|
|
|
|
const isActive = (to: string) => route.path === to
|
|
</script>
|
|
|
|
<template>
|
|
<div class="flex flex-col h-full bg-black text-white">
|
|
<NuxtLink
|
|
to="/admin"
|
|
class="flex items-center gap-3 px-5 h-16 border-b border-white/10 shrink-0"
|
|
@click="emit('navigate')"
|
|
>
|
|
<div
|
|
class="w-8 h-8 rounded-full bg-white text-black flex items-center justify-center font-bold text-sm"
|
|
>
|
|
A
|
|
</div>
|
|
<div class="leading-tight">
|
|
<p class="text-sm font-bold">{{ settings?.site.brand }}</p>
|
|
<p class="text-[11px] text-white/50">后台管理</p>
|
|
</div>
|
|
</NuxtLink>
|
|
|
|
<nav class="flex-1 py-5 px-3 overflow-y-auto space-y-6">
|
|
<div v-for="group in groups" :key="group.label">
|
|
<p
|
|
class="px-3 mb-1.5 text-[11px] font-semibold uppercase tracking-wider text-white/40"
|
|
>
|
|
{{ group.label }}
|
|
</p>
|
|
<div class="space-y-1">
|
|
<NuxtLink
|
|
v-for="item in group.items"
|
|
:key="item.to"
|
|
:to="item.to"
|
|
class="flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-colors"
|
|
:class="isActive(item.to) ? 'bg-white text-black' : 'text-white/70 hover:bg-white/10 hover:text-white'"
|
|
@click="emit('navigate')"
|
|
>
|
|
<Icon :name="item.icon" class="w-[18px] h-[18px]" />
|
|
{{ item.label }}
|
|
</NuxtLink>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="p-3 border-t border-white/10 shrink-0">
|
|
<NuxtLink
|
|
to="/"
|
|
class="flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium text-white/70 hover:bg-white/10 hover:text-white transition-colors"
|
|
@click="emit('navigate')"
|
|
>
|
|
<Icon name="ph:arrow-left" class="w-[18px] h-[18px]" />
|
|
返回前台
|
|
</NuxtLink>
|
|
</div>
|
|
</div>
|
|
</template>
|