From 133c1d507fdd3d413e205c670e9ce3ee87ff7316 Mon Sep 17 00:00:00 2001 From: jiannibang <271381693@qq.com> Date: Tue, 31 Jan 2023 14:24:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=97=A5=E5=BF=97=E6=94=B6=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Search/Search.vue | 2 +- src/composables/useStatistics.js | 5 +++-- src/store/root/actions.js | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) 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