feat: 文章属性前端完成 — Phase 3

- 写文章页:可见性/类型/转载来源/创作声明/禁止转载 属性表单
- 类型切换联动(转载显示来源,原创显示禁止转载复选框)
- 文章详情页:私密角标、置顶标记、创作声明横幅、转载来源
- 管理后台:置顶/取消置顶操作按钮
- PostService Create/Update 签名扩展接受文章属性
- DTO/接口同步更新
This commit is contained in:
2026-06-22 00:20:52 +08:00
parent 9c452afb40
commit 977c52513a
13 changed files with 225 additions and 18 deletions

View File

@ -80,6 +80,7 @@
.status-approved { background: #d1fae5; color: #059669; }
.status-rejected { background: #fee2e2; color: #dc2626; }
.status-locked { background: #fee2e2; color: #b91c1c; }
.status-pinned { background: #dbeafe; color: #1d4ed8; }
.revision-section { margin-bottom: 24px; }
.revision-section h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: #4338ca; }
@ -111,6 +112,7 @@
.btn-success { background: #10b981; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-info { background: #3b82f6; color: #fff; }
/* 分页 */
.pagination {

View File

@ -52,4 +52,22 @@
.then(function(d) { if (d.success) refreshPage(); else showToast(d.message || '操作失败', 'error'); })
.catch(function() { showToast('操作失败', 'error'); });
});
// 置顶
document.querySelectorAll('.post-pin').forEach(function(btn) {
btn.addEventListener('click', function() {
var id = btn.getAttribute('data-id');
var pinType = btn.getAttribute('data-pin-type');
api.post('/api/admin/posts/' + id + '/pin', { pin_type: pinType })
.then(function(d) { if (d.success) refreshPage(); else showToast(d.message || '操作失败', 'error'); })
.catch(function() { showToast('操作失败', 'error'); });
});
});
// 取消置顶
handleClick('.post-unpin', '确定取消置顶吗?', function(id) {
api.post('/api/admin/posts/' + id + '/unpin')
.then(function(d) { if (d.success) refreshPage(); else showToast(d.message || '操作失败', 'error'); })
.catch(function() { showToast('操作失败', 'error'); });
});
})();