diff --git a/src/components/Search/Search.vue b/src/components/Search/Search.vue index 4ebf899..b265e3c 100644 --- a/src/components/Search/Search.vue +++ b/src/components/Search/Search.vue @@ -96,7 +96,7 @@ const hotRecommend = computed(() => indexList.value.hotSearch ?? []) const showClassify = ref(false) async function handleShop(item) { - useStatistics('brandSearch') + useStatistics('brandSearch', { shopId: item.shopId }) const shop = shopList.value.find(_shop => _shop.shopId === item.shopId) store.SET_SHOP(shop) if (router.currentRoute.value.fullPath !== '/guide') { diff --git a/src/composables/useStatistics.js b/src/composables/useStatistics.js index 7c54acc..b529e47 100644 --- a/src/composables/useStatistics.js +++ b/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 params = { projectCode, deviceCode, - tag + tag, + ...rest } getStatistics(params) } diff --git a/src/store/root/actions.js b/src/store/root/actions.js index c2c2895..5fd0e9c 100644 --- a/src/store/root/actions.js +++ b/src/store/root/actions.js @@ -1,5 +1,5 @@ import { i18n } from '@/i18n' - +import { useStatistics } from '@/composables/useStatistics' export const actions = { SET_SHOP_LIST(list) { this.shopList = list @@ -28,6 +28,7 @@ export const actions = { }, SET_SHOP(shop) { this.shop = shop + if (shop) useStatistics('shop', { shopId: shop.shopId }) }, SET_CURRENT_FLOOR(currentFloor) { this.currentFloor = currentFloor