1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <template>
- <div class="share" v-if="type === '5'">
- <el-button class="show copy" type="text" @click="useCopyText(props.content!, props.id!)">复制话术内容</el-button>
- <div class="showNum" v-if="allStatus === 1">已使用:{{ props.pv || 0 }}次</div>
- </div>
- <div class="share" v-else>
- <div class="show" @click.stop="handleDetail(props)">查看{{ controlText }}</div>
- <div class="show" @click.stop="
- useWeChatShare({
- type: props.type!,
- id: props.id!,
- spId: serviceProviderId as number,
- imageUrl: imageLink,
- isShowToast: true,
- suid: userId as number,
- })
- ">
- 分享
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import { DArchiveResultData } from "@/types/api/context.type";
- import { DFindParams, DScrollTab, tabList } from "@/types/views/database.type";
- import { computed } from "vue";
- import useWeChatShare from "@/Hooks/useWeChatShare";
- import { useUserInfoState } from "@/store/user/user";
- import getFileImg from "@/Hooks/useFileImage";
- import useCopyText from '@/Hooks/useCopyText';
- const props = defineProps<DArchiveResultData>();
- const { serviceProviderId, userId } = useUserInfoState();
- const imageLink = computed<string>(() => {
- if (props.type !== "3") return props.image as string;
- else return getFileImg(props.waters![0] && props.waters![0].split('?')[0]).img as string;
- });
- const controlText = computed<DFindParams<DScrollTab, "text">>(
- () => tabList.filter((e) => e.type === props.type)[0].text
- );
- const handleDetail = ($event: DArchiveResultData) => {
- const link =
- import.meta.env.VITE_HTTP_URL +
- (Number($event.type) === 7 ? "/encyclopedia/detail-" : "/info/detail-") +
- $event.id +
- (Number($event.type) === 6 ? "-1.html" : ".html");
- console.log('链接', link)
- if (Number($event.type) > 5) return window.open(link);
- window.location.href = "/database/detail?id=" + $event.id + "&t=" + $event.type
- };
- </script>
- <style scoped lang="scss">
- .share {
- display: flex;
- align-items: center;
- .show {
- margin-left: 24px;
- color: $basicColor;
- font-size: $basicFS;
- }
- .showNum {
- margin-left: 24px;
- background: #f5f5f5;
- padding: 3px 9px;
- border-radius: 2px;
- font-size: $basicFS-foot;
- color: #666;
- }
- }
- </style>
|