685c7b51d1
- 账号体系:修改密码(/account + PATCH /api/auth/password)、自助删除账号 (DELETE /api/auth/me)、订阅退订(token + /unsubscribe 页) - 前台/SEO:RSS 订阅 /feed.xml、作品详情分享、canonical URL、 文章 Article JSON-LD、品牌化错误页(i18n) - 后台增强:图片管理 /admin/uploads、操作审计日志 /admin/audit(含清空)、 联系消息已读标记、评论列表分页 - 工程:vitest 测试(密码哈希/内容校验器/种子完整性,12 例)+ pnpm test - DB 迁移:contacts.read、subscribers.token、audit_logs(老库 ALTER 兼容) - 密码逻辑抽为 server/utils/password.ts 供测试
71 lines
2.6 KiB
Vue
71 lines
2.6 KiB
Vue
<script setup lang="ts">
|
|
/**
|
|
* 后台左侧导航栏(Dashboard / 动态 / 作品 / 用户 / 评论 / 联系 / 订阅 / 图片 / 日志 / 返回前台)。
|
|
* 高亮当前路由;点击任意导航项时向父级发出 navigate 事件(移动端关闭侧栏)。
|
|
*/
|
|
import { useRoute } from '#app'
|
|
import { siteConfig } from '~/config/site'
|
|
|
|
const route = useRoute()
|
|
const emit = defineEmits<{ navigate: [] }>()
|
|
|
|
const items = [
|
|
{ to: '/admin', label: 'Dashboard', icon: 'ph:gauge' },
|
|
{ to: '/admin/news', label: '动态管理', icon: 'ph:newspaper' },
|
|
{ to: '/admin/work', label: '作品管理', icon: 'ph:image-square' },
|
|
{ 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' },
|
|
{ to: '/admin/uploads', label: '图片管理', icon: 'ph:image' },
|
|
{ to: '/admin/audit', label: '操作日志', icon: 'ph:list-checks' },
|
|
]
|
|
|
|
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">{{ siteConfig.brandZh }}</p>
|
|
<p class="text-[11px] text-white/50">后台管理</p>
|
|
</div>
|
|
</NuxtLink>
|
|
|
|
<nav class="flex-1 py-4 px-3 space-y-1 overflow-y-auto">
|
|
<NuxtLink
|
|
v-for="item in 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>
|
|
</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>
|