mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-06 23:21:16 +08:00
feat: 更新评论项组件,增加回复用户头像点击事件,取消使用 replace
This commit is contained in:
@@ -26,7 +26,8 @@
|
||||
<span v-if="level >= 2" class="reply-item">
|
||||
<i class="fas fa-reply reply-icon"></i>
|
||||
<span class="reply-info">
|
||||
<img :src="comment.parentUserAvatar || '/default-avatar.svg'" alt="" class="reply-avatar">
|
||||
<BaseImage class="reply-avatar" :src="comment.parentUserAvatar || '/default-avatar.svg'" alt="avatar"
|
||||
@click="comment.parentUserClick && comment.parentUserClick()" />
|
||||
<span class="reply-user-name">{{ comment.parentUserName }}</span>
|
||||
</span>
|
||||
</span>
|
||||
@@ -391,6 +392,7 @@ const handleContentClick = (e) => {
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
margin-right: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.reply-icon {
|
||||
|
||||
@@ -411,7 +411,7 @@ const gatherPostItems = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const mapComment = (c, parentUserName = '', parentUserAvatar = '', level = 0) => ({
|
||||
const mapComment = (c, parentUserName = '', parentUserAvatar = '', parentUserId = '', level = 0) => ({
|
||||
id: c.id,
|
||||
userName: c.author.username,
|
||||
medal: c.author.displayMedal,
|
||||
@@ -421,12 +421,13 @@ const mapComment = (c, parentUserName = '', parentUserAvatar = '', level = 0) =>
|
||||
text: c.content,
|
||||
reactions: c.reactions || [],
|
||||
pinned: Boolean(c.pinned ?? c.pinnedAt ?? c.pinned_at),
|
||||
reply: (c.replies || []).map((r) => mapComment(r, c.author.username, c.author.avatar, level + 1)),
|
||||
reply: (c.replies || []).map((r) => mapComment(r, c.author.username, c.author.avatar, c.author.id, level + 1)),
|
||||
openReplies: level === 0,
|
||||
src: c.author.avatar,
|
||||
iconClick: () => navigateTo(`/users/${c.author.id}`, { replace: true }),
|
||||
iconClick: () => navigateTo(`/users/${c.author.id}`),
|
||||
parentUserName: parentUserName,
|
||||
parentUserAvatar: parentUserAvatar,
|
||||
parentUserClick: parentUserId ? () => navigateTo(`/users/${parentUserId}`) : null,
|
||||
})
|
||||
|
||||
const getTop = (el) => {
|
||||
|
||||
Reference in New Issue
Block a user