feat(评论系统): 添加评论配置和头像显示功能
- 新增评论配置管理功能,包括博主邮箱、标签和头像前缀设置 - 在评论列表显示用户头像 - 实现服务端配置存储和获取逻辑 - 优化前端设置页面,拆分不同配置项 - 修改开发预览页面配置保存逻辑
This commit is contained in:
@@ -11,6 +11,7 @@ export type CommentItem = {
|
||||
pubDate: string;
|
||||
author: string;
|
||||
email: string;
|
||||
avatar: string;
|
||||
postSlug: string;
|
||||
url: string | null;
|
||||
ipAddress: string | null;
|
||||
@@ -32,6 +33,12 @@ export type AdminEmailResponse = {
|
||||
email: string | null;
|
||||
};
|
||||
|
||||
export type CommentSettingsResponse = {
|
||||
adminEmail: string | null;
|
||||
adminBadge: string | null;
|
||||
avatarPrefix: string | null;
|
||||
};
|
||||
|
||||
export async function loginAdmin(name: string, password: string): Promise<string> {
|
||||
const res = await post<AdminLoginResponse>('/admin/login', { name, password });
|
||||
const key = res.data.key;
|
||||
@@ -63,3 +70,14 @@ export function saveAdminEmail(email: string): Promise<{ message: string }> {
|
||||
return put<{ message: string }>('/admin/settings/email', { email });
|
||||
}
|
||||
|
||||
export function fetchCommentSettings(): Promise<CommentSettingsResponse> {
|
||||
return get<CommentSettingsResponse>('/admin/settings/comments');
|
||||
}
|
||||
|
||||
export function saveCommentSettings(data: {
|
||||
adminEmail?: string;
|
||||
adminBadge?: string;
|
||||
avatarPrefix?: string;
|
||||
}): Promise<{ message: string }> {
|
||||
return put<{ message: string }>('/admin/settings/comments', data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user