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",
"moemoe",
"moemoepoint",
"nawa",
"non-moe",
"okaidia",
"persistedstate",
@ -54,7 +55,8 @@
"ymgal",
"Yuki",
"Yuuki",
"yuyu"
"yuyu",
"zako"
],
"i18n-ally.localesPaths": ["src/language"],
"vue.codeActions.enabled": false

View file

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

View file

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

View file

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

View file

@ -10,9 +10,9 @@ import {
computed,
watch,
onBeforeUnmount,
watchEffect,
} from 'vue'
import { onBeforeRouteLeave, useRoute } from 'vue-router'
import message from '@/components/alert/Message'
import { TopicDetail, TopicReply } from '@/api'
@ -68,7 +68,7 @@ const getReplies = async (): Promise<TopicReply[]> => {
return (await useKUNGalgameTopicStore().getReplies(tid.value)).data
}
// getReplies watch
// getReplies watch
watch(
() => [
replyRequest.value.sortOrder,
@ -94,26 +94,39 @@ watch(isScrollToTop, () => {
})
//
watchEffect(async () => {
if (content.value) {
// id
const childElement = content.value.querySelector(
`#kungalgame-reply-${scrollToReplyId.value}`
) as HTMLElement
watch(
() => scrollToReplyId.value,
async () => {
//
if (content.value && scrollToReplyId.value !== -1) {
// id
const childElement = content.value.querySelector(
`#kungalgame-reply-${scrollToReplyId.value}`
) as HTMLElement
// style
if (childElement) {
childElement.scrollIntoView({ behavior: 'smooth', block: 'center' })
childElement.classList.add('active')
//
await new Promise((resolve) => {
setTimeout(resolve, 3000)
})
childElement.classList.remove('active')
// style
if (childElement) {
childElement.scrollIntoView({ behavior: 'smooth', block: 'center' })
childElement.classList.add('active')
//
await new Promise((resolve) => {
setTimeout(resolve, 3000)
})
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 () => {

View file

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