Browse Source

feat: 统计

dev
jiannibang 3 years ago
parent
commit
2365d8d2c9
  1. 10
      src/composables/useHandleScreen.js
  2. 9
      src/composables/useStatistics.js
  3. 2
      src/store/root/actions.js
  4. 2
      src/views/Nav/Nav.vue

10
src/composables/useHandleScreen.js

@ -38,16 +38,6 @@ export const useHandleScreen = callback => {
}
}
//当前操作页是否首页专用
function rootPromise() {
clearTimeout(state.isRootTimer)
return new Promise(resolve => {
state.isRootTimer = setTimeout(() => {
resolve()
}, state.times[0] * 1000)
})
}
//回到首页专用
function indexPromise() {
return new Promise(resolve => {

9
src/composables/useStatistics.js

@ -5,14 +5,15 @@ import { getStatistics } from '@/http/api'
/**
* @param {string} tag 设备点击量:device,导航使用次数:navigation,店铺点击次数:shop,业态点击次数:industry, 搜索店铺: brandSearch
*/
export const useStatistics = tag => {
export const useStatistics = (tag, rest = {}) => {
const store = useStore()
const { currentFloor } = storeToRefs(store)
const { projectCode, deviceCode } = currentFloor.value
const { projectCode, machineCode } = currentFloor.value
const params = {
projectCode,
deviceCode,
tag
deviceCode: machineCode,
tag,
...rest
}
getStatistics(params)
}

2
src/store/root/actions.js

@ -1,4 +1,5 @@
import { i18n } from '@/i18n'
import { useStatistics } from '@/composables/useStatistics'
export const actions = {
SET_SHOP_LIST(list) {
@ -25,6 +26,7 @@ export const actions = {
},
SET_SHOP(shop) {
this.shop = shop
if (shop) useStatistics('shop', { shopId: shop.shopId })
},
SET_CURRENT_FLOOR(currentFloor) {
this.currentFloor = currentFloor

2
src/views/Nav/Nav.vue

@ -42,7 +42,7 @@ const { setPause } = useMapNavControl()
const { directionInfo, pathShopList, backPathArray } = useStartNavi(shop, currentFloor, setPause)
const { methodIdx, handleControl } = useChangeNavMethod(backPathArray)
useStatistics('navigation')
useStatistics('navigation', { shopId: shop.value.shopId })
</script>
<style lang="scss" scoped>

Loading…
Cancel
Save