埋点,im,客服删除
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="fiveGridAdv">
|
||||
<div class="fiveGrid" @touchstart.stop @touchmove.stop @touchend.stop v-if="state.advList.length > 0" ref="advRef">
|
||||
<div class="fiveGrid" @touchstart.stop @touchmove.stop @touchend.stop v-if="state.advList.length > 0">
|
||||
<div class="rectAdvBox" @click="handleJumpAdv(item)" v-for="item in state.advList" :key="item.id">
|
||||
<lazyImg class="rectAdvIcon" :src="item.cover" />
|
||||
<div class="rectName">{{ item.title }}</div>
|
||||
@@ -9,18 +9,13 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, reactive, ref, watch } from 'vue';
|
||||
import { reactive } from 'vue';
|
||||
import { jumpAdv } from '@/utils/index';
|
||||
import { getAdItem } from '@/utils/getConfig';
|
||||
import { AdImpressionType, setAdImpression } from '@/utils/eventReporter/adImpression';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { reportAdClickEvent } from '@/utils/eventReporter/adClick';
|
||||
|
||||
const route = useRoute();
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
advType: number;
|
||||
adImpression?: AdImpressionType;
|
||||
}>(),
|
||||
{
|
||||
advType: 2,
|
||||
@@ -29,32 +24,8 @@ const props = withDefaults(
|
||||
const state = reactive({
|
||||
advList: <any>(getAdItem(props.advType) || []), // 广告数据
|
||||
});
|
||||
// 广告展示埋点
|
||||
const advRef = ref();
|
||||
watch(
|
||||
() => state.advList,
|
||||
() => {
|
||||
if (state.advList.length) {
|
||||
nextTick(() => {
|
||||
setAdImpression(advRef.value, state.advList, {
|
||||
page_key: props.adImpression?.page_key || (route.meta.pageKey as string) || '',
|
||||
page_name: props.adImpression?.page_name || (route.meta.pageName as string) || '',
|
||||
ad_type: props.adImpression?.ad_type || 'small_grid',
|
||||
}).setupObserver();
|
||||
});
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
const handleJumpAdv = (item: Types.App.AdsInfoListItem) => {
|
||||
let params = {
|
||||
...item,
|
||||
page_key: props.adImpression?.page_key || (route.meta.pageKey as string) || '',
|
||||
page_name: props.adImpression?.page_name || (route.meta.pageName as string) || '',
|
||||
ad_type: props.adImpression?.ad_type || 'small_grid',
|
||||
};
|
||||
reportAdClickEvent(params);
|
||||
jumpAdv(item);
|
||||
jumpAdv(item, 'ads');
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user