diff --git a/cwd-comments-admin/src/api/admin.ts b/cwd-comments-admin/src/api/admin.ts index 26dc39d..e91e3f9 100644 --- a/cwd-comments-admin/src/api/admin.ts +++ b/cwd-comments-admin/src/api/admin.ts @@ -44,6 +44,7 @@ export type CommentSettingsResponse = { adminKeySet?: boolean; requireReview?: boolean; blockedIps?: string[]; + blockedEmails?: string[]; }; export type EmailNotifySettingsResponse = { @@ -139,6 +140,7 @@ export function saveCommentSettings(data: { adminKey?: string; requireReview?: boolean; blockedIps?: string[]; + blockedEmails?: string[]; }): Promise<{ message: string }> { return put<{ message: string }>('/admin/settings/comments', data); } @@ -147,6 +149,10 @@ export function blockIp(ip: string): Promise<{ message: string }> { return post<{ message: string }>('/admin/comments/block-ip', { ip }); } +export function blockEmail(email: string): Promise<{ message: string }> { + return post<{ message: string }>('/admin/comments/block-email', { email }); +} + export function exportComments(): Promise { return get('/admin/comments/export'); } diff --git a/cwd-comments-admin/src/views/CommentsView.vue b/cwd-comments-admin/src/views/CommentsView.vue index b5792a1..9326662 100644 --- a/cwd-comments-admin/src/views/CommentsView.vue +++ b/cwd-comments-admin/src/views/CommentsView.vue @@ -36,7 +36,15 @@ />
{{ item.name }}
-
{{ item.email }}
+
+ +
{{ formatDate(item.created) }}
{{ item.ipAddress }} @@ -180,6 +188,7 @@ import { deleteComment, updateCommentStatus, blockIp, + blockEmail, } from "../api/admin"; const comments = ref([]); @@ -311,6 +320,21 @@ async function handleBlockIp(item: CommentItem) { } } +async function handleBlockEmail(item: CommentItem) { + if (!item.email) { + return; + } + if (!window.confirm(`确认将邮箱 ${item.email} 加入黑名单吗?`)) { + return; + } + try { + const res = await blockEmail(item.email); + window.alert(res.message || "已加入邮箱黑名单"); + } catch (e: any) { + error.value = e.message || "屏蔽邮箱失败"; + } +} + onMounted(() => { loadComments(); }); @@ -479,6 +503,14 @@ onMounted(() => { margin-bottom: 2px; } +.cell-email-text { + cursor: pointer; +} + +.cell-email-text:hover { + text-decoration: underline; +} + .cell-content-text { font-size: 13px; line-height: 1.5; diff --git a/cwd-comments-admin/src/views/SettingsView.vue b/cwd-comments-admin/src/views/SettingsView.vue index 1a01f1b..1c809fb 100644 --- a/cwd-comments-admin/src/views/SettingsView.vue +++ b/cwd-comments-admin/src/views/SettingsView.vue @@ -39,27 +39,9 @@

安全设置

-
- - -
-
- - -
-
+
设置后前台使用管理员邮箱评论需输入此密钥。
+
+ + +
+
+ + +
+
+ + +
+