mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-03-04 19:10:47 +08:00
feat: auto select medals and make badges interactive
This commit is contained in:
@@ -11,7 +11,11 @@
|
||||
<div class="common-info-content-header">
|
||||
<div class="info-content-header-left">
|
||||
<span class="user-name">{{ comment.userName }}</span>
|
||||
<span v-if="comment.medal" class="medal-name">{{ getMedalTitle(comment.medal) }}</span>
|
||||
<span
|
||||
v-if="comment.medal"
|
||||
class="medal-name"
|
||||
@click="gotoProfileMedals(comment.userId)"
|
||||
>{{ getMedalTitle(comment.medal) }}</span>
|
||||
<span v-if="level >= 2">
|
||||
<i class="fas fa-reply reply-icon"></i>
|
||||
<span class="user-name reply-user-name">{{ comment.parentUserName }}</span>
|
||||
@@ -115,6 +119,10 @@ const CommentItem = {
|
||||
showEditor.value = !showEditor.value
|
||||
}
|
||||
|
||||
const gotoProfileMedals = (id) => {
|
||||
router.push(`/users/${id}?tab=achievements`)
|
||||
}
|
||||
|
||||
// 合并所有子回复为一个扁平数组
|
||||
const flattenReplies = (list) => {
|
||||
let result = []
|
||||
@@ -234,7 +242,7 @@ const CommentItem = {
|
||||
lightboxVisible.value = true
|
||||
}
|
||||
}
|
||||
return { showReplies, toggleReplies, showEditor, toggleEditor, submitReply, copyCommentLink, renderMarkdown, isWaitingForReply, commentMenuItems, deleteComment, lightboxVisible, lightboxIndex, lightboxImgs, handleContentClick, loggedIn, replyCount, replyList, getMedalTitle }
|
||||
return { showReplies, toggleReplies, showEditor, toggleEditor, gotoProfileMedals, submitReply, copyCommentLink, renderMarkdown, isWaitingForReply, commentMenuItems, deleteComment, lightboxVisible, lightboxIndex, lightboxImgs, handleContentClick, loggedIn, replyCount, replyList, getMedalTitle }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,6 +297,7 @@ export default CommentItem
|
||||
font-size: 12px;
|
||||
margin-left: 4px;
|
||||
opacity: 0.6;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@keyframes highlight {
|
||||
|
||||
@@ -43,7 +43,11 @@
|
||||
<div v-if="isMobile" class="info-content-header">
|
||||
<div class="user-name">
|
||||
{{ author.username }}
|
||||
<span v-if="author.displayMedal" class="user-medal">{{ getMedalTitle(author.displayMedal) }}</span>
|
||||
<span
|
||||
v-if="author.displayMedal"
|
||||
class="user-medal"
|
||||
@click="gotoProfileMedals"
|
||||
>{{ getMedalTitle(author.displayMedal) }}</span>
|
||||
</div>
|
||||
<div class="post-time">{{ postTime }}</div>
|
||||
</div>
|
||||
@@ -53,7 +57,11 @@
|
||||
<div v-if="!isMobile" class="info-content-header">
|
||||
<div class="user-name">
|
||||
{{ author.username }}
|
||||
<span v-if="author.displayMedal" class="user-medal">{{ getMedalTitle(author.displayMedal) }}</span>
|
||||
<span
|
||||
v-if="author.displayMedal"
|
||||
class="user-medal"
|
||||
@click="gotoProfileMedals"
|
||||
>{{ getMedalTitle(author.displayMedal) }}</span>
|
||||
</div>
|
||||
<div class="post-time">{{ postTime }}</div>
|
||||
</div>
|
||||
@@ -235,6 +243,7 @@ export default {
|
||||
const mapComment = (c, parentUserName = '', level = 0) => ({
|
||||
id: c.id,
|
||||
userName: c.author.username,
|
||||
userId: c.author.id,
|
||||
medal: c.author.displayMedal,
|
||||
time: TimeManager.format(c.createdAt),
|
||||
avatar: c.author.avatar,
|
||||
@@ -598,6 +607,10 @@ export default {
|
||||
router.push(`/users/${author.value.id}`)
|
||||
}
|
||||
|
||||
const gotoProfileMedals = () => {
|
||||
router.push(`/users/${author.value.id}?tab=achievements`)
|
||||
}
|
||||
|
||||
await fetchPost()
|
||||
|
||||
onMounted(async () => {
|
||||
@@ -635,6 +648,7 @@ export default {
|
||||
isWaitingFetchingPost,
|
||||
isWaitingPostingComment,
|
||||
gotoProfile,
|
||||
gotoProfileMedals,
|
||||
subscribed,
|
||||
loggedIn,
|
||||
isAuthor,
|
||||
@@ -940,6 +954,7 @@ export default {
|
||||
font-size: 12px;
|
||||
margin-left: 4px;
|
||||
opacity: 0.6;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.post-time {
|
||||
@@ -1008,6 +1023,7 @@ export default {
|
||||
|
||||
.user-medal {
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.post-time {
|
||||
|
||||
Reference in New Issue
Block a user