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; +}