mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-09 11:39:31 +08:00
feat: 本地回复数据fixed
This commit is contained in:
@@ -47,6 +47,10 @@ export default {
|
|||||||
showLoginOverlay: {
|
showLoginOverlay: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
parentUserName: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: { LoginOverlay },
|
components: { LoginOverlay },
|
||||||
@@ -71,7 +75,7 @@ export default {
|
|||||||
if (!vditorInstance.value || isDisabled.value) return
|
if (!vditorInstance.value || isDisabled.value) return
|
||||||
const value = vditorInstance.value.getValue()
|
const value = vditorInstance.value.getValue()
|
||||||
console.debug('CommentEditor submit', value)
|
console.debug('CommentEditor submit', value)
|
||||||
emit('submit', value, () => {
|
emit('submit', props.parentUserName, value, () => {
|
||||||
if (!vditorInstance.value) return
|
if (!vditorInstance.value) return
|
||||||
vditorInstance.value.setValue('')
|
vditorInstance.value.setValue('')
|
||||||
text.value = ''
|
text.value = ''
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="comment-editor-wrapper">
|
<div class="comment-editor-wrapper">
|
||||||
<CommentEditor v-if="showEditor" @submit="submitReply" :loading="isWaitingForReply" :disabled="!loggedIn"
|
<CommentEditor v-if="showEditor" @submit="submitReply" :loading="isWaitingForReply" :disabled="!loggedIn"
|
||||||
:show-login-overlay="!loggedIn" />
|
:show-login-overlay="!loggedIn" :parent-user-name="comment.userName" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="replyCount && level < 2" class="reply-toggle" @click="toggleReplies">
|
<div v-if="replyCount && level < 2" class="reply-toggle" @click="toggleReplies">
|
||||||
<i v-if="showReplies" class="fas fa-chevron-up reply-toggle-icon"></i>
|
<i v-if="showReplies" class="fas fa-chevron-up reply-toggle-icon"></i>
|
||||||
@@ -164,7 +164,7 @@ const CommentItem = {
|
|||||||
toast.error('操作失败')
|
toast.error('操作失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const submitReply = async (text, clear) => {
|
const submitReply = async (parentUserName, text, clear) => {
|
||||||
if (!text.trim()) return
|
if (!text.trim()) return
|
||||||
isWaitingForReply.value = true
|
isWaitingForReply.value = true
|
||||||
const token = getToken()
|
const token = getToken()
|
||||||
@@ -190,7 +190,9 @@ const CommentItem = {
|
|||||||
userName: data.author.username,
|
userName: data.author.username,
|
||||||
time: TimeManager.format(data.createdAt),
|
time: TimeManager.format(data.createdAt),
|
||||||
avatar: data.author.avatar,
|
avatar: data.author.avatar,
|
||||||
|
medal: data.author.displayMedal,
|
||||||
text: data.content,
|
text: data.content,
|
||||||
|
parentUserName: parentUserName,
|
||||||
reactions: [],
|
reactions: [],
|
||||||
reply: (data.replies || []).map(r => ({
|
reply: (data.replies || []).map(r => ({
|
||||||
id: r.id,
|
id: r.id,
|
||||||
|
|||||||
@@ -153,11 +153,6 @@ export default {
|
|||||||
isLoadingTag.value = false
|
isLoadingTag.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
// fetchCategoryData()
|
|
||||||
// fetchTagData()
|
|
||||||
})
|
|
||||||
|
|
||||||
const iconClass = computed(() => {
|
const iconClass = computed(() => {
|
||||||
switch (themeState.mode) {
|
switch (themeState.mode) {
|
||||||
case ThemeMode.DARK:
|
case ThemeMode.DARK:
|
||||||
|
|||||||
@@ -21,11 +21,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="loggedIn && !isAuthor && !subscribed" class="article-subscribe-button" @click="subscribePost">
|
<div v-if="loggedIn && !isAuthor && !subscribed" class="article-subscribe-button" @click="subscribePost">
|
||||||
<i class="fas fa-user-plus"></i>
|
<i class="fas fa-user-plus"></i>
|
||||||
<div class="article-subscribe-button-text">订阅文章</div>
|
<div class="article-subscribe-button-text">
|
||||||
|
{{ isMobile ? '订阅' : '订阅文章' }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="loggedIn && !isAuthor && subscribed" class="article-unsubscribe-button" @click="unsubscribePost">
|
<div v-if="loggedIn && !isAuthor && subscribed" class="article-unsubscribe-button" @click="unsubscribePost">
|
||||||
<i class="fas fa-user-minus"></i>
|
<i class="fas fa-user-minus"></i>
|
||||||
<div class="article-unsubscribe-button-text">取消订阅</div>
|
<div class="article-unsubscribe-button-text">
|
||||||
|
{{ isMobile ? '退订' : '取消订阅' }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DropdownMenu v-if="articleMenuItems.length > 0" :items="articleMenuItems">
|
<DropdownMenu v-if="articleMenuItems.length > 0" :items="articleMenuItems">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
|
|||||||
Reference in New Issue
Block a user