xiebaomin 1 year ago
parent
commit
40259d4ed5

+ 1 - 3
src/Hooks/usePermission/permiMode.tsx

@@ -48,9 +48,7 @@ const MyComponent = (prop: IPermiObj | Boolean): ComponentOptions =>
 			`
 			`
 			const route = useRoute()
 			const route = useRoute()
 			const handleClick = () => {
 			const handleClick = () => {
-				//window.localStorage.setItem('permission', '0')
-				//window.open(import.meta.env.VITE_HTTP_URL + obj.redirect + '?t=' + route.query.t + '&isDataBase=' + 1 + '&spId=')
-				window.location.href = 'http://localhost:8009/login.html' + '?t=' + route.query.t + '&isDataBase=' + 1 + '&spId='
+				window.location.href = import.meta.env.VITE_HTTP_URL + obj.redirect + '?t=' + route.query.t + '&isDataBase=' + 1 + '&spId=' + route.query.spId
 			}
 			}
 			const pageLocation = ref<number>(0)
 			const pageLocation = ref<number>(0)
 			const stop = () => {
 			const stop = () => {

+ 1 - 1
src/Hooks/usePermission/usePermission.ts

@@ -7,7 +7,7 @@ const permissionText: IPermi = [
 	{text: '登录后查看完整内容', btnText: '登录', redirect: '/login.html' },
 	{text: '登录后查看完整内容', btnText: '登录', redirect: '/login.html' },
 	{text: '请升级成为会员机构后方可查看!', btnText: '升级会员', redirect: '/user/setting/upgrade.html' },
 	{text: '请升级成为会员机构后方可查看!', btnText: '升级会员', redirect: '/user/setting/upgrade.html' },
 	{text: '医美资质机构可查看完整内容', btnText: '升级医美资质', redirect: '/user/setting/upgrade.html' },
 	{text: '医美资质机构可查看完整内容', btnText: '升级医美资质', redirect: '/user/setting/upgrade.html' },
-	{text: '需抵扣100采美豆方可查看!', btnText: '去查看', redirect: '' },
+	{text: '需抵扣100采美豆方可查看!', btnText: '去查看', redirect: '/login.html' },
 	{text: '登录后查看完整内容', btnText: '登录', redirect: '/login.html' }
 	{text: '登录后查看完整内容', btnText: '登录', redirect: '/login.html' }
 ]
 ]
 
 

+ 47 - 10
src/Hooks/useStatisticalTime.ts

@@ -26,21 +26,58 @@ const useStatisticalTime = (callback: (timing: number) => void) => {
 		}
 		}
 	}
 	}
 
 
+	const isAndroid = () => /Android/i.test(navigator.userAgent) //android终端
+	const isIOS = () => /iPhone|iPad|iPod/i.test(navigator.userAgent) //ios终端
+
 	onMounted(() => {
 	onMounted(() => {
 		startTiming()
 		startTiming()
-		window.addEventListener('pagehide', () => {
-			console.log('页面关闭')
-			endTiming()
-		}, false)
+		console.log('页面进入初始化')
+		if (isAndroid()) {
+			window.addEventListener("visibilitychange", () => {
+				let p = document.visibilityState
+				console.log('visibilityState', p)
+				if (p === 'hidden') {
+					//let e = Number(window.localStorage.getItem('visibility'));
+					//e += 1
+					//window.localStorage.setItem('visibility', e.toString())
+					endTiming()
+				}
+				console.log('页面关闭')
+			})
+			window.addEventListener("beforeunload", () => {
+				//let e = Number(window.localStorage.getItem('onbeforeLoad'));
+				//e += 1
+				//localStorage.setItem('onbeforeLoad', e.toString())
+				console.log('页面关闭')
+				endTiming()
+			})
+		} else if (isIOS()) {
+			window.addEventListener('pagehide', () => {
+				endTiming()
+			}, false)
+		} else {
+			window.addEventListener("visibilitychange", () => {
+				let p = document.visibilityState
+				console.log('visibilityState', p)
+				if (p === 'hidden') {
+					//let e = Number(window.localStorage.getItem('visibility'));
+					//e += 1
+					//window.localStorage.setItem('visibility', e.toString())
+					endTiming()
+				}
+				console.log('页面关闭')
+			})
+		}
 	})
 	})
-	
+
 
 
 	return () => {
 	return () => {
-		window.removeEventListener('pagehide', () => {
-			console.log('页面关闭')
-			endTiming()
-		})
-		localStorage.removeItem('timing')
+		//window.removeEventListener('pagehide', () => {
+		//	console.log('页面关闭')
+		//	endTiming()
+		//})
+		//window
+		//localStorage.removeItem('timing')
 	}
 	}
 }
 }
 
 

+ 40 - 25
src/Hooks/useWeChatShare.ts

@@ -1,11 +1,11 @@
-import { getShareConfig } from '@/api/context/context';
-import { DFindParams, DScrollTab, ChangeTabEmit } from '@/types/views/database.type';
+import { getShareConfig } from '@/api/context/context'
+import { DFindParams, DScrollTab, ChangeTabEmit } from '@/types/views/database.type'
 import wx from 'weixin-js-sdk'
 import wx from 'weixin-js-sdk'
-import { IShareConfig } from '../types/api/context.type';
-import { showToast } from 'vant';
+import { IShareConfig } from '../types/api/context.type'
+import { showToast } from 'vant'
 
 
 type shareOptions = {
 type shareOptions = {
-	type: ChangeTabEmit,
+	type: ChangeTabEmit
 	imageUrl: string
 	imageUrl: string
 	text: `您的好友给你分享了${DFindParams<DScrollTab, 'text'>}链接`
 	text: `您的好友给你分享了${DFindParams<DScrollTab, 'text'>}链接`
 }
 }
@@ -17,50 +17,60 @@ const config: {
 	appId: 'wx91c4152b60ca91a3', // 微信公众号appId
 	appId: 'wx91c4152b60ca91a3', // 微信公众号appId
 	jsApiList: ['updateAppMessageShareData', 'onMenuShareAppMessage', 'updateTimelineShareData', 'onMenuShareTimeline'], // 微信配置可用权限
 	jsApiList: ['updateAppMessageShareData', 'onMenuShareAppMessage', 'updateTimelineShareData', 'onMenuShareTimeline'], // 微信配置可用权限
 }
 }
-export type shareParams = { type: ChangeTabEmit | string, id: string, spId?: number, userId?: number, suid?: number, link?: string }
+export type shareParams = {
+	type: ChangeTabEmit | string
+	id: string
+	spId?: number
+	userId?: number
+	suid?: number
+	link?: string
+	imageUrl?: string
+	isShowToast?: boolean
+}
 const shareOptions: shareOptions[] = [
 const shareOptions: shareOptions[] = [
 	{
 	{
 		type: '1',
 		type: '1',
 		imageUrl: '',
 		imageUrl: '',
-		text: '您的好友给你分享了图片链接'
+		text: '您的好友给你分享了图片链接',
 	},
 	},
 	{
 	{
 		type: '2',
 		type: '2',
 		imageUrl: '',
 		imageUrl: '',
-		text: '您的好友给你分享了视频链接'
+		text: '您的好友给你分享了视频链接',
 	},
 	},
 	{
 	{
 		type: '3',
 		type: '3',
 		imageUrl: '',
 		imageUrl: '',
-		text: '您的好友给你分享了文件链接'
+		text: '您的好友给你分享了文件链接',
 	},
 	},
 	{
 	{
 		type: '5',
 		type: '5',
 		imageUrl: '',
 		imageUrl: '',
-		text: '您的好友给你分享了文本链接'
+		text: '您的好友给你分享了文本链接',
 	},
 	},
 	{
 	{
 		type: '6',
 		type: '6',
 		imageUrl: '',
 		imageUrl: '',
-		text: '您的好友给你分享了文章链接'
+		text: '您的好友给你分享了文章链接',
 	},
 	},
 	{
 	{
 		type: '7',
 		type: '7',
 		imageUrl: '',
 		imageUrl: '',
-		text: '您的好友给你分享了百科链接'
-	}
+		text: '您的好友给你分享了百科链接',
+	},
 ]
 ]
 
 
 const useWeChatShare = async (params: shareParams) => {
 const useWeChatShare = async (params: shareParams) => {
 	const isWeChat = () => /MicroMessenger/i.test(navigator.userAgent)
 	const isWeChat = () => /MicroMessenger/i.test(navigator.userAgent)
 	const linkParams =
 	const linkParams =
-		import.meta.env.VITE_HTTP_URL + (Number(params.type) === 7
-			? "/encyclopedia/detail-"
-			: "/info/detail-") + params.id + ".html";
-	if (!isWeChat()) return showToast('请在微信浏览器中分享')
+		import.meta.env.VITE_HTTP_URL +
+		(Number(params.type) === 7 ? '/encyclopedia/detail-' : '/info/detail-') +
+		params.id +
+		'.html'
+	if (!isWeChat()) return params.isShowToast && showToast('请在微信浏览器中分享')
 	const { data } = await getShareConfig({
 	const { data } = await getShareConfig({
 		appId: 'wx91c4152b60ca91a3',
 		appId: 'wx91c4152b60ca91a3',
-		url: location.href
+		url: location.href,
 	})
 	})
 	console.log(data)
 	console.log(data)
 	wx.config({
 	wx.config({
@@ -69,15 +79,20 @@ const useWeChatShare = async (params: shareParams) => {
 		nonceStr: data?.noncestr!,
 		nonceStr: data?.noncestr!,
 		timestamp: data?.timestamp!,
 		timestamp: data?.timestamp!,
 		signature: data?.signature!,
 		signature: data?.signature!,
-		jsApiList: config.jsApiList
+		jsApiList: config.jsApiList,
 	})
 	})
-	const obj = shareOptions.filter(e => e.type === params.type)[0] || {}
-	const link = Number(params.type) < 5 ? import.meta.env.VITE_BASE_HTTP + `/preview?t=${params.type}&id=${params.id}&uid=${params.userId || ''}&suid=${params.suid || ''}&spId=${params.spId || ''}` : linkParams
+	const obj = shareOptions.filter((e) => e.type === params.type)[0] || {}
+	const link =
+		Number(params.type) < 5
+			? import.meta.env.VITE_BASE_HTTP +
+			`/preview?t=${params.type}&id=${params.id}&uid=${params.userId || ''}&suid=${params.suid || ''}&spId=${params.spId || ''
+			}`
+			: linkParams
 	const shareConfig: wx.IonMenuShareAppMessage = {
 	const shareConfig: wx.IonMenuShareAppMessage = {
 		title: obj.text,
 		title: obj.text,
 		desc: obj.text,
 		desc: obj.text,
 		link,
 		link,
-		imgUrl: obj.imageUrl || '',
+		imgUrl: params.imageUrl || '',
 		success: () => {
 		success: () => {
 			console.log(obj, '成功')
 			console.log(obj, '成功')
 		},
 		},
@@ -86,9 +101,9 @@ const useWeChatShare = async (params: shareParams) => {
 		},
 		},
 		cancel: () => {
 		cancel: () => {
 			console.log('取消了')
 			console.log('取消了')
-		}
+		},
 	}
 	}
-	showToast('请点击右上角...进行分享')
+	params.isShowToast && showToast('请点击右上角...进行分享')
 	wx.ready(() => {
 	wx.ready(() => {
 		wx.onMenuShareAppMessage(shareConfig)
 		wx.onMenuShareAppMessage(shareConfig)
 		wx.onMenuShareTimeline(shareConfig)
 		wx.onMenuShareTimeline(shareConfig)
@@ -98,4 +113,4 @@ const useWeChatShare = async (params: shareParams) => {
 	})
 	})
 }
 }
 
 
-export default useWeChatShare
+export default useWeChatShare

+ 1 - 1
src/api/context/context.ts

@@ -31,7 +31,7 @@ export const getArchiveFormDetails = (data: IArchiveForm) =>
 export const getShareConfig = (data: IShareConfig) =>
 export const getShareConfig = (data: IShareConfig) =>
 	requestGET<ContextRequest, DShareConfigResultData>('https://zplma.caimei365.com/wx/sdk/config/data', data)
 	requestGET<ContextRequest, DShareConfigResultData>('https://zplma.caimei365.com/wx/sdk/config/data', data)
 
 
-export const setStatistics = (data: IStatistics) => 
+export const setStatistics = (data: IStatistics) =>
 	requestGET<ContextRequest, { data: string }>('/user/record/Statistics', data)
 	requestGET<ContextRequest, { data: string }>('/user/record/Statistics', data)
 
 
 export const addAllStatusForm = (data: DForm) =>
 export const addAllStatusForm = (data: DForm) =>

+ 1 - 1
src/components/index.ts

@@ -4,7 +4,7 @@ export default {
 	install (app: App) {
 	install (app: App) {
 		const files = import.meta.glob('@/components/**/*.vue');
 		const files = import.meta.glob('@/components/**/*.vue');
 		for (const [key, value] of Object.entries(files)) {
 		for (const [key, value] of Object.entries(files)) {
-			const componentName = key.slice(key.lastIndexOf('/') + 1, key.lastIndexOf('.')).split('-').map(e => e.toLowerCase().replace(/( |^)[a-z]/g, (L: string) => L.toUpperCase())).join('');
+			const componentName = key.slice(key.lastIndexOf('/') + 1, key.lastIndexOf('.'))?.split('-').map(e => e.toLowerCase().replace(/( |^)[a-z]/g, (L: string) => L.toUpperCase())).join('');
 			if (componentName && value) {
 			if (componentName && value) {
 				app.component(componentName, defineAsyncComponent(value as AsyncComponentLoader))
 				app.component(componentName, defineAsyncComponent(value as AsyncComponentLoader))
 			}
 			}

+ 0 - 3
src/components/video-preview/video-preview.vue

@@ -5,7 +5,6 @@
       ref="myVideoRef"
       ref="myVideoRef"
       class="video-js vjs-default-skin"
       class="video-js vjs-default-skin"
       controls
       controls
-      autoplay
       :style="{ width: resultVideo.width, height: resultVideo.height }"
       :style="{ width: resultVideo.width, height: resultVideo.height }"
       x5-video-player-fullscreen="true"
       x5-video-player-fullscreen="true"
       x5-video-player-type="h5"
       x5-video-player-type="h5"
@@ -39,8 +38,6 @@ const resultVideo = reactive<IVideoOptions>({
 const handleTimeUpdate = () => {
 const handleTimeUpdate = () => {
   resultVideo.allTime = myVideoRef.value!.duration
   resultVideo.allTime = myVideoRef.value!.duration
   resultVideo.currentTime = myVideoRef.value!.currentTime
   resultVideo.currentTime = myVideoRef.value!.currentTime
-  console.log(myVideoRef.value!.duration)
-  console.log(myVideoRef.value!.currentTime)
 }
 }
 
 
 onMounted(async () => {
 onMounted(async () => {

+ 1 - 1
src/types/api/user.type.ts

@@ -2,7 +2,7 @@ export type ILogin = {
 	mobileOrEmail: string;
 	mobileOrEmail: string;
 	password: string;
 	password: string;
 	isUnion: 1,
 	isUnion: 1,
-	unionId: string
+	unionId?: string
 }
 }
 
 
 export type IUserInfo = {
 export type IUserInfo = {

+ 3 - 1
src/views/Database/components/context-contain.vue

@@ -14,6 +14,7 @@
         :waters="d.waters"
         :waters="d.waters"
         :content="d.content"
         :content="d.content"
         :image="d.image"
         :image="d.image"
+        @click="d.type === '5' && router.push('/database/detail?id=' + d.id + '&t=' + d.type)"
       />
       />
     </div>
     </div>
     <div v-if="props.dataList.length === 0" class="empty">暂无任何文件~</div>
     <div v-if="props.dataList.length === 0" class="empty">暂无任何文件~</div>
@@ -33,7 +34,8 @@
 import { DDataBaseListAll, DEmit } from "@/types/views/database.type";
 import { DDataBaseListAll, DEmit } from "@/types/views/database.type";
 import FileContent from "./file-content.vue";
 import FileContent from "./file-content.vue";
 import { ref, computed } from 'vue';
 import { ref, computed } from 'vue';
-
+import { useRouter } from 'vue-router'
+const router = useRouter()
 const pageNum = ref<number>(1);
 const pageNum = ref<number>(1);
 const emit = defineEmits<DEmit>();
 const emit = defineEmits<DEmit>();
 
 

+ 2 - 8
src/views/Database/components/context-head.vue

@@ -23,21 +23,15 @@ import {
   tabList,
   tabList,
   allStatusList,
   allStatusList,
 } from "@/types/views/database.type";
 } from "@/types/views/database.type";
-import { ref, computed, toRefs, watch } from "vue";
-import { useTabStore } from "@/store/tab/tab";
+import { ref, computed, watch } from "vue";
 import { DTabStore } from "@/store/tab/tab.type";
 import { DTabStore } from "@/store/tab/tab.type";
 import { useRoute } from "vue-router";
 import { useRoute } from "vue-router";
-const { productId, labelIds, stageStatus, searchValue } = toRefs(useTabStore());
 const route = useRoute();
 const route = useRoute();
 const props = defineProps<{
 const props = defineProps<{
   type: ChangeTabEmit;
   type: ChangeTabEmit;
 }>();
 }>();
-const form = ref<DTabStore>({
-  labelIds: labelIds.value,
-  productId: productId.value,
-  stageStatus: stageStatus.value,
+const form = ref<Pick<DTabStore, 'type'> & Pick<DTabStore, 'allStatus'>>({
   type: route.query.t as ChangeTabEmit,
   type: route.query.t as ChangeTabEmit,
-  searchValue: searchValue.value,
   allStatus: "1",
   allStatus: "1",
 });
 });
 const emit = defineEmits<DEmit>();
 const emit = defineEmits<DEmit>();

+ 18 - 4
src/views/Database/components/context-share.vue

@@ -7,7 +7,15 @@
     <div class="show" @click.stop="handleDetail(props)">查看{{ controlText }}</div>
     <div class="show" @click.stop="handleDetail(props)">查看{{ controlText }}</div>
     <div
     <div
       class="show"
       class="show"
-      @click.stop="useWeChatShare({ type: props.type!, id: props.id!, spId: serviceProviderId as number })"
+      @click.stop="
+    useWeChatShare({
+     type: props.type!,
+     id: props.id!,
+     spId: serviceProviderId as number,
+     imageUrl: imageLink,
+     isShowToast: true,
+    })
+   "
     >
     >
       分享
       分享
     </div>
     </div>
@@ -22,19 +30,25 @@ import { useRouter } from "vue-router";
 import useCopyText from "@/Hooks/useCopyText";
 import useCopyText from "@/Hooks/useCopyText";
 import useWeChatShare from "@/Hooks/useWeChatShare";
 import useWeChatShare from "@/Hooks/useWeChatShare";
 import { useUserInfoState } from "@/store/user/user";
 import { useUserInfoState } from "@/store/user/user";
+import getFileImg from "@/Hooks/useFileImage";
 
 
 const props = defineProps<DArchiveResultData>();
 const props = defineProps<DArchiveResultData>();
 const { serviceProviderId } = useUserInfoState();
 const { serviceProviderId } = useUserInfoState();
 const router = useRouter();
 const router = useRouter();
 
 
+const imageLink = computed<string>(() => {
+  if (props.type !== "1") return props.image as string;
+  else return getFileImg(props.waters![0]).img as string;
+});
 const controlText = computed<DFindParams<DScrollTab, "text">>(
 const controlText = computed<DFindParams<DScrollTab, "text">>(
   () => tabList.filter((e) => e.type === props.type)[0].text
   () => tabList.filter((e) => e.type === props.type)[0].text
 );
 );
 const handleDetail = ($event: DArchiveResultData) => {
 const handleDetail = ($event: DArchiveResultData) => {
   const link =
   const link =
-    import.meta.env.VITE_HTTP_URL + (Number($event.type) === 7
-      ? "/encyclopedia/detail-"
-      : "/info/detail-") + $event.id + ".html";
+    import.meta.env.VITE_HTTP_URL +
+    (Number($event.type) === 7 ? "/encyclopedia/detail-" : "/info/detail-") +
+    $event.id +
+    ".html";
   if (Number($event.type) > 5) return window.open(link);
   if (Number($event.type) > 5) return window.open(link);
   router.push("/database/detail?id=" + $event.id + "&t=" + $event.type);
   router.push("/database/detail?id=" + $event.id + "&t=" + $event.type);
   console.log($event.type);
   console.log($event.type);

+ 53 - 37
src/views/Database/data-all/index.vue

@@ -8,13 +8,20 @@
       @handle-see-more="handleSeeMore"
       @handle-see-more="handleSeeMore"
     >
     >
       <template #head="{ data }">
       <template #head="{ data }">
-        <context-head :type="data.type"/>
+        <context-head :type="data.type" @handle-all-status="handleAllStatus" />
       </template>
       </template>
       <template #share="{ data }">
       <template #share="{ data }">
-        <context-share :type="data.type!" :id="data.id" :content="data.content" />
+        <context-share
+          :type="data.type!"
+          :id="data.id"
+          :content="data.content"
+          :all-status="data.allStatus"
+          :image="data.image"
+          :waters="data.waters"
+        />
       </template>
       </template>
     </context-contain>
     </context-contain>
-    <context-contain
+    <!--<context-contain
       :type="data.type"
       :type="data.type"
       :data-list="data.dataList"
       :data-list="data.dataList"
       :show-more="showSeeMore"
       :show-more="showSeeMore"
@@ -25,9 +32,9 @@
         <context-head :type="data.type" @handle-all-status="handleAllStatus" />
         <context-head :type="data.type" @handle-all-status="handleAllStatus" />
       </template>
       </template>
       <template #share="{ data }">
       <template #share="{ data }">
-        <context-share :type="data.type!" :id="data.id" :content="data.content" :all-status="data.allStatus" />
+        <context-share v-if="isShowType && data.type === '5'" :type="data.type!" :id="data.id" :content="data.content" :all-status="data.allStatus" />
       </template>
       </template>
-    </context-contain>
+    </context-contain>-->
   </div>
   </div>
   <div v-if="isEmpty && route.query.t !== '5'" class="empty">暂无任何文件~</div>
   <div v-if="isEmpty && route.query.t !== '5'" class="empty">暂无任何文件~</div>
   <div class="bottom-btn" v-if="reqParams.type === '5' && isAddStatus">
   <div class="bottom-btn" v-if="reqParams.type === '5' && isAddStatus">
@@ -41,7 +48,7 @@
 </template>
 </template>
 
 
 <script setup lang="ts">
 <script setup lang="ts">
-import { computed, ref, watch } from 'vue';
+import { computed, ref, watch } from "vue";
 import contextContain from "../components/context-contain.vue";
 import contextContain from "../components/context-contain.vue";
 import { DDataBaseListAll, DetailParams, tabList } from "@/types/views/database.type";
 import { DDataBaseListAll, DetailParams, tabList } from "@/types/views/database.type";
 import contextHead from "../components/context-head.vue";
 import contextHead from "../components/context-head.vue";
@@ -50,33 +57,38 @@ import { useRouter, useRoute, LocationQueryValue } from "vue-router";
 import { getArchiveList } from "@/api/context/context";
 import { getArchiveList } from "@/api/context/context";
 import { IArchiveRequest } from "@/types/api/context.type";
 import { IArchiveRequest } from "@/types/api/context.type";
 import { useUserInfoState } from "@/store/user/user";
 import { useUserInfoState } from "@/store/user/user";
-import { myDecrypt } from '@/util/authStorage';
+import { myDecrypt } from "@/util/authStorage";
+
 const { userId } = useUserInfoState();
 const { userId } = useUserInfoState();
 const router = useRouter();
 const router = useRouter();
 const route = useRoute();
 const route = useRoute();
 const dataList = ref<DDataBaseListAll[] | null>(null);
 const dataList = ref<DDataBaseListAll[] | null>(null);
-const routeQuery = (str: LocationQueryValue | LocationQueryValue[]) => str === '0' ? '' : str
-const reqParams = computed<IArchiveRequest>(() => ({
-  type: routeQuery(route.query.t),
-  title: route.query.sv,
-  productId: routeQuery(route.query.pId),
-  labelIds: route.query.lId,
-  stageStatus: routeQuery(route.query.ss),
-  spId: '',
-  userId: userId,
-}) as IArchiveRequest);
+const routeQuery = (str: LocationQueryValue | LocationQueryValue[]) =>
+  str === "0" ? "" : str;
+const reqParams = computed<IArchiveRequest>(
+  () =>
+    ({
+      type: routeQuery(route.query.t),
+      title: route.query.sv,
+      productId: routeQuery(route.query.pId),
+      labelIds: route.query.lId,
+      stageStatus: routeQuery(route.query.ss),
+      spId: "",
+      userId: userId,
+    } as IArchiveRequest)
+);
 const isAddStatus = ref<boolean>(false);
 const isAddStatus = ref<boolean>(false);
 const isEmpty = ref<boolean>(false);
 const isEmpty = ref<boolean>(false);
 const isShowType = ref<boolean>(false);
 const isShowType = ref<boolean>(false);
 const showSeeMore = ref<boolean>(true);
 const showSeeMore = ref<boolean>(true);
-const formParams = ref({ allStatus: '1' })
+const formParams = ref({ allStatus: "1" });
 const reqArchiveList = async (res?: DetailParams) => {
 const reqArchiveList = async (res?: DetailParams) => {
   if (!res) {
   if (!res) {
     const { data } = await getArchiveList({ ...reqParams.value, ...formParams.value });
     const { data } = await getArchiveList({ ...reqParams.value, ...formParams.value });
-    const DcreptoList = data?.map(e => ({
+    const DcreptoList = data?.map((e) => ({
       ...e,
       ...e,
-      waters: myDecrypt(e.waters! as string[])
-    }))
+      waters: myDecrypt(e.waters! as string[]),
+    }));
     dataList.value = tabList.map((e) => ({
     dataList.value = tabList.map((e) => ({
       type: e.type,
       type: e.type,
       dataList: DcreptoList!.filter((i) => i.type === e.type),
       dataList: DcreptoList!.filter((i) => i.type === e.type),
@@ -84,10 +96,10 @@ const reqArchiveList = async (res?: DetailParams) => {
     isEmpty.value = data?.length === 0;
     isEmpty.value = data?.length === 0;
   } else {
   } else {
     const { data } = await getArchiveList({ ...reqParams.value, ...res! });
     const { data } = await getArchiveList({ ...reqParams.value, ...res! });
-    const DcreptoList = data?.map(e => ({
+    const DcreptoList = data?.map((e) => ({
       ...e,
       ...e,
-      waters: myDecrypt(e.waters! as string[])
-    }))
+      waters: myDecrypt(e.waters! as string[]),
+    }));
     if (res.allStatus || res.pageNum === 1) {
     if (res.allStatus || res.pageNum === 1) {
       dataList.value![res.type]!.dataList = [];
       dataList.value![res.type]!.dataList = [];
     }
     }
@@ -95,27 +107,31 @@ const reqArchiveList = async (res?: DetailParams) => {
       ...dataList.value![res.type]!.dataList,
       ...dataList.value![res.type]!.dataList,
       ...DcreptoList!,
       ...DcreptoList!,
     ];
     ];
-    isEmpty.value = dataList.value![res.type]!.dataList.length === 0 && reqParams.value.type !== '';
+    isEmpty.value =
+      dataList.value![res.type]!.dataList.length === 0 && reqParams.value.type !== "";
     showSeeMore.value = data?.length! < 5;
     showSeeMore.value = data?.length! < 5;
   }
   }
 };
 };
-watch(() => route.query, (val) => {
-  console.log('路由变化', val)
-  isShowType.value = route.query.t === '0' || route.query.t === '5'
-  formParams.value.allStatus = '1'
-  reqArchiveList()
-},
-{
-  immediate: true,
-});
+watch(
+  () => route.query,
+  (val) => {
+    console.log("路由变化", val);
+    isShowType.value = route.query.t === "0" || route.query.t === "5";
+    formParams.value.allStatus = "1";
+    reqArchiveList();
+  },
+  {
+    immediate: true,
+  }
+);
 
 
 const handleSeeMore = ($event: DetailParams) => {
 const handleSeeMore = ($event: DetailParams) => {
-  console.log('查看更多')
+  console.log("查看更多");
   reqArchiveList($event);
   reqArchiveList($event);
 };
 };
 const handleAllStatus = ($event: DetailParams) => {
 const handleAllStatus = ($event: DetailParams) => {
-  console.log('改变成企业', $event)
-  formParams.value.allStatus = $event.allStatus!
+  console.log("改变成企业", $event);
+  formParams.value.allStatus = $event.allStatus!;
   reqArchiveList($event);
   reqArchiveList($event);
   isAddStatus.value = $event.allStatus === "2";
   isAddStatus.value = $event.allStatus === "2";
 };
 };

+ 6 - 3
src/views/Database/detail.vue

@@ -58,7 +58,7 @@
         v-if="type === '5'"
         v-if="type === '5'"
       />
       />
       <data-button
       <data-button
-        @handle-emit="useWeChatShare({ type: form?.type!, id: form?.id! })"
+        @handle-emit="useWeChatShare({ type: form?.type!, id: form?.id!, imageUrl: imageLink, spId: serviceProviderId as number, isShowToast: true })"
         backgroundColor="#FFF"
         backgroundColor="#FFF"
         color="#FF5B00"
         color="#FF5B00"
         label="分享"
         label="分享"
@@ -82,14 +82,17 @@ import { useUserInfoState } from "@/store/user/user";
 import { myDecrypt } from "@/util/authStorage";
 import { myDecrypt } from "@/util/authStorage";
 const route = useRoute();
 const route = useRoute();
 const router = useRouter();
 const router = useRouter();
-const { userId } = useUserInfoState();
+const { userId, serviceProviderId } = useUserInfoState();
 const form = ref<DArchiveResultData>();
 const form = ref<DArchiveResultData>();
 const id = computed<string>(() => String(route.query.id));
 const id = computed<string>(() => String(route.query.id));
 const type = computed<ChangeTabEmit>(() => route.query.t as ChangeTabEmit);
 const type = computed<ChangeTabEmit>(() => route.query.t as ChangeTabEmit);
 const handleClick = () => {
 const handleClick = () => {
   router.push("/preview?t=" + type.value + "&id=" + id.value + "&isSp=" + 1);
   router.push("/preview?t=" + type.value + "&id=" + id.value + "&isSp=" + 1);
 };
 };
-
+const imageLink = computed<string>(() => {
+  if (form.value!.type !== '1') return form.value!.image as string
+  else return getFileImg(form.value!.waters![0]).img as string
+})
 const getArchiveForm = async () => {
 const getArchiveForm = async () => {
   const { data } = await getArchiveFormDetails({
   const { data } = await getArchiveFormDetails({
     id: id.value,
     id: id.value,

+ 1 - 1
src/views/Login/index.vue

@@ -39,7 +39,7 @@ const form = ref<ILogin>({
   mobileOrEmail: "",
   mobileOrEmail: "",
   password: "",
   password: "",
   isUnion: 1,
   isUnion: 1,
-  unionId: 'ox_1SwSaz62JsEppFjhlecqhENdQ'
+  //unionId: 'ox_1SwSaz62JsEppFjhlecqhENdQ'
 });
 });
 
 
 const disabled = computed<boolean>(() => (!form.value.mobileOrEmail || !form.value.password))
 const disabled = computed<boolean>(() => (!form.value.mobileOrEmail || !form.value.password))

+ 61 - 21
src/views/Preview/index.vue

@@ -3,6 +3,11 @@
   <pdf-preview v-if="params.type === '3' && fileUrl" :url="fileUrl" :is-permi="isPermi"/>
   <pdf-preview v-if="params.type === '3' && fileUrl" :url="fileUrl" :is-permi="isPermi"/>
   <image-preview v-if="params.type === '1' && form?.waters" :urls="form?.waters" :is-permi="isPermi"/>
   <image-preview v-if="params.type === '1' && form?.waters" :urls="form?.waters" :is-permi="isPermi"/>
   <permi-mode v-if="!query.isSp" />
   <permi-mode v-if="!query.isSp" />
+  <!--<div class="hidden">
+    <div>pageHide: {{ pageHide }}</div>
+    <div>visibility: {{ visibility }}</div>
+    <div>onbeforeLoad: {{ onbeforeLoad }}</div>
+  </div>-->
 </template>
 </template>
 
 
 <script lang="ts" setup>
 <script lang="ts" setup>
@@ -15,21 +20,41 @@ import { ChangeTabEmit } from "@/types/views/database.type";
 import useWeChatShare, { shareParams } from "@/Hooks/useWeChatShare";
 import useWeChatShare, { shareParams } from "@/Hooks/useWeChatShare";
 import { IPreviewForm } from "@/types/api/context.type";
 import { IPreviewForm } from "@/types/api/context.type";
 import { myDecrypt } from "@/util/authStorage";
 import { myDecrypt } from "@/util/authStorage";
-const { query } = useRoute()
+const { query } = useRoute();
 
 
-const form = ref<IPreviewForm>();
+const form = ref<IPreviewForm>({
+  waters: [],
+  permission: 0,
+  productId: "0",
+  fileArchiveList: [],
+});
 
 
-const fileUrl = ref<string>()
+//if (!window.localStorage.getItem("pageHide")) {
+//  window.localStorage.setItem("pageHide", "2");
+//}
+//if (!window.localStorage.getItem("visibility")) {
+//  window.localStorage.setItem("visibility", "2");
+//}
+//if (!window.localStorage.getItem("onbeforeLoad")) {
+//  window.localStorage.setItem("onbeforeLoad", "2");
+//}
+//const pageHide = window.localStorage.getItem("pageHide");
+//const visibility = window.localStorage.getItem("visibility");
+//const onbeforeLoad = window.localStorage.getItem("onbeforeLoad");
 
 
+const fileUrl = ref<string>();
 const getPreviewData = async () => {
 const getPreviewData = async () => {
   const { data } = await previewData({
   const { data } = await previewData({
     userId: (query.uid as string) || "0",
     userId: (query.uid as string) || "0",
     id: query.id as string,
     id: query.id as string,
     type: query.t as ChangeTabEmit,
     type: query.t as ChangeTabEmit,
   });
   });
-  const DcreptoList = { ...data, ...{ waters: myDecrypt(data?.waters as string[]) } } as IPreviewForm
-  form.value = DcreptoList
-  fileUrl.value = form.value.waters[0].split('?')[0]
+  const DcreptoList = {
+    ...data,
+    ...{ waters: myDecrypt(data?.waters as string[]) },
+  } as IPreviewForm;
+  form.value = DcreptoList;
+  fileUrl.value = form.value.waters[0]?.split("?")[0];
   console.log(form.value.waters);
   console.log(form.value.waters);
 };
 };
 const { isPermi, PermiMode } = usePermission(form.value?.permission! as number); // 权限hook
 const { isPermi, PermiMode } = usePermission(form.value?.permission! as number); // 权限hook
@@ -39,12 +64,6 @@ const params = computed(() => ({
   id: query.id as string,
   id: query.id as string,
   spId: query.spId as string,
   spId: query.spId as string,
 }));
 }));
-
-onMounted(() => {
-  getPreviewData();
-  useWeChatShare(params.value! as unknown as shareParams);
-});
-
 const statistical = useStatisticalTime((time) => {
 const statistical = useStatisticalTime((time) => {
   const t = Math.floor(time / 1000);
   const t = Math.floor(time / 1000);
   console.log("时长为:", t, Math.floor(time / 1000));
   console.log("时长为:", t, Math.floor(time / 1000));
@@ -63,24 +82,45 @@ const statistical = useStatisticalTime((time) => {
     behaviorType: "1",
     behaviorType: "1",
   };
   };
   fetch(
   fetch(
-    `https://core-b.caimei365.com/user/record/Statistics?accessClient=${f.accessClient}&userId=${f.userId}&pagePath=${f.pagePath}&productId=${f.productId}&accessDuration=${f.accessDuration}&pageLabel=${f.pageLabel}&behaviorType=${f.behaviorType}&shopId=${f.shopId}`,
+    `
+    ${import.meta.env.VITE_BASE_URL}/user/record/Statistics?accessClient=${
+      f.accessClient
+    }&userId=${f.userId}&pagePath=${f.pagePath}&productId=${f.productId}&accessDuration=${
+      f.accessDuration
+    }&pageLabel=${f.pageLabel}&behaviorType=${f.behaviorType}&shopId=${
+      f.shopId
+    }&pageType=${f.pageType}
+    `,
     {
     {
       method: "GET",
       method: "GET",
       headers: {
       headers: {
-        "Content-Type": "application/x-www-form-urlencoded"
+        "Content-Type": "application/x-www-form-urlencoded",
       },
       },
       keepalive: true,
       keepalive: true,
     }
     }
   )
   )
     .then((res) => res.json())
     .then((res) => res.json())
-    .then((data) => {
-      console.log('时间推送记录成功')
-      console.log(data);
-    })
+    .then(() => {
+      console.log("时间推送记录成功");
+    });
 });
 });
 onUnmounted(() => {
 onUnmounted(() => {
-  statistical()
-})
+  statistical();
+});
+
+onMounted(() => {
+  getPreviewData();
+  useWeChatShare((params.value! as unknown) as shareParams);
+});
 </script>
 </script>
 
 
-<style scoped></style>
+<style scoped lang="scss">
+.hidden {
+  width: 100vw;
+  height: 100vh;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+}
+</style>