Authored by 李奇

资源位曝光组件focus组件修改

... ... @@ -99,8 +99,12 @@ export default {
});
});
break;
case 'focus':
// 由于focus自动轮播的特殊性、上报数据由focus直接调用父组件方法
// 修改waiting数组所以这里不做数据监测
break;
case 'tfGoodsList':
// 楼层内存在多个item, 交给子组件各自检测
let visible = component.checkReqFromParent();
... ... @@ -149,6 +153,12 @@ export default {
// 重置子组件显示状态方可重新记录
this.componentStatus[index] = false;
this.checkReport();
},
focusComponentDataRecord(index, param) {
if (this.componentStatus[index]) {
console.log('focus push', param)
this.waiting.push(param);
}
}
}
};
... ...
... ... @@ -32,8 +32,12 @@
autoplay: true,
pagination: {
el: '.swiper-pagination'
},
on:{
slideChange: this._slideChange,
}
}
},
itemVisibleStatus: {}
};
},
computed: {
... ... @@ -44,6 +48,17 @@
methods: {
swiperSuccess(swiper) {
this.mySwiper = swiper;
// 注册成功后上报首个slide
let param = {
I_INDEX: this.mySwiper.realIndex + 1,
P_NAME: this.$route.name,
F_NAME: this.value.template_name,
F_ID: this.value.template_id,
F_INDEX: this.index + 1,
ACTION_URL: this.value.data[this.mySwiper.realIndex].url
};
this.dataRecord(param);
},
activeLink() {
const img = this.value.data[this.mySwiper.realIndex];
... ... @@ -54,6 +69,30 @@
this.$refs.linkA.click();
});
}
},
_slideChange() {
if (this.mySwiper) {
// fixed: slideChange回调执行时,realIndex为0会前后触发两次
if (this.mySwiper.previousIndex === this.value.data.length + 1) {
return;
}
let param = {
I_INDEX: this.mySwiper.realIndex + 1,
P_NAME: this.$route.name,
F_NAME: this.value.template_name,
F_ID: this.value.template_id,
F_INDEX: this.index + 1,
ACTION_URL: this.value.data[this.mySwiper.realIndex].url
};
this.dataRecord(param);
}
},
dataRecord(param) {
// index 用户父组件判断当前组件是否可见
this.$parent.focusComponentDataRecord(this.index, param)
}
},
components: {Resource}
... ...