...
|
...
|
@@ -14,7 +14,8 @@ export default { |
|
|
name: 'ResourceBox',
|
|
|
data() {
|
|
|
return {
|
|
|
componentStatus: {}
|
|
|
componentStatus: {},
|
|
|
waitingForReport: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
...
|
...
|
@@ -43,6 +44,14 @@ export default { |
|
|
this.$scrollEl.addEventListener('scroll', this.scrollEvent);
|
|
|
this.checkReport(void 0, true);
|
|
|
}
|
|
|
|
|
|
// 每隔三秒钟上报一次数据
|
|
|
setInterval(() => {
|
|
|
if (this.waitingForReport.length) {
|
|
|
this.report(this.waitingForReport);
|
|
|
this.waitingForReport = [];
|
|
|
}
|
|
|
}, 3000);
|
|
|
},
|
|
|
destroyed() {
|
|
|
if (this.$scrollEl) {
|
...
|
...
|
@@ -50,17 +59,26 @@ export default { |
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
report(param) {
|
|
|
console.log('<<<<<<<< report >>>>>>>>', param)
|
|
|
this.$store.dispatch(REPORT_YAS, {
|
|
|
params: {
|
|
|
appop: 'YB_SHOW_EVENT',
|
|
|
param
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
checkReport(evt, isInit) {
|
|
|
_.each(this.$children, (component, index) => {
|
|
|
const visiable = this.isVisiable(component.$el, this.$scrollEl);
|
|
|
|
|
|
if (visiable && (this.componentStatus[index] !== visiable || isInit)) {
|
|
|
this.report(component, index + 1);
|
|
|
this.record(component, index + 1);
|
|
|
}
|
|
|
this.componentStatus[index] = visiable;
|
|
|
});
|
|
|
},
|
|
|
report(component, index) {
|
|
|
record(component, index) {
|
|
|
const reportData = _.get(component, '$options.propsData.value');
|
|
|
|
|
|
if (reportData) {
|
...
|
...
|
@@ -68,15 +86,12 @@ export default { |
|
|
P_NAME: this.$route.name,
|
|
|
F_NAME: reportData.template_name,
|
|
|
F_ID: reportData.template_id,
|
|
|
F_INDEX: index
|
|
|
F_INDEX: index,
|
|
|
ACTION_URL: '',
|
|
|
PRD_SKN: ''
|
|
|
};
|
|
|
|
|
|
this.$store.dispatch(REPORT_YAS, {
|
|
|
params: {
|
|
|
appop: 'YB_SHOW_EVENT',
|
|
|
param
|
|
|
}
|
|
|
});
|
|
|
console.log('push', param);
|
|
|
this.waitingForReport.push(param);
|
|
|
}
|
|
|
},
|
|
|
isVisiable($el, $parent) {
|
...
|
...
|
|