feat: 实现完整的板块级RBAC内容审核系统

- 新增站长/超级管理员/管理员/板块管理员四级角色体系
- 实现实时权限快照加载与细粒度权限校验
- 新增内容审核队列与前后端页面
- 重构用户权限管理与站点管理逻辑
- 新增评论/帖子审核状态与通知推送
- 优化前端权限控制与角色徽章展示
- 修正数据库迁移与默认值问题
This commit is contained in:
2026-09-15 04:47:34 +08:00
parent 6da4309453
commit a7b6421840
44 changed files with 3149 additions and 585 deletions

View File

@@ -12,6 +12,8 @@ import UserProfileContent from "./UserProfileContent";
import ProfileForm from "./ProfileForm";
import PasswordForm from "./PasswordForm";
import Avatar from "@/components/Avatar";
import RoleBadge from "@/components/RoleBadge";
import { roleMeta } from "@/lib/roles";
interface UserPageProps {
params: Promise<{ id: string }>;
@@ -84,7 +86,6 @@ export default async function UserPage({ params, searchParams }: UserPageProps)
}
const u = data.user;
const isAdmin = u.role === "admin";
const joinDate = new Date(u.created_at).toLocaleDateString("zh-CN");
const showPoints = data.stats.points > 0;
@@ -176,13 +177,8 @@ export default async function UserPage({ params, searchParams }: UserPageProps)
>
{u.nickname || u.username}
</h1>
{isAdmin && (
<span
className="text-[11px] font-bold px-2 py-0.5 rounded-full"
style={{ background: "var(--gold-soft)", color: "var(--gold)" }}
>
管理员
</span>
{u.role !== "user" && (
<RoleBadge role={u.role} boardIds={u.board_ids} />
)}
</div>
<p className="meta mt-1 flex items-center gap-1.5 text-[12.5px] flex-wrap">
@@ -342,7 +338,7 @@ export default async function UserPage({ params, searchParams }: UserPageProps)
<Shield size={11.5} /> 角色
</p>
<p className="text-[13px] font-semibold mt-0.5" style={{ color: "var(--ink)" }}>
{isAdmin ? "管理员" : "普通用户"}
{roleMeta(u.role).label}
</p>
</div>
<div className="pt-3 border-t" style={{ borderColor: "var(--line)" }}>