|
@@ -1,16 +1,23 @@
|
|
<template>
|
|
<template>
|
|
- <video-preview
|
|
|
|
- v-if="params.type === '2' && fileUrl"
|
|
|
|
|
|
+ <video-preview v-if="params.type === '2' && fileUrl" :url="fileUrl" />
|
|
|
|
+ <pdf-preview
|
|
|
|
+ v-if="params.type === '3' && fileUrl && fileUrl.indexOf('.pdf') !== -1"
|
|
:url="fileUrl"
|
|
:url="fileUrl"
|
|
/>
|
|
/>
|
|
- <pdf-preview v-if="params.type === '3' && fileUrl && fileUrl.indexOf('.pdf')!==-1" :url="fileUrl" />
|
|
|
|
- <docx-preview v-if="params.type === '3' && fileUrl && fileUrl.indexOf('.docx')!==-1" :url="fileUrl" />
|
|
|
|
- <ppt-preview v-if="params.type === '3' && fileUrl && fileUrl.indexOf('.pptx')!==-1" :url="fileUrl" />
|
|
|
|
- <image-preview
|
|
|
|
- v-if="params.type === '1' && form?.waters"
|
|
|
|
- :urls="form?.waters"
|
|
|
|
|
|
+ <docx-preview
|
|
|
|
+ v-if="params.type === '3' && fileUrl && fileUrl.indexOf('.docx') !== -1"
|
|
|
|
+ :url="fileUrl"
|
|
|
|
+ />
|
|
|
|
+ <ppt-preview
|
|
|
|
+ v-if="params.type === '3' && fileUrl && fileUrl.indexOf('.pptx') !== -1"
|
|
|
|
+ :url="fileUrl"
|
|
|
|
+ />
|
|
|
|
+ <image-preview v-if="params.type === '1' && form?.waters" :urls="form?.waters" />
|
|
|
|
+ <text-preview
|
|
|
|
+ v-if="params.type === '4' && form.content"
|
|
|
|
+ :content="form.content"
|
|
|
|
+ :max-height="'100vh'"
|
|
/>
|
|
/>
|
|
- <text-preview v-if="params.type === '4' && form.content" :content="form.content" :max-height="'100vh'"/>
|
|
|
|
<permiNode v-if="!route.query.isSp && permiNode" />
|
|
<permiNode v-if="!route.query.isSp && permiNode" />
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -18,7 +25,15 @@
|
|
import { usePermission } from "@/Hooks/usePermission/usePermission";
|
|
import { usePermission } from "@/Hooks/usePermission/usePermission";
|
|
import { previewData } from "@/api/context/context";
|
|
import { previewData } from "@/api/context/context";
|
|
import useStatisticalTime from "@/Hooks/useStatisticalTime";
|
|
import useStatisticalTime from "@/Hooks/useStatisticalTime";
|
|
-import { computed, onUnmounted, ref, watch, onActivated, ComponentOptions, shallowRef } from "vue";
|
|
|
|
|
|
+import {
|
|
|
|
+ computed,
|
|
|
|
+ onUnmounted,
|
|
|
|
+ ref,
|
|
|
|
+ watch,
|
|
|
|
+ onActivated,
|
|
|
|
+ ComponentOptions,
|
|
|
|
+ shallowRef,
|
|
|
|
+} from "vue";
|
|
import { useRoute } from "vue-router";
|
|
import { useRoute } from "vue-router";
|
|
import { ChangeTabEmit } from "@/types/views/database.type";
|
|
import { ChangeTabEmit } from "@/types/views/database.type";
|
|
import { shareOptions, shareParams } from "@/Hooks/useWeChatShare";
|
|
import { shareOptions, shareParams } from "@/Hooks/useWeChatShare";
|
|
@@ -27,6 +42,8 @@ import { myDecrypt } from "@/util/authStorage";
|
|
import useStopWindowContext from "@/Hooks/useStopWindowContext";
|
|
import useStopWindowContext from "@/Hooks/useStopWindowContext";
|
|
import createWebShareCard from "@/Hooks/useCreateWebShareCard";
|
|
import createWebShareCard from "@/Hooks/useCreateWebShareCard";
|
|
import { showLoadingToast } from "vant";
|
|
import { showLoadingToast } from "vant";
|
|
|
|
+import useWeChatShare from "@/Hooks/useWeChatShare";
|
|
|
|
+import { onMounted } from 'vue';
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
useStopWindowContext();
|
|
useStopWindowContext();
|
|
const form = ref<IPreviewForm>({
|
|
const form = ref<IPreviewForm>({
|
|
@@ -35,10 +52,10 @@ const form = ref<IPreviewForm>({
|
|
productId: "0",
|
|
productId: "0",
|
|
fileArchiveList: [],
|
|
fileArchiveList: [],
|
|
image: "",
|
|
image: "",
|
|
- content: '',
|
|
|
|
- id: ''
|
|
|
|
|
|
+ content: "",
|
|
|
|
+ id: "",
|
|
});
|
|
});
|
|
-const permiNode = shallowRef<ComponentOptions | null>()
|
|
|
|
|
|
+const permiNode = shallowRef<ComponentOptions | null>();
|
|
const fileUrl = ref<string>();
|
|
const fileUrl = ref<string>();
|
|
const params = computed<shareParams & { url: string }>(
|
|
const params = computed<shareParams & { url: string }>(
|
|
() =>
|
|
() =>
|
|
@@ -49,6 +66,7 @@ const params = computed<shareParams & { url: string }>(
|
|
spId: route.query?.spId as string,
|
|
spId: route.query?.spId as string,
|
|
imageUrl: form.value?.image,
|
|
imageUrl: form.value?.image,
|
|
url: route.query?.url as string,
|
|
url: route.query?.url as string,
|
|
|
|
+ suid: route.query?.suid as string,
|
|
} as unknown) as shareParams & { url: string })
|
|
} as unknown) as shareParams & { url: string })
|
|
);
|
|
);
|
|
watch(
|
|
watch(
|
|
@@ -56,9 +74,9 @@ watch(
|
|
(val) => {
|
|
(val) => {
|
|
if (val) {
|
|
if (val) {
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
- console.log('传递的url 链接为:', [route.query?.url])
|
|
|
|
- fileUrl.value = val as string
|
|
|
|
- }, 1000)
|
|
|
|
|
|
+ console.log("传递的url 链接为:", [route.query?.url]);
|
|
|
|
+ fileUrl.value = val as string;
|
|
|
|
+ }, 1000);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -77,8 +95,10 @@ const getPreviewData = async () => {
|
|
} as IPreviewForm;
|
|
} as IPreviewForm;
|
|
form.value = DcreptoList;
|
|
form.value = DcreptoList;
|
|
fileUrl.value = form.value.waters[0]?.split("?")[0];
|
|
fileUrl.value = form.value.waters[0]?.split("?")[0];
|
|
- const { PermiMode } = usePermission(route.query.isSp ? 0 : form.value?.permission! as number)
|
|
|
|
- permiNode.value = PermiMode! as ComponentOptions
|
|
|
|
|
|
+ const { PermiMode } = usePermission(
|
|
|
|
+ route.query.isSp ? 0 : (form.value?.permission! as number)
|
|
|
|
+ );
|
|
|
|
+ permiNode.value = PermiMode! as ComponentOptions;
|
|
};
|
|
};
|
|
const statistical = useStatisticalTime((time) => {
|
|
const statistical = useStatisticalTime((time) => {
|
|
const t = Math.floor(time / 1000);
|
|
const t = Math.floor(time / 1000);
|
|
@@ -86,9 +106,13 @@ const statistical = useStatisticalTime((time) => {
|
|
localStorage.setItem("spentTime", t.toString());
|
|
localStorage.setItem("spentTime", t.toString());
|
|
const f = {
|
|
const f = {
|
|
productArchiveId: params.value.id,
|
|
productArchiveId: params.value.id,
|
|
- headUserId: params.value.spId,
|
|
|
|
|
|
+ headUserId: params.value.suid,
|
|
accessClient: "0",
|
|
accessClient: "0",
|
|
- pagePath: location.href,
|
|
|
|
|
|
+ pagePath: encodeURIComponent(
|
|
|
|
+ `${import.meta.env.VITE_BASE_HTTP}/preview?t=${params.value.type}&id=${
|
|
|
|
+ params.value.id
|
|
|
|
+ }&isSp=1`
|
|
|
|
+ ),
|
|
accessDuration: t * 1000,
|
|
accessDuration: t * 1000,
|
|
pageType: params.value.type === "1" ? "70" : params.value.type === "2" ? "71" : "69",
|
|
pageType: params.value.type === "1" ? "70" : params.value.type === "2" ? "71" : "69",
|
|
pageLabel: "内容库预览",
|
|
pageLabel: "内容库预览",
|
|
@@ -105,7 +129,9 @@ const statistical = useStatisticalTime((time) => {
|
|
f.accessDuration
|
|
f.accessDuration
|
|
}&pageLabel=${f.pageLabel}&behaviorType=${f.behaviorType}&shopId=${
|
|
}&pageLabel=${f.pageLabel}&behaviorType=${f.behaviorType}&shopId=${
|
|
f.shopId
|
|
f.shopId
|
|
- }&pageType=${f.pageType}
|
|
|
|
|
|
+ }&pageType=${f.pageType}&productArchiveId=${f.productArchiveId}&headUserId=${
|
|
|
|
+ f.headUserId
|
|
|
|
+ }
|
|
`,
|
|
`,
|
|
{
|
|
{
|
|
method: "GET",
|
|
method: "GET",
|
|
@@ -122,10 +148,11 @@ const statistical = useStatisticalTime((time) => {
|
|
});
|
|
});
|
|
const initData = () => {
|
|
const initData = () => {
|
|
fileUrl.value = "";
|
|
fileUrl.value = "";
|
|
- !route.query.isSp && showLoadingToast({
|
|
|
|
- message: "加载中...",
|
|
|
|
- forbidClick: true,
|
|
|
|
- });
|
|
|
|
|
|
+ !route.query.isSp &&
|
|
|
|
+ showLoadingToast({
|
|
|
|
+ message: "加载中...",
|
|
|
|
+ forbidClick: true,
|
|
|
|
+ });
|
|
const obj = shareOptions.filter((e) => e.type === params.value.type)[0];
|
|
const obj = shareOptions.filter((e) => e.type === params.value.type)[0];
|
|
if (!params.value.url) {
|
|
if (!params.value.url) {
|
|
getPreviewData();
|
|
getPreviewData();
|
|
@@ -143,6 +170,16 @@ onUnmounted(() => {
|
|
onActivated(() => {
|
|
onActivated(() => {
|
|
initData();
|
|
initData();
|
|
});
|
|
});
|
|
|
|
+onMounted(() => {
|
|
|
|
+ useWeChatShare({
|
|
|
|
+ type: params.value.type,
|
|
|
|
+ id: params.value.id!,
|
|
|
|
+ imageUrl: '',
|
|
|
|
+ spId: params.value.spId,
|
|
|
|
+ isShowToast: false,
|
|
|
|
+ suid: params.value.suid,
|
|
|
|
+ });
|
|
|
|
+})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|