Merge branch 'main' of github.com:nagisa77/OpenIsle

This commit is contained in:
tim
2025-08-10 13:19:02 +08:00
7 changed files with 60 additions and 33 deletions

View File

@@ -21,11 +21,15 @@
</div>
<div v-if="loggedIn && !isAuthor && !subscribed" class="article-subscribe-button" @click="subscribePost">
<i class="fas fa-user-plus"></i>
<div class="article-subscribe-button-text">订阅文章</div>
<div class="article-subscribe-button-text">
{{ isMobile ? '订阅' : '订阅文章' }}
</div>
</div>
<div v-if="loggedIn && !isAuthor && subscribed" class="article-unsubscribe-button" @click="unsubscribePost">
<i class="fas fa-user-minus"></i>
<div class="article-unsubscribe-button-text">取消订阅</div>
<div class="article-unsubscribe-button-text">
{{ isMobile ? '退订' : '取消订阅' }}
</div>
</div>
<DropdownMenu v-if="articleMenuItems.length > 0" :items="articleMenuItems">
<template #trigger>
@@ -44,11 +48,8 @@
<div class="user-name">
{{ author.username }}
<i class="fas fa-medal medal-icon"></i>
<router-link
v-if="author.displayMedal"
class="user-medal"
:to="`/users/${author.id}?tab=achievements`"
>{{ getMedalTitle(author.displayMedal) }}</router-link>
<router-link v-if="author.displayMedal" class="user-medal" :to="`/users/${author.id}?tab=achievements`">{{
getMedalTitle(author.displayMedal) }}</router-link>
</div>
<div class="post-time">{{ postTime }}</div>
</div>
@@ -59,11 +60,8 @@
<div class="user-name">
{{ author.username }}
<i class="fas fa-medal medal-icon"></i>
<router-link
v-if="author.displayMedal"
class="user-medal"
:to="`/users/${author.id}?tab=achievements`"
>{{ getMedalTitle(author.displayMedal) }}</router-link>
<router-link v-if="author.displayMedal" class="user-medal" :to="`/users/${author.id}?tab=achievements`">{{
getMedalTitle(author.displayMedal) }}</router-link>
</div>
<div class="post-time">{{ postTime }}</div>
</div>
@@ -93,7 +91,7 @@
<l-hatch size="28" stroke="4" speed="3.5" color="var(--primary-color)"></l-hatch>
</div>
<div v-else class="comments-container">
<BaseTimeline :items="comments">
<BaseTimeline :items="comments">
<template #item="{ item }">
<CommentItem :key="item.id" :comment="item" :level="0" :default-show-replies="item.openReplies"
@deleted="onCommentDeleted" />
@@ -197,7 +195,7 @@ export default {
window.removeEventListener('scroll', updateCurrentIndex)
})
}
const lightboxVisible = ref(false)
const lightboxIndex = ref(0)
const lightboxImgs = ref([])
@@ -334,7 +332,6 @@ export default {
category.value = data.category
tags.value = data.tags || []
postReactions.value = data.reactions || []
await fetchComments()
subscribed.value = !!data.subscribed
status.value = data.status
pinnedAt.value = data.pinnedAt
@@ -498,7 +495,7 @@ export default {
toast.error('操作失败')
}
}
const editPost = () => {
router.push(`/posts/${postId}/edit`)
}
@@ -593,7 +590,6 @@ export default {
const hash = location.hash
if (hash.startsWith('#comment-')) {
const id = hash.substring('#comment-'.length)
// 不清楚啥原因先wait一下子不然会定不准 😅
await new Promise(resolve => setTimeout(resolve, 500))
const el = document.getElementById('comment-' + id)
if (el) {
@@ -609,17 +605,18 @@ export default {
router.push(`/users/${author.value.id}`)
}
await fetchPost()
onMounted(async () => {
await fetchComments()
const hash = location.hash
const id = hash.startsWith('#comment-') ? hash.substring('#comment-'.length) : null
if (id) expandCommentPath(id)
updateCurrentIndex()
window.addEventListener('scroll', updateCurrentIndex)
await jumpToHashComment()
jumpToHashComment()
})
await fetchPost()
return {
postContent,
author,