Browse Source

refactor: ♻️ 添加屏幕统计

pull/1/head
jiangx 3 years ago
parent
commit
5e8fefd9d4
  1. 2
      src/composables/useHandleScreen.ts
  2. 14
      src/composables/useStatistics.ts

2
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]

14
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,

Loading…
Cancel
Save