feat: share topic
This commit is contained in:
parent
654f054e53
commit
d026d220c4
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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> -->
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue