feat: share topic

This commit is contained in:
KUN1007 2023-10-09 02:47:54 +08:00
parent 654f054e53
commit d026d220c4
5 changed files with 62 additions and 5 deletions

View file

@ -291,8 +291,9 @@ onBeforeMount(() => {
</Transition> </Transition>
<Master v-if="topicData" :topicData="topicData" /> <Master v-if="topicData" :topicData="topicData" />
<Reply <Reply
v-if="repliesData" v-if="topicData && repliesData"
:repliesData="repliesData" :repliesData="repliesData"
:title="topicData.title"
:isExecuteScrollToReplyAnimate="isExecuteScrollToReplyAnimate" :isExecuteScrollToReplyAnimate="isExecuteScrollToReplyAnimate"
/> />
</div> </div>

View file

@ -105,6 +105,7 @@ defineProps<{
.kungalgame-topic-content { .kungalgame-topic-content {
width: 100%; width: 100%;
margin-top: 0; margin-top: 0;
padding: 17px 7px;
} }
} }
</style> </style>

View file

@ -64,10 +64,18 @@ const props = defineProps<{
.kungalgamer { .kungalgamer {
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
margin-top: 27px; margin-top: 17px;
padding-bottom: 10px; padding-bottom: 10px;
border-bottom: 1px solid var(--kungalgame-blue-1); border-bottom: 1px solid var(--kungalgame-blue-1);
} }
.avatar {
/* 图像加载不出来时页面不塌陷 */
width: 70px;
margin-top: 10px;
img {
width: 70px;
}
}
.info { .info {
margin-left: 50px; margin-left: 50px;
display: flex; display: flex;

View file

@ -13,8 +13,18 @@ import Reply from './Reply.vue'
// //
import Rewrite from './Rewrite.vue' import Rewrite from './Rewrite.vue'
//
import message from '@/components/alert/Message'
// store // store
import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer' import { useKUNGalgameUserStore } from '@/store/modules/kungalgamer'
// store
import { useKUNGalgameSettingsStore } from '@/store/modules/settings'
import { storeToRefs } from 'pinia'
// 使 store
const settingsStore = useKUNGalgameSettingsStore()
const { showKUNGalgameLanguage } = storeToRefs(settingsStore)
// //
const props = defineProps<{ const props = defineProps<{
@ -50,6 +60,35 @@ const toUser = computed(() => props.toUser)
*/ */
// uid // uid
const currUserUid = useKUNGalgameUserStore().uid const currUserUid = useKUNGalgameUserStore().uid
//
const handleClickShare = () => {
const shareLinkEN = computed(
() =>
`Share Link from KUN Visual Novel Forum ~~~
Title: ${props.content.title}
Link: https://www.kungal.com/topic/${props.info.tid}`
)
const shareLinkCN = computed(
() =>
`来自鲲 Galgame 论坛的分享链接 ~~~
标题: ${props.content.title}
链接: https://www.kungal.com/topic/${props.info.tid}`
)
const shareLink =
showKUNGalgameLanguage.value === 'en' ? shareLinkEN : shareLinkCN
navigator.clipboard
.writeText(shareLink.value)
.then(() => {
message('Share Link copied successfully!', '分享链接复制成功', 'success')
})
.catch((err) => {
message('Share Link copied failed!', '分享链接复制失败!', 'error')
})
}
</script> </script>
<template> <template>
@ -103,7 +142,9 @@ const currUserUid = useKUNGalgameUserStore().uid
/> />
<!-- 分享 --> <!-- 分享 -->
<span class="icon"><Icon icon="majesticons:share-line" /></span> <span @click="handleClickShare" class="icon"
><Icon icon="majesticons:share-line"
/></span>
<!-- 只看 TODO: --> <!-- 只看 TODO: -->
<!-- <span class="icon"><Icon icon="ph:user-focus-duotone" /></span> --> <!-- <span class="icon"><Icon icon="ph:user-focus-duotone" /></span> -->

View file

@ -41,6 +41,7 @@ const { tid, rid, toUid, toUsername, isShowCommentPanelRid } = storeToRefs(
const props = defineProps<{ const props = defineProps<{
repliesData: TopicReply[] repliesData: TopicReply[]
title: string
}>() }>()
// props // props
@ -104,7 +105,7 @@ const handleClickComment = (
<!-- 上部区域的左边 --> <!-- 上部区域的左边 -->
<div class="reply"> <div class="reply">
<!-- 跳转到页面中话题的位置 --> <!-- 跳转到页面中话题的位置 -->
回复给 @ {{ `${$tm('topic.panel.to')} @` }}
<span @click="scrollToReplyId = reply.to_floor"> <span @click="scrollToReplyId = reply.to_floor">
{{ reply.to_user.name }} {{ reply.to_user.name }}
</span> </span>
@ -136,7 +137,7 @@ const handleClickComment = (
upvotes: reply.upvotes, upvotes: reply.upvotes,
}" }"
:content="{ :content="{
title: '', title: props.title,
content: reply.content, content: reply.content,
tags: reply.tags, tags: reply.tags,
category: [], category: [],
@ -321,5 +322,10 @@ const handleClickComment = (
.article { .article {
flex-direction: column; flex-direction: column;
} }
.top {
margin: 0;
padding-bottom: 10px;
border-bottom: 1px solid var(--kungalgame-blue-1);
}
} }
</style> </style>