Authored by 李奇

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

@@ -99,8 +99,12 @@ export default { @@ -99,8 +99,12 @@ export default {
99 }); 99 });
100 }); 100 });
101 break; 101 break;
  102 +
102 case 'focus': 103 case 'focus':
  104 + // 由于focus自动轮播的特殊性、上报数据由focus直接调用父组件方法
  105 + // 修改waiting数组所以这里不做数据监测
103 break; 106 break;
  107 +
104 case 'tfGoodsList': 108 case 'tfGoodsList':
105 // 楼层内存在多个item, 交给子组件各自检测 109 // 楼层内存在多个item, 交给子组件各自检测
106 let visible = component.checkReqFromParent(); 110 let visible = component.checkReqFromParent();
@@ -149,6 +153,12 @@ export default { @@ -149,6 +153,12 @@ export default {
149 // 重置子组件显示状态方可重新记录 153 // 重置子组件显示状态方可重新记录
150 this.componentStatus[index] = false; 154 this.componentStatus[index] = false;
151 this.checkReport(); 155 this.checkReport();
  156 + },
  157 + focusComponentDataRecord(index, param) {
  158 + if (this.componentStatus[index]) {
  159 + console.log('focus push', param)
  160 + this.waiting.push(param);
  161 + }
152 } 162 }
153 } 163 }
154 }; 164 };
@@ -32,8 +32,12 @@ @@ -32,8 +32,12 @@
32 autoplay: true, 32 autoplay: true,
33 pagination: { 33 pagination: {
34 el: '.swiper-pagination' 34 el: '.swiper-pagination'
  35 + },
  36 + on:{
  37 + slideChange: this._slideChange,
35 } 38 }
36 - } 39 + },
  40 + itemVisibleStatus: {}
37 }; 41 };
38 }, 42 },
39 computed: { 43 computed: {
@@ -44,6 +48,17 @@ @@ -44,6 +48,17 @@
44 methods: { 48 methods: {
45 swiperSuccess(swiper) { 49 swiperSuccess(swiper) {
46 this.mySwiper = swiper; 50 this.mySwiper = swiper;
  51 +
  52 + // 注册成功后上报首个slide
  53 + let param = {
  54 + I_INDEX: this.mySwiper.realIndex + 1,
  55 + P_NAME: this.$route.name,
  56 + F_NAME: this.value.template_name,
  57 + F_ID: this.value.template_id,
  58 + F_INDEX: this.index + 1,
  59 + ACTION_URL: this.value.data[this.mySwiper.realIndex].url
  60 + };
  61 + this.dataRecord(param);
47 }, 62 },
48 activeLink() { 63 activeLink() {
49 const img = this.value.data[this.mySwiper.realIndex]; 64 const img = this.value.data[this.mySwiper.realIndex];
@@ -54,6 +69,30 @@ @@ -54,6 +69,30 @@
54 this.$refs.linkA.click(); 69 this.$refs.linkA.click();
55 }); 70 });
56 } 71 }
  72 + },
  73 + _slideChange() {
  74 + if (this.mySwiper) {
  75 +
  76 + // fixed: slideChange回调执行时,realIndex为0会前后触发两次
  77 + if (this.mySwiper.previousIndex === this.value.data.length + 1) {
  78 + return;
  79 + }
  80 +
  81 + let param = {
  82 + I_INDEX: this.mySwiper.realIndex + 1,
  83 + P_NAME: this.$route.name,
  84 + F_NAME: this.value.template_name,
  85 + F_ID: this.value.template_id,
  86 + F_INDEX: this.index + 1,
  87 + ACTION_URL: this.value.data[this.mySwiper.realIndex].url
  88 + };
  89 +
  90 + this.dataRecord(param);
  91 + }
  92 + },
  93 + dataRecord(param) {
  94 + // index 用户父组件判断当前组件是否可见
  95 + this.$parent.focusComponentDataRecord(this.index, param)
57 } 96 }
58 }, 97 },
59 components: {Resource} 98 components: {Resource}