rebuild: reply

This commit is contained in:
KUN1007 2023-10-07 21:41:45 +08:00
parent be9e485be8
commit 5703903e64
7 changed files with 123 additions and 39 deletions

View file

@ -80,8 +80,7 @@ export const useKUNGalgameTopicStore = defineStore({
isShowHotKeywords: true, isShowHotKeywords: true,
tid: 0, tid: 0,
r_uid: 0, toUserName: '',
replyUserName: '',
to_uid: 0, to_uid: 0,
content: '', content: '',
tags: [], tags: [],
@ -280,8 +279,7 @@ export const useKUNGalgameTopicStore = defineStore({
resetReplyDraft() { resetReplyDraft() {
this.replyDraft.textCount = 0 this.replyDraft.textCount = 0
this.replyDraft.tid = 0 this.replyDraft.tid = 0
this.replyDraft.r_uid = 0 this.replyDraft.toUserName = ''
this.replyDraft.replyUserName = ''
this.replyDraft.to_uid = 0 this.replyDraft.to_uid = 0
this.replyDraft.content = '' this.replyDraft.content = ''
this.replyDraft.tags = [] this.replyDraft.tags = []

View file

@ -16,9 +16,8 @@ interface ReplyDraft {
// 当前话题的 id // 当前话题的 id
tid: number tid: number
r_uid: number
// 回复给谁,用于回复面板展示 // 回复给谁,用于回复面板展示
replyUserName: string toUserName: string
to_uid: number to_uid: number
content: string content: string
tags: string[] tags: string[]

View file

@ -102,7 +102,7 @@ const loliStatus = computed(() => {
<Rewrite v-if="edited" :time="edited" /> <Rewrite v-if="edited" :time="edited" />
</div> </div>
</div> </div>
<!-- 话题的点赞数等信息被作用人就是该话题的发布人 --> <!-- 话题的点赞数等信息被作用人就是该话题的发布人楼主 floor 0 -->
<Footer <Footer
:info="{ :info="{
tid, tid,
@ -118,7 +118,11 @@ const loliStatus = computed(() => {
tags, tags,
category, category,
}" }"
:to-uid="user.uid" :to-user="{
uid: user.uid,
name: user.name,
}"
:to-floor="0"
/> />
</div> </div>
</div> </div>

View file

@ -1,5 +1,6 @@
<!-- 话题的底部区域推话题回复点赞等 --> <!-- 话题的底部区域推话题回复点赞等 -->
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue'
// //
import Upvote from './Upvote.vue' import Upvote from './Upvote.vue'
@ -7,18 +8,13 @@ import Upvote from './Upvote.vue'
import Like from './Like.vue' import Like from './Like.vue'
// //
import Dislike from './Dislike.vue' import Dislike from './Dislike.vue'
//
import Reply from './Reply.vue'
// //
import Rewrite from './Rewrite.vue' import Rewrite from './Rewrite.vue'
// store
import { useKUNGalgameTopicStore } from '@/store/modules/topic'
// store // store
import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer'
import { storeToRefs } from 'pinia'
import { computed } from 'vue'
// 使 store
const { isEdit, replyDraft } = storeToRefs(useKUNGalgameTopicStore())
// //
const props = defineProps<{ const props = defineProps<{
@ -36,12 +32,16 @@ const props = defineProps<{
tags: string[] tags: string[]
category: string[] category: string[]
} }
toUid: number toUser: {
uid: number
name: string
}
toFloor: number
}>() }>()
const info = computed(() => props.info) const info = computed(() => props.info)
const content = computed(() => props.content) const content = computed(() => props.content)
const toUid = computed(() => props.toUid) const toUser = computed(() => props.toUser)
/** /**
* 这里只是简单起见不显示重新编辑 * 这里只是简单起见不显示重新编辑
@ -50,18 +50,6 @@ const toUid = computed(() => props.toUid)
*/ */
// uid // uid
const currUserUid = useKUNGalgameUserStore().uid const currUserUid = useKUNGalgameUserStore().uid
//
const handleClickReply = () => {
// 便
replyDraft.value.tid = info.value.tid
// uid
replyDraft.value.to_uid = toUid.value
// floor 0
replyDraft.value.to_floor = 0
//
isEdit.value = true
}
</script> </script>
<template> <template>
@ -76,7 +64,7 @@ const handleClickReply = () => {
:tid="info.tid" :tid="info.tid"
:rid="info.rid" :rid="info.rid"
:upvotes="info.upvotes" :upvotes="info.upvotes"
:to-uid="toUid" :to-uid="toUser.uid"
/> />
<!-- 浏览数楼主才会显示 --> <!-- 浏览数楼主才会显示 -->
@ -91,7 +79,7 @@ const handleClickReply = () => {
:tid="info.tid" :tid="info.tid"
:rid="info.rid" :rid="info.rid"
:likes="info.likes" :likes="info.likes"
:to-uid="toUid" :to-uid="toUser.uid"
/> />
<!-- --> <!-- -->
@ -100,22 +88,25 @@ const handleClickReply = () => {
:tid="info.tid" :tid="info.tid"
:rid="info.rid" :rid="info.rid"
:dislikes="info.dislikes" :dislikes="info.dislikes"
:to-uid="toUid" :to-uid="toUser.uid"
/> />
</ul> </ul>
</div> </div>
<!-- 底部右侧部分回复评论只看编辑 --> <!-- 底部右侧部分回复评论只看编辑 -->
<div class="right"> <div class="right">
<div @click="handleClickReply" class="reply"> <Reply
{{ $tm('topic.content.reply') }} :tid="info.tid"
</div> :to-user-name="toUser.name"
:to_uid="toUser.uid"
:to_floor="toFloor"
/>
<!-- 分享 --> <!-- 分享 -->
<span class="icon"><Icon icon="majesticons:share-line" /></span> <span class="icon"><Icon icon="majesticons:share-line" /></span>
<!-- 只看 --> <!-- 只看 -->
<span class="icon"><Icon icon="ph:user-focus-duotone" /></span> <!-- <span class="icon"><Icon icon="ph:user-focus-duotone" /></span> -->
<!-- 编辑 --> <!-- 编辑 -->
<Rewrite <Rewrite
@ -126,7 +117,7 @@ const handleClickReply = () => {
:content="content.content" :content="content.content"
:tags="content.tags" :tags="content.tags"
:category="content.category" :category="content.category"
:to-uid="toUid" :to-uid="toUser.uid"
/> />
<!-- 回复的插槽 --> <!-- 回复的插槽 -->

View file

@ -0,0 +1,88 @@
<!-- 话题的底部区域推话题回复点赞等 -->
<script setup lang="ts">
// store
import { useKUNGalgameTopicStore } from '@/store/modules/topic'
import { storeToRefs } from 'pinia'
// 使 store
const { isEdit, replyDraft } = storeToRefs(useKUNGalgameTopicStore())
//
const props = defineProps<{
tid: number
toUserName: string
to_uid: number
to_floor: number
}>()
//
const handleClickReply = () => {
// 便
replyDraft.value.tid = props.tid
replyDraft.value.toUserName = props.toUserName
replyDraft.value.to_uid = props.to_uid
replyDraft.value.to_floor = props.to_floor
//
isEdit.value = true
}
</script>
<template>
<div @click="handleClickReply" class="reply">
{{ $tm('topic.content.reply') }}
</div>
</template>
<style lang="scss" scoped>
.reply {
position: relative;
width: 70px;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
color: var(--kungalgame-blue-4);
cursor: pointer;
transition: all 0.2s;
margin-right: 10px;
&::before,
&::after {
content: '';
position: absolute;
width: 0;
height: 0;
top: 0;
left: 0;
box-sizing: border-box;
border: 2px solid transparent;
}
&:hover {
color: var(--kungalgame-pink-4);
&::before {
transition: width 0.2s, height 0.2s, border-bottom-color 0s;
transition-delay: 0.2s, 0s, 0.2s;
width: 70px;
height: 30px;
border-left: 2px solid var(--kungalgame-pink-4);
border-bottom: 2px solid var(--kungalgame-pink-4);
}
&::after {
transition: width 0.2s, height 0.2s, border-right-color 0.2s;
transition-delay: 0s, 0.2s, 0.2s;
width: 70px;
height: 30px;
border-top: 2px solid var(--kungalgame-pink-4);
border-right: 2px solid var(--kungalgame-pink-4);
}
}
}
@media (max-width: 700px) {
.reply {
margin-right: 0;
}
}
</style>

View file

@ -125,7 +125,11 @@ const handleClickComment = (rid: number) => {
tags: reply.tags, tags: reply.tags,
category: [], category: [],
}" }"
:to-uid="reply.r_user.uid" :to-user="{
uid: reply.r_user.uid,
name: reply.r_user.name,
}"
:to-floor="reply.floor"
> >
<template #comment> <template #comment>
<span @click="handleClickComment(reply.rid)" class="icon"> <span @click="handleClickComment(reply.rid)" class="icon">

View file

@ -66,7 +66,7 @@ const handelClosePanel = async () => {
<div class="title"> <div class="title">
<h3> <h3>
<span>{{ $tm('topic.panel.to') + ' @' }}</span> <span>{{ $tm('topic.panel.to') + ' @' }}</span>
<span>{{ replyDraft.replyUserName }}</span> <span>{{ replyDraft.toUserName }}</span>
<span> <span>
<span class="emoji">() </span> <span class="emoji">() </span>
{{ `${$tm(`topic.panel.${position}`)} ${replyDraft.to_floor}` }} {{ `${$tm(`topic.panel.${position}`)} ${replyDraft.to_floor}` }}