feat: reply panel hint

This commit is contained in:
KUN1007 2023-09-17 17:16:01 +08:00
parent 59b441b3da
commit e3e67f9156
6 changed files with 66 additions and 30 deletions

View file

@ -28,6 +28,7 @@
"mockjs", "mockjs",
"moemoe", "moemoe",
"moemoepoint", "moemoepoint",
"nawa",
"non-moe", "non-moe",
"okaidia", "okaidia",
"persistedstate", "persistedstate",
@ -54,7 +55,8 @@
"ymgal", "ymgal",
"Yuki", "Yuki",
"Yuuki", "Yuuki",
"yuyu" "yuyu",
"zako"
], ],
"i18n-ally.localesPaths": ["src/language"], "i18n-ally.localesPaths": ["src/language"],
"vue.codeActions.enabled": false "vue.codeActions.enabled": false

View file

@ -48,7 +48,7 @@ const messageClass = (type: string): string => {
<span class="icon" v-else-if="type === 'info'" <span class="icon" v-else-if="type === 'info'"
><Icon icon="line-md:alert-circle" ><Icon icon="line-md:alert-circle"
/></span> /></span>
<span>{{ message }}</span> <span v-html="message"></span>
</div> </div>
</div> </div>
</template> </template>

View file

@ -97,6 +97,8 @@ export default {
}, },
panel: { panel: {
to: 'Reply To', to: 'Reply To',
master: 'ご主人',
reply: 'zako♡',
}, },
}, },
update: { update: {

View file

@ -95,6 +95,11 @@ export default {
tags: '相同标签下的其它话题', tags: '相同标签下的其它话题',
master: '楼主的其它话题', master: '楼主的其它话题',
}, },
panel: {
to: '回复给',
master: '狗修金',
reply: '杂鱼~♡',
},
}, },
update: { update: {
next: '下个版本', next: '下个版本',

View file

@ -10,9 +10,9 @@ import {
computed, computed,
watch, watch,
onBeforeUnmount, onBeforeUnmount,
watchEffect,
} from 'vue' } from 'vue'
import { onBeforeRouteLeave, useRoute } from 'vue-router' import { onBeforeRouteLeave, useRoute } from 'vue-router'
import message from '@/components/alert/Message'
import { TopicDetail, TopicReply } from '@/api' import { TopicDetail, TopicReply } from '@/api'
@ -68,7 +68,7 @@ const getReplies = async (): Promise<TopicReply[]> => {
return (await useKUNGalgameTopicStore().getReplies(tid.value)).data return (await useKUNGalgameTopicStore().getReplies(tid.value)).data
} }
// getReplies watch // getReplies watch
watch( watch(
() => [ () => [
replyRequest.value.sortOrder, replyRequest.value.sortOrder,
@ -94,26 +94,39 @@ watch(isScrollToTop, () => {
}) })
// //
watchEffect(async () => { watch(
if (content.value) { () => scrollToReplyId.value,
// id async () => {
const childElement = content.value.querySelector( //
`#kungalgame-reply-${scrollToReplyId.value}` if (content.value && scrollToReplyId.value !== -1) {
) as HTMLElement // id
const childElement = content.value.querySelector(
`#kungalgame-reply-${scrollToReplyId.value}`
) as HTMLElement
// style // style
if (childElement) { if (childElement) {
childElement.scrollIntoView({ behavior: 'smooth', block: 'center' }) childElement.scrollIntoView({ behavior: 'smooth', block: 'center' })
childElement.classList.add('active') childElement.classList.add('active')
//
await new Promise((resolve) => { //
setTimeout(resolve, 3000) await new Promise((resolve) => {
}) setTimeout(resolve, 3000)
childElement.classList.remove('active') })
childElement.classList.remove('active')
// DOM
} else {
message(
'Unable to find the specified reply for now. Please scroll down.',
'暂时找不到指定回复,请下滑',
'info'
)
}
scrollToReplyId.value = -1
} }
scrollToReplyId.value = -1
} }
}) )
// //
const scrollHandler = async () => { const scrollHandler = async () => {

View file

@ -30,7 +30,9 @@ const { isShowAdvance, isEdit, replyDraft } = storeToRefs(
useKUNGalgameTopicStore() useKUNGalgameTopicStore()
) )
const position = computed(() => {}) const position = computed(() => {
return replyDraft.value.to_floor === 0 ? 'master' : 'reply'
})
const handelClosePanel = () => { const handelClosePanel = () => {
isShowAdvance.value = false isShowAdvance.value = false
@ -49,9 +51,15 @@ const handelClosePanel = () => {
<!-- 回复面板回复给谁 --> <!-- 回复面板回复给谁 -->
<div class="title"> <div class="title">
<h3> <h3>
{{ $tm('topic.panel.to') + ' @' }} <span>{{ $tm('topic.panel.to') + ' @' }}</span>
<span>{{ replyDraft.replyUserName }}</span> <span>{{ replyDraft.replyUserName }}</span>
<span>{{ replyDraft.to_floor }}</span> <span>
{{
`(⋈◍>◡<◍)。✧♡ ${$tm(`topic.panel.${position}`)} ${
replyDraft.to_floor
}`
}}
</span>
</h3> </h3>
<Icon <Icon
@click="handelClosePanel" @click="handelClosePanel"
@ -112,17 +120,23 @@ const handelClosePanel = () => {
} }
.title { .title {
margin-bottom: 10px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 10px; padding: 10px;
padding-left: 20px;
span { span {
cursor: pointer; &:nth-child(2) {
color: var(--kungalgame-blue-5); margin: 0 5px;
border-bottom: 2px solid var(--kungalgame-white-9); cursor: pointer;
&:hover { color: var(--kungalgame-pink-3);
border-bottom: 2px solid var(--kungalgame-blue-5); border-bottom: 2px solid var(--kungalgame-white-9);
&:hover {
border-bottom: 2px solid var(--kungalgame-pink-3);
}
}
&:nth-child(3) {
margin-left: 40px;
} }
} }
} }