From 369f34f89d1518160f0c102064093c95e57f95fa Mon Sep 17 00:00:00 2001 From: anghunk Date: Fri, 23 Jan 2026 20:14:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=8D=9A=E4=B8=BB?= =?UTF-8?q?=E6=A0=87=E8=AF=86=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9B=BE=E6=A0=87=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 adminBadge 为空的检查,允许仅通过邮箱识别博主 - 当未设置博主标签文字时,默认显示认证图标替代文本标签 - 更新管理后台标签说明,提示留空使用默认图标 - 添加博主图标专用样式,确保透明背景和正确颜色 --- cwd-admin/src/views/SettingsView.vue | 4 ++-- docs/widget/src/components/CommentItem.js | 9 +++++++-- docs/widget/src/core/CWDComments.js | 2 +- docs/widget/src/styles/main.css | 6 ++++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/cwd-admin/src/views/SettingsView.vue b/cwd-admin/src/views/SettingsView.vue index 91f55df..f991e46 100644 --- a/cwd-admin/src/views/SettingsView.vue +++ b/cwd-admin/src/views/SettingsView.vue @@ -22,7 +22,7 @@
- +
@@ -468,7 +468,7 @@ async function load() { ]); email.value = notifyRes.email || ""; commentAdminEmail.value = commentRes.adminEmail || ""; - commentAdminBadge.value = commentRes.adminBadge || "博主"; + commentAdminBadge.value = commentRes.adminBadge ?? ""; avatarPrefix.value = commentRes.avatarPrefix || ""; commentAdminEnabled.value = !!commentRes.adminEnabled; allowedDomains.value = commentRes.allowedDomains diff --git a/docs/widget/src/components/CommentItem.js b/docs/widget/src/components/CommentItem.js index f104b42..d673b10 100644 --- a/docs/widget/src/components/CommentItem.js +++ b/docs/widget/src/components/CommentItem.js @@ -39,7 +39,7 @@ export class CommentItem extends Component { const { comment, isReply, adminEmail, adminBadge } = this.props; const isPinned = typeof comment.priority === 'number' && comment.priority > 1; const isReplying = this.props.replyingTo === comment.id; - const isAdmin = adminEmail && adminBadge && comment.email === adminEmail; + const isAdmin = adminEmail && comment.email === adminEmail; const root = this.createElement('div', { className: `cwd-comment-item ${isReply ? 'cwd-comment-reply' : ''}`, @@ -86,7 +86,12 @@ export class CommentItem extends Component { }) : this.createTextElement('span', comment.name, 'cwd-author-name'), ...(isAdmin ? [ - this.createTextElement('span', `${adminBadge}`, 'cwd-admin-badge') + adminBadge + ? this.createTextElement('span', `${adminBadge}`, 'cwd-admin-badge') + : this.createElement('span', { + className: 'cwd-admin-badge cwd-admin-badge-icon', + html: '' + }) ] : []), ...(isPinned ? [ this.createTextElement('span', '置顶', 'cwd-pin-badge') diff --git a/docs/widget/src/core/CWDComments.js b/docs/widget/src/core/CWDComments.js index d72e7c5..24071fd 100644 --- a/docs/widget/src/core/CWDComments.js +++ b/docs/widget/src/core/CWDComments.js @@ -163,7 +163,7 @@ export class CWDComments { if (serverConfig.adminEmail) { this.config.adminEmail = serverConfig.adminEmail; } - if (serverConfig.adminEnabled && serverConfig.adminBadge) { + if (serverConfig.adminEnabled) { this.config.adminBadge = serverConfig.adminBadge; } this.config.requireReview = !!serverConfig.requireReview; diff --git a/docs/widget/src/styles/main.css b/docs/widget/src/styles/main.css index d92344d..e292abd 100644 --- a/docs/widget/src/styles/main.css +++ b/docs/widget/src/styles/main.css @@ -976,3 +976,9 @@ .cwd-btn-text:hover { color: var(--cwd-primary); } + +.cwd-admin-badge.cwd-admin-badge-icon { + background: transparent; + padding: 0; + color: #db850d; +}