feat(analytics): 添加点赞统计功能并修复页面URL处理
- 在admin.ts中添加LikeStats相关类型定义和API接口 - 在AnalyticsVisitView.vue中添加点赞排行榜展示 - 修改CWDComments.js中postUrl的生成逻辑,使用origin+pathname代替href
This commit is contained in:
@@ -111,6 +111,17 @@ export type DomainListResponse = {
|
||||
domains: string[];
|
||||
};
|
||||
|
||||
export type LikeStatsItem = {
|
||||
pageSlug: string;
|
||||
pageTitle: string | null;
|
||||
pageUrl: string | null;
|
||||
likes: number;
|
||||
};
|
||||
|
||||
export type LikeStatsResponse = {
|
||||
items: LikeStatsItem[];
|
||||
};
|
||||
|
||||
export async function loginAdmin(name: string, password: string): Promise<string> {
|
||||
const res = await post<AdminLoginResponse>('/admin/login', { name, password });
|
||||
const key = res.data.key;
|
||||
@@ -273,3 +284,7 @@ export function fetchVisitPages(domain?: string, order?: 'pv' | 'latest'): Promi
|
||||
export function fetchDomainList(): Promise<DomainListResponse> {
|
||||
return get<DomainListResponse>('/admin/stats/domains');
|
||||
}
|
||||
|
||||
export function fetchLikeStats(): Promise<LikeStatsResponse> {
|
||||
return get<LikeStatsResponse>('/admin/likes/stats');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user