feat(评论): 新增功能开关管理及评论点赞功能优化

- 在管理后台添加功能开关页面,支持控制评论点赞和文章点赞功能的开启/关闭
- 优化评论点赞功能,支持取消点赞和本地存储点赞状态
- 更新点赞UI样式,提升用户体验
- 添加相关API接口和文档说明
This commit is contained in:
anghunk
2026-01-22 22:26:43 +08:00
parent 74c7fa9e1c
commit e0be92b1fe
15 changed files with 806 additions and 120 deletions

View File

@@ -178,7 +178,7 @@ export function createApiClient(config) {
return response.json();
}
async function likeComment(commentId) {
async function likeComment(commentId, isLike = true) {
const id =
typeof commentId === 'number'
? commentId
@@ -188,8 +188,9 @@ export function createApiClient(config) {
if (!Number.isFinite(id) || id <= 0) {
throw new Error('Invalid comment id');
}
const method = isLike ? 'POST' : 'DELETE';
const response = await fetch(`${baseUrl}/api/comments/like`, {
method: 'POST',
method,
headers: {
'Content-Type': 'application/json'
},