Authored by baoss

解决分类页埋点问题

@@ -7,8 +7,8 @@ @@ -7,8 +7,8 @@
7 v-for="(item, index) in categoryParent" 7 v-for="(item, index) in categoryParent"
8 :key="index" 8 :key="index"
9 :class="{'category-left-item-select-flag' : item.isSelect }" 9 :class="{'category-left-item-select-flag' : item.isSelect }"
10 - :data-id="item"  
11 - @click="onClick(item)"> 10 + :data-id="item.id"
  11 + @click="onClick(item, index)">
12 <p 12 <p
13 class="category-left-item-title" 13 class="category-left-item-title"
14 :class="{'category-left-item-select' : item.isSelect }"> 14 :class="{'category-left-item-select' : item.isSelect }">
@@ -71,7 +71,7 @@ export default { @@ -71,7 +71,7 @@ export default {
71 scrollEvents: ['scroll-end'], 71 scrollEvents: ['scroll-end'],
72 sortItem:{ 72 sortItem:{
73 id:'-1', 73 id:'-1',
74 - name:'brand', 74 + name:'品牌',
75 index: 0 75 index: 0
76 } 76 }
77 }; 77 };
@@ -94,8 +94,6 @@ export default { @@ -94,8 +94,6 @@ export default {
94 let reportParams = []; 94 let reportParams = [];
95 this.categorySubList.forEach((item) => { 95 this.categorySubList.forEach((item) => {
96 let subItemList = item.sub; 96 let subItemList = item.sub;
97 - // console.log('item'+scrollY)  
98 - // console.log(item)  
99 subItemList.forEach((val, index) => { 97 subItemList.forEach((val, index) => {
100 let eleTop = this.$refs.index[index].offsetTop; 98 let eleTop = this.$refs.index[index].offsetTop;
101 let eleHeight = this.$refs.index[index].offsetHeight; 99 let eleHeight = this.$refs.index[index].offsetHeight;
@@ -108,13 +106,14 @@ export default { @@ -108,13 +106,14 @@ export default {
108 // console.log("firstHeight:"+firstHeight+'==scrollHeight='+scrollHeight+"==eleTop=="+eleTop+"==lastViewHeight="+lastViewHeight); 106 // console.log("firstHeight:"+firstHeight+'==scrollHeight='+scrollHeight+"==eleTop=="+eleTop+"==lastViewHeight="+lastViewHeight);
109 if(firstHeight < eleTop && scrollHeight + scrollY > eleTop){ 107 if(firstHeight < eleTop && scrollHeight + scrollY > eleTop){
110 let reportItem = { 108 let reportItem = {
  109 + P_NAME: 'XY_UFOCategory',
111 CATE_ID: this.sortItem.id, 110 CATE_ID: this.sortItem.id,
112 CATE_NM: this.sortItem.name, 111 CATE_NM: this.sortItem.name,
113 - CATE_INDEX: this.sortItem.index, 112 + CATE_INDEX: this.sortItem.index + 1,
114 F_ID: item.id, 113 F_ID: item.id,
115 F_NAME: item.name, 114 F_NAME: item.name,
116 - F_INDEX: item.index,  
117 - I_INDEX: index, 115 + F_INDEX: item.index + 1,
  116 + I_INDEX: index + 1,
118 TO_TYPE: val.linkType, 117 TO_TYPE: val.linkType,
119 TO_ID: val.link, 118 TO_ID: val.link,
120 }; 119 };
@@ -132,16 +131,16 @@ export default { @@ -132,16 +131,16 @@ export default {
132 }); 131 });
133 132
134 }, 133 },
135 - onClick(item) { 134 + async onClick(item,index) {
136 if (!item.isSelect) { 135 if (!item.isSelect) {
137 this.sortItem = item; 136 this.sortItem = item;
138 let id = item.id; 137 let id = item.id;
139 let name = item.name; 138 let name = item.name;
140 let subList ; 139 let subList ;
141 if (id === '-1') { 140 if (id === '-1') {
142 - subList = this.fetchBrandList({ id }); 141 + subList = await this.fetchBrandList({ id });
143 } else { 142 } else {
144 - subList = this.fetchCategorySubList({ id, name }); 143 + subList = await this.fetchCategorySubList({ id, name });
145 } 144 }
146 145
147 this.$store.dispatch('reportYas', { 146 this.$store.dispatch('reportYas', {
@@ -149,7 +148,8 @@ export default { @@ -149,7 +148,8 @@ export default {
149 appop: 'XY_UFO_CATEGORY_TAB_LIST', 148 appop: 'XY_UFO_CATEGORY_TAB_LIST',
150 param: { 149 param: {
151 CATE_ID: id, 150 CATE_ID: id,
152 - CATE_NM: item.name 151 + CATE_NM: item.name,
  152 + CATE_INDEX: index + 1
153 } 153 }
154 } 154 }
155 }); 155 });
@@ -163,11 +163,11 @@ export default { @@ -163,11 +163,11 @@ export default {
163 param: { 163 param: {
164 CATE_ID: this.sortItem.id, 164 CATE_ID: this.sortItem.id,
165 CATE_NM: this.sortItem.name, 165 CATE_NM: this.sortItem.name,
166 - CATE_INDEX: this.sortItem.index, 166 + CATE_INDEX: this.sortItem.index + 1,
167 F_ID: itemSub.id, 167 F_ID: itemSub.id,
168 F_NAME: itemSub.name, 168 F_NAME: itemSub.name,
169 - F_INDEX: itemSub.index,  
170 - I_INDEX: index, 169 + F_INDEX: itemSub.index + 1,
  170 + I_INDEX: index + 1,
171 TO_TYPE: item.linkType, 171 TO_TYPE: item.linkType,
172 TO_ID: item.link, 172 TO_ID: item.link,
173 } 173 }