feat(admin): 添加评论数据看板功能

- 新增数据看板页面,展示评论统计信息
- 添加 echarts 依赖用于数据可视化
- 实现后端统计接口,包括总数、按域名和最近7天数据
- 完善前端统计页面样式和交互
- 更新文档说明和版本更新指南
This commit is contained in:
anghunk
2026-01-21 13:30:59 +08:00
parent ff3fa138da
commit 943225cc7f
10 changed files with 592 additions and 6 deletions

View File

@@ -62,6 +62,26 @@ export type EmailNotifySettingsResponse = {
};
};
export type CommentStatsResponse = {
summary: {
total: number;
approved: number;
pending: number;
rejected: number;
};
domains: {
domain: string;
total: number;
approved: number;
pending: number;
rejected: number;
}[];
last7Days: {
date: string;
total: number;
}[];
};
export async function loginAdmin(name: string, password: string): Promise<string> {
const res = await post<AdminLoginResponse>('/admin/login', { name, password });
const key = res.data.key;
@@ -160,3 +180,7 @@ export function exportComments(): Promise<any[]> {
export function importComments(data: any[]): Promise<{ message: string }> {
return post<{ message: string }>('/admin/comments/import', data);
}
export function fetchCommentStats(): Promise<CommentStatsResponse> {
return get<CommentStatsResponse>('/admin/stats/comments');
}