Authored by 李奇

tfgoods组件当页面从不显示变为显示之后、重置内部item显示状态

... ... @@ -73,20 +73,18 @@ export default {
const visible = this.isVisible(component.$el, this.$scrollEl);
if (visible && (this.componentStatus[index] !== visible || isInit)) {
this.record(component, index + 1);
this.record(component, index + 1, isInit);
}
this.componentStatus[index] = visible;
});
},
record(component, index) {
record(component, index, isInit) {
const reportData = _.get(component, '$options.propsData.value');
// TODO 区分不通组件记录以楼层内item为单位、而不是以整个楼层为单位组织数据上报
let param;
if (reportData) {
switch (reportData.template_name) {
case 'goods':
break;
case 'twoPicture':
param = [];
_.each(reportData.data.list, item => {
... ... @@ -107,7 +105,7 @@ export default {
case 'tfGoodsList':
// 楼层内存在多个item, 交给子组件各自检测
let visible = component.checkReqFromParent();
let visible = component.checkReqFromParent(isInit);
if (visible.length) {
param = [];
_.each(visible, item => {
... ... @@ -120,6 +118,7 @@ export default {
});
}
break;
case 'newSingleImage':
param = {
P_NAME: this.$route.name,
... ... @@ -129,8 +128,6 @@ export default {
ACTION_URL: reportData.data.list[0].url
};
break;
case 'BlkNewProductFloorResource':
break;
default:
break;
}
... ...
... ... @@ -138,7 +138,13 @@ export default {
},
// 用于检测楼层内部item的曝光状态, 暴露给父组件调用
checkReqFromParent() {
checkReqFromParent(isInit) {
// isInit为true时重置item的显示状态重新检测
if (isInit) {
_.each(this.itemVisibleStatus, (v, k) => this.itemVisibleStatus[k] = false);
}
let rect;
let isVisible;
let visible = [];
... ...