feat: share topic

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

View file

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

View file

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

View file

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

View file

@ -13,8 +13,18 @@ import Reply from './Reply.vue'
//
import Rewrite from './Rewrite.vue'
//
import message from '@/components/alert/Message'
// store
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<{
@ -50,6 +60,35 @@ const toUser = computed(() => props.toUser)
*/
// 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>
<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: -->
<!-- <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<{
repliesData: TopicReply[]
title: string
}>()
// props
@ -104,7 +105,7 @@ const handleClickComment = (
<!-- 上部区域的左边 -->
<div class="reply">
<!-- 跳转到页面中话题的位置 -->
回复给 @
{{ `${$tm('topic.panel.to')} @` }}
<span @click="scrollToReplyId = reply.to_floor">
{{ reply.to_user.name }}
</span>
@ -136,7 +137,7 @@ const handleClickComment = (
upvotes: reply.upvotes,
}"
:content="{
title: '',
title: props.title,
content: reply.content,
tags: reply.tags,
category: [],
@ -321,5 +322,10 @@ const handleClickComment = (
.article {
flex-direction: column;
}
.top {
margin: 0;
padding-bottom: 10px;
border-bottom: 1px solid var(--kungalgame-blue-1);
}
}
</style>