feat: 公告系统 — Phase 2 完成

- Model/Repo/Service/Controller 全栈实现
- CRUD + ListActive(生效时间范围过滤)
- 管理后台独立页面 /admin/announcements(列表+弹窗CRUD)
- 前台首页 Hero 下方公告栏(info/success/warning/error 四色)
- Moderator+ 权限可管理公告
This commit is contained in:
2026-06-22 00:00:21 +08:00
parent 2d1dd5d401
commit fc57ed17d4
15 changed files with 837 additions and 8 deletions

View File

@ -0,0 +1,162 @@
/* ============================================================
Announcements Admin — 公告管理页面样式
============================================================ */
/* Badge 类型色 */
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-error { background: #fee2e2; color: #dc2626; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }
.badge {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
}
/* Toolbar */
.toolbar {
margin-bottom: 16px;
}
/* Data table */
.data-table {
width: 100%;
border-collapse: collapse;
background: #fff;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.data-table th,
.data-table td {
padding: 12px 16px;
text-align: left;
border-bottom: 1px solid #e5e7eb;
font-size: 14px;
}
.data-table th {
background: #f9fafb;
color: #6b7280;
font-weight: 600;
font-size: 12px;
text-transform: uppercase;
}
.data-table tbody tr:hover {
background: #f9fafb;
}
.table-empty {
text-align: center;
color: #9ca3af;
padding: 40px 0;
}
.btn-edit {
color: #3b82f6;
text-decoration: none;
margin-right: 12px;
}
.btn-delete {
color: #ef4444;
text-decoration: none;
}
/* Modal 表单 */
.form-row {
display: flex;
gap: 16px;
}
.form-row .form-group {
flex: 1;
}
.form-group {
margin-bottom: 16px;
}
.form-group label {
display: block;
margin-bottom: 6px;
font-size: 14px;
font-weight: 500;
color: #374151;
}
.form-input,
.form-textarea,
.form-select {
width: 100%;
padding: 8px 12px;
border: 1px solid #d1d5db;
border-radius: 6px;
font-size: 14px;
box-sizing: border-box;
}
.form-textarea {
resize: vertical;
}
.checkbox-label {
display: flex !important;
align-items: center;
gap: 8px;
cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
width: 16px;
height: 16px;
}
/* Pagination */
.pagination {
margin-top: 16px;
display: flex;
gap: 4px;
justify-content: center;
}
.page-item {
display: inline-block;
padding: 6px 12px;
border: 1px solid #d1d5db;
border-radius: 4px;
color: #374151;
text-decoration: none;
font-size: 14px;
}
.page-item.active {
background: #3b82f6;
color: #fff;
border-color: #3b82f6;
}
/* Toast */
.toast {
display: none;
position: fixed;
bottom: 24px;
left: 50%;
transform: translateX(-50%);
padding: 10px 24px;
border-radius: 8px;
color: #fff;
font-size: 14px;
z-index: 9999;
}
.toast-success { background: #22c55e; }
.toast-error { background: #ef4444; }