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

@@ -123,6 +123,11 @@ export type LikeStatsResponse = {
items: LikeStatsItem[];
};
export type FeatureSettingsResponse = {
enableCommentLike: boolean;
enableArticleLike: boolean;
};
export async function loginAdmin(name: string, password: string): Promise<string> {
const res = await post<AdminLoginResponse>('/admin/login', { name, password });
const key = res.data.key;
@@ -289,3 +294,14 @@ export function fetchDomainList(): Promise<DomainListResponse> {
export function fetchLikeStats(): Promise<LikeStatsResponse> {
return get<LikeStatsResponse>('/admin/likes/stats');
}
export function fetchFeatureSettings(): Promise<FeatureSettingsResponse> {
return get<FeatureSettingsResponse>('/admin/settings/features');
}
export function saveFeatureSettings(data: {
enableCommentLike?: boolean;
enableArticleLike?: boolean;
}): Promise<{ message: string }> {
return put<{ message: string }>('/admin/settings/features', data);
}