From 5e8fefd9d4d622561e59c0918042131e2fee0be5 Mon Sep 17 00:00:00 2001 From: jiangx <1457960500@qq.com> Date: Fri, 9 Jun 2023 15:03:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E2=99=BB=EF=B8=8F=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=B1=8F=E5=B9=95=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/composables/useHandleScreen.ts | 2 ++ src/composables/useStatistics.ts | 14 +++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/composables/useHandleScreen.ts b/src/composables/useHandleScreen.ts index bd4a8eb..4f44133 100644 --- a/src/composables/useHandleScreen.ts +++ b/src/composables/useHandleScreen.ts @@ -2,6 +2,7 @@ import { ref, computed, onMounted, watch, toRefs } from 'vue' import { useRootStore } from '@/store/root' import { useRouter } from 'vue-router' import { getBackTime } from '@/http/api/base' +import { useStatistics } from '@/composables/useStatistics' export const useHandleScreen = (callback: () => void) => { const MIN_TIME = 0 @@ -58,6 +59,7 @@ export const useHandleScreen = (callback: () => void) => { } function checkHandleScreen() { + useStatistics({ tag: 'device' }) toIndexTime.value = totalTime.value[0] toWallpaperTime.value = totalTime.value[1] diff --git a/src/composables/useStatistics.ts b/src/composables/useStatistics.ts index 05e04a2..242fff2 100644 --- a/src/composables/useStatistics.ts +++ b/src/composables/useStatistics.ts @@ -3,19 +3,15 @@ import { storeToRefs } from 'pinia' import { getStatistics } from '@/http/api/statistics' import type { Query, TagType } from '@/http/api/statistics/types' -/** - * @description 店铺编码: tag=navigation或shop或brandSearch或时必传 - * @description industryCode: tag=industry时必传 - * @param tag 统计类型为以下几种: 'navigation' | 'shop' | 'brandSearch' | 'device' | 'program' | 'industry' - * @param shopCode 店铺唯一编码 - * @param industryCode 业态唯一编码 - */ -export const useStatistics = ({ tag, shopCode, industryCode = '' }: { tag: TagType; shopCode: string | number; industryCode?: string }) => { +type Params = { tag: TagType; shopCode?: string | number; industryCode?: string } +//店铺编码: tag=navigation或shop或brandSearch或时必传 +//industryCode : tag=industry时必传 +export const useStatistics = ({ tag, shopCode, industryCode = '' }: Params) => { const store = useRootStore() const { device } = storeToRefs(store) const params: Query = { - deviceCode: device.value.deviceCode, + deviceCode: device.value.machineCode, projectCode: device.value.projectCode, tag, shopCode,