feat(评论): 添加评论置顶功能及样式

- 在评论项中显示置顶标识
- 添加置顶评论的样式
- 优化评论管理界面的置顶权重输入和显示
This commit is contained in:
anghunk
2026-01-21 21:41:37 +08:00
parent 09f9800f2a
commit aabf370f65
3 changed files with 43 additions and 9 deletions

View File

@@ -32,6 +32,7 @@ export class CommentItem extends Component {
render() {
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;
@@ -79,10 +80,12 @@ export class CommentItem extends Component {
]
})
: this.createTextElement('span', comment.name, 'cwd-author-name'),
// 博主标识
...(isAdmin ? [
this.createTextElement('span', `${adminBadge}`, 'cwd-admin-badge')
] : []),
...(isPinned ? [
this.createTextElement('span', '置顶', 'cwd-pin-badge')
] : []),
// 显示回复目标
...(comment.replyToAuthor ? [
this.createTextElement('span', ' 回复 ', 'cwd-reply-to-separator'),

View File

@@ -357,6 +357,15 @@
margin: 0 4px;
}
.cwd-pin-badge {
background: #fff8c5;
color: #9a6700;
border-radius: 3px;
padding: 1px 4px;
font-size: 12px;
margin: 0 4px;
}
.cwd-reply-to-separator {
margin: 0 4px;
}