...
|
...
|
@@ -70,12 +70,12 @@ export default { |
|
|
},
|
|
|
checkReport(evt, isInit) {
|
|
|
_.each(this.$children, (component, index) => {
|
|
|
const visiable = this.isVisiable(component.$el, this.$scrollEl);
|
|
|
const visible = this.isVisible(component.$el, this.$scrollEl);
|
|
|
|
|
|
if (visiable && (this.componentStatus[index] !== visiable || isInit)) {
|
|
|
if (visible && (this.componentStatus[index] !== visible || isInit)) {
|
|
|
this.record(component, index + 1);
|
|
|
}
|
|
|
this.componentStatus[index] = visiable;
|
|
|
this.componentStatus[index] = visible;
|
|
|
});
|
|
|
},
|
|
|
record(component, index) {
|
...
|
...
|
@@ -96,12 +96,14 @@ export default { |
|
|
F_ID: reportData.template_id,
|
|
|
F_INDEX: index,
|
|
|
ACTION_URL: item.url
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
break;
|
|
|
case 'focus':
|
|
|
break;
|
|
|
case 'tfGoodsList':
|
|
|
// 楼层内存在多个item, 交给子组件各自检测
|
|
|
component.checkReqFromParent();
|
|
|
break;
|
|
|
case 'newSingleImage':
|
|
|
param = {
|
...
|
...
|
@@ -124,13 +126,18 @@ export default { |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
isVisiable($el, $parent) {
|
|
|
isVisible($el, $parent) {
|
|
|
const rect = $el.getBoundingClientRect();
|
|
|
const parentRect = $parent.getBoundingClientRect();
|
|
|
|
|
|
return ((parentRect.top >= rect.top && parentRect.top <= (rect.top + rect.height)) ||
|
|
|
((parentRect.top + parentRect.height) >= rect.top && (parentRect.top + parentRect.height) <= (rect.top + rect.height)) ||
|
|
|
(rect.top >= parentRect.top && (rect.top + rect.height) <= (parentRect.top + parentRect.height)));
|
|
|
},
|
|
|
checkReqFromChild(index) {
|
|
|
// 重置子组件显示状态方可重新记录
|
|
|
this.componentStatus[index] = false;
|
|
|
this.checkReport();
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
|