Files
mce/templates/admin/static/css/posts.css
Victor_Jay 03a01a09be feat: 实现内容系统 MVC(Post CRUD + 审核流转)
按 content-system.md 设计文档,实现帖子内容系统的最小可行 MVC。

新增:
- Model: Post 模型,含 5 种状态(draft/pending/approved/rejected/locked)
- Repository: post_repo.go,分页查询(前台 approved 列表 + 后台全状态筛选)
- Service: post_service.go,核心业务逻辑(状态流转、Markdown 渲染 Goldmark)
- Controller: post_controller + admin_post_controller,SSR 页面 6 个 + API 13 个
- Template: 列表/详情/编辑器/404 + 管理员列表,各配 CSS/JS
- 路由: /posts, /posts/:id, /posts/new, /posts/:id/edit, REST API, Admin API
- gomod: + github.com/yuin/goldmark v1.8.2

修改:
- Main: AutoMigrate Post 表
- Router: deps 注册 PostService/Controller,路由注册
- Nav: 新增“帖子”导航链接
- Admin Sidebar: 新增“内容管理”入口

设计:
- 审核开关复用 audit.enabled,开启时帖子为 draft,关闭后直接 approved
- 仅 approved 公开可见,作者/admin 可预览非公开状态帖子
- 严格分层 ISP 接口: Controller → postUseCase, Service → postStore, Repo → *PostRepo
- 状态保护: pending/locked 禁止编辑,rejected 编辑后自动重置为 draft
2026-05-27 18:22:48 +08:00

132 lines
2.4 KiB
CSS

/* ========== 管理后台帖子列表 ========== */
.admin-filter-bar {
margin-bottom: 20px;
}
.filter-form {
display: flex;
gap: 12px;
align-items: center;
}
.filter-input {
flex: 1;
max-width: 300px;
padding: 8px 12px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
}
.filter-select {
padding: 8px 12px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
background: #fff;
}
.admin-table {
width: 100%;
border-collapse: collapse;
background: #fff;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.admin-table th {
background: #f9fafb;
padding: 12px 16px;
text-align: left;
font-size: 13px;
font-weight: 600;
color: #6b7280;
border-bottom: 1px solid #e5e7eb;
}
.admin-table td {
padding: 12px 16px;
font-size: 14px;
border-bottom: 1px solid #f3f4f6;
color: #374151;
}
.admin-table .empty {
text-align: center;
color: #9ca3af;
padding: 40px 0;
}
.post-link {
color: #6366f1;
text-decoration: none;
font-weight: 500;
}
.post-link:hover { text-decoration: underline; }
.status-badge {
display: inline-block;
padding: 2px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.status-draft { background: #f3f4f6; color: #6b7280; }
.status-pending { background: #fef3c7; color: #d97706; }
.status-approved { background: #d1fae5; color: #059669; }
.status-rejected { background: #fee2e2; color: #dc2626; }
.status-locked { background: #fee2e2; color: #b91c1c; }
.actions-cell { min-width: 180px; }
.action-btns {
display: flex;
gap: 6px;
flex-wrap: wrap;
}
.btn-sm {
padding: 4px 12px;
font-size: 12px;
border-radius: 6px;
border: none;
cursor: pointer;
font-weight: 500;
transition: opacity 0.2s;
}
.btn-sm:hover { opacity: 0.85; }
.btn-success { background: #10b981; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
/* 分页 */
.pagination {
display: flex;
justify-content: center;
align-items: center;
gap: 16px;
margin-top: 24px;
}
.page-link {
padding: 8px 14px;
border: 1px solid #d1d5db;
border-radius: 8px;
color: #374151;
text-decoration: none;
font-size: 13px;
}
.page-link:hover { background: #f3f4f6; }
.page-info {
font-size: 13px;
color: #6b7280;
}