Browse Source

feat: 在导航中添加统计功能以跟踪商店访问

ShangHai_LongXiang
jiannibang 1 year ago
parent
commit
9080f1c3f4
  1. 10
      src/views/Brand/Brand.vue
  2. 4
      src/views/Guide/Guide.vue

10
src/views/Brand/Brand.vue

@ -35,6 +35,7 @@ import MapControl from '@/components/MapControl/MapControl.vue'
import { RESET, DIRECTION } from '@/components/MapControl/list'
import { useMediaQuery } from '@vueuse/core'
import { isZhiluji, playShockmanByNav } from '@/composables/useShockman'
import { useStatistics } from '@/composables/useStatistics'
const store = useStore()
const storeRefs = storeToRefs(store)
@ -70,18 +71,21 @@ onBeforeUnmount(() => {
function handleShop(item) {
if (shop.value?.shopCode === item.shopCode || shopPicsMap.value[item.shopCode]) {
if (showMap.value) {
if (shop.value)
if (shop.value) {
if (shop.value.houseNumber) useStatistics('navigation', { shopCode: shop.value.shopCode })
window.Map_QM.pathNode({ floor: shop.value.floorOrder, node: shop.value.yaxis }, ({ angle, cost }) => {
if (isZhiluji()) {
playShockmanByNav({ progText1: shop.value.shopName, progAngel: String(angle), progDist: cost + '米' })
}
})
else
} else {
if (item.houseNumber) useStatistics('navigation', { shopCode: item.shopCode })
window.Map_QM.pathNode({ floor: item.floorOrder, node: item.yaxis }, ({ angle, cost }) => {
if (isZhiluji()) {
playShockmanByNav({ progText1: item.shopName, progAngel: String(angle), progDist: cost + '米' })
}
})
}
} else store.SET_SHOW_MAP(true)
}
mapIdx.value = -1
@ -124,6 +128,7 @@ watch(showMap, v => {
window?.Map_QM?.startRender()
if (shop.value) {
store.SET_SHOW_MAP(true)
if (shop.value.houseNumber) useStatistics('navigation', { shopCode: shop.value.shopCode })
window.Map_QM.pathNode({ floor: shop.value.floorOrder, node: shop.value.yaxis }, ({ angle, cost }) => {
if (isZhiluji()) {
playShockmanByNav({ progText1: shop.value.shopName, progAngel: String(angle), progDist: cost + '米' })
@ -140,6 +145,7 @@ watch(shop, nxt => {
setShopInactive()
} else if (nxt && showMap.value) {
setShopActive(nxt)
if (nxt.houseNumber) useStatistics('navigation', { shopCode: nxt.shopCode })
window.Map_QM.pathNode({ floor: nxt.floorOrder, node: nxt.yaxis }, ({ angle, cost }) => {
if (isZhiluji()) {
playShockmanByNav({ progText1: nxt.shopName, progAngel: String(angle), progDist: cost + '米' })

4
src/views/Guide/Guide.vue

@ -96,6 +96,7 @@ import { useMediaQuery } from '@vueuse/core'
import MapControl from '@/components/MapControl/MapControl.vue'
import { RESET, DIRECTION } from '@/components/MapControl/list'
import { isZhiluji, playShockmanByNav } from '@/composables/useShockman'
import { useStatistics } from '@/composables/useStatistics'
const isH = useMediaQuery('(min-aspect-ratio: 1/1)')
@ -165,6 +166,7 @@ function handleMapIcon(item, index) {
function handleShop(item) {
mapIdx.value = -1
if (shop.value === item && initiated.value) {
if (item.houseNumber) useStatistics('navigation', { shopCode: item.shopCode })
window.Map_QM.pathNode({ floor: item.floorOrder, node: item.yaxis }, ({ angle, cost }) => {
if (isZhiluji()) {
playShockmanByNav({ progText1: item.shopName, progAngel: String(angle), progDist: cost + '米' })
@ -182,6 +184,7 @@ watch(shop, nxt => {
if (floor.floorOrder !== nxt.floorOrder) {
filterAboutCurrentInfo(false)
}
if (nxt.houseNumber) useStatistics('navigation', { shopCode: nxt.shopCode })
window.Map_QM.pathNode({ floor: nxt.floorOrder, node: nxt.yaxis }, ({ angle, cost }) => {
if (isZhiluji()) {
playShockmanByNav({ progText1: nxt.shopName, progAngel: String(angle), progDist: cost + '米' })
@ -239,6 +242,7 @@ function filterAboutCurrentInfo(needShowFloor = true) {
window.Map_QM.showFloor(floorOrder, () => {
if (shop.value) {
setShopActive(shop.value)
if (shop.value.houseNumber) useStatistics('navigation', { shopCode: shop.value.shopCode })
window.Map_QM.pathNode({ floor: shop.value.floorOrder, node: shop.value.yaxis }, ({ angle, cost }) => {
if (isZhiluji()) {
playShockmanByNav({ progText1: shop.value.shopName, progAngel: String(angle), progDist: cost + '米' })

Loading…
Cancel
Save