feat: add BaseUserAvatar and unify avatar usage

This commit is contained in:
Tim
2025-09-24 00:26:51 +08:00
parent 26d1db79f4
commit efbb83924b
15 changed files with 263 additions and 91 deletions
+10 -5
View File
@@ -26,10 +26,14 @@
<span v-if="level >= 2" class="reply-item">
<next class="reply-icon" />
<span class="reply-info">
<BaseImage
<BaseUserAvatar
v-if="comment.parentUserName"
class="reply-avatar"
:src="comment.parentUserAvatar || '/default-avatar.svg'"
alt="avatar"
:user-id="comment.parentUserId"
:avatar="comment.parentUserAvatar"
:username="comment.parentUserName"
:width="20"
:link="Boolean(comment.parentUserId)"
@click="comment.parentUserClick && comment.parentUserClick()"
/>
<span class="reply-user-name">{{ comment.parentUserName }}</span>
@@ -253,16 +257,19 @@ const submitReply = async (parentUserName, text, clear) => {
replyList.push({
id: data.id,
userName: data.author.username,
userId: data.author.id,
time: TimeManager.format(data.createdAt),
avatar: data.author.avatar,
medal: data.author.displayMedal,
text: data.content,
parentUserName: parentUserName,
parentUserAvatar: props.comment.avatar,
parentUserId: props.comment.userId,
reactions: [],
reply: (data.replies || []).map((r) => ({
id: r.id,
userName: r.author.username,
userId: r.author.id,
time: TimeManager.format(r.createdAt),
avatar: r.author.avatar,
text: r.content,
@@ -394,9 +401,7 @@ const handleContentClick = (e) => {
.reply-avatar {
width: 20px;
height: 20px;
border-radius: 50%;
margin-right: 5px;
cursor: pointer;
}
.reply-icon {