Authored by QC-L

添加商品数据上报

@@ -158,6 +158,61 @@ class ResourceShowYasRpter { @@ -158,6 +158,61 @@ class ResourceShowYasRpter {
158 } 158 }
159 }); 159 });
160 160
  161 + $('.new-goods-list').each((floorIndex, theFloor) => {
  162 + let currentState = history.state;
  163 + let $theFloor = $(theFloor);
  164 + let F_INDEX = (currentState.index_idx || 0) + 2;
  165 + let TAB_NAME = currentState.tab_name;
  166 + let F_ID = currentState.template_id;
  167 + let F_NAME = currentState.template_name;
  168 + let floorsRawArr = [];
  169 +
  170 + $theFloor.find('.new-index-filter-list-item').each((aIndex, theA) => {
  171 + let $theA = $(theA);
  172 + let productSkn = $theA.data('product-skn');
  173 + let itemIndex = $theA.data('item-idx');
  174 +
  175 + if (
  176 + $.inviewport($theA, { threshold: 0 }) &&
  177 + productSkn
  178 + ) {
  179 + floorsRawArr.push({
  180 + href: '',
  181 + PRD_SKN: productSkn,
  182 + I_INDEX: itemIndex + 1,
  183 + F_INDEX,
  184 + F_ID,
  185 + TAB_NAME,
  186 + F_NAME
  187 + });
  188 + }
  189 + });
  190 + if (floorsRawArr.length) { // 本楼层有符合上报条件的商品
  191 + for (let goodsRawObj of floorsRawArr) {
  192 + let indexInLast = this.lastShowSkns.indexOf(goodsRawObj.PRD_SKN);
  193 +
  194 + if (indexInLast < 0) {
  195 + let newParams = {
  196 + P_NAME: this.getPname(),
  197 + P_PARAM: goodsRawObj.href && goodsRawObj.href.split('?')[0] || '',
  198 + F_INDEX: goodsRawObj.F_INDEX,
  199 + I_INDEX: goodsRawObj.I_INDEX,
  200 + F_ID: goodsRawObj.F_ID,
  201 + F_NAME: goodsRawObj.F_NAME,
  202 + TAB_NAME: goodsRawObj.TAB_NAME,
  203 + PRD_SKN: goodsRawObj.PRD_SKN,
  204 + ACTION_URL: ''
  205 + };
  206 +
  207 + this.reportParams.DATA.push(newParams);
  208 + }
  209 +
  210 + cacheTheShowSkns.push(goodsRawObj.PRD_SKN);
  211 +
  212 + }
  213 + }
  214 + });
  215 +
161 this.lastShowSkns = cacheTheShowSkns; 216 this.lastShowSkns = cacheTheShowSkns;
162 217
163 setTimeout(() => { 218 setTimeout(() => {
@@ -277,6 +277,17 @@ class Group extends Page { @@ -277,6 +277,17 @@ class Group extends Page {
277 this.templateId = templateId; 277 this.templateId = templateId;
278 this.templateName = templateName; 278 this.templateName = templateName;
279 this.indexIdx = indexIdx; 279 this.indexIdx = indexIdx;
  280 + let stateObj = {
  281 + tab_name: this.tabName,
  282 + index_idx: this.indexIdx,
  283 + template_id: templateId,
  284 + template_name: templateName
  285 + };
  286 + let url = window.location.href;
  287 + let valiable = url.split('?')[0];
  288 +
  289 + window.history.replaceState(stateObj, 'page', valiable);
  290 +
280 this.sendCustomInfo($this, {}); 291 this.sendCustomInfo($this, {});
281 query.forEach(item => { 292 query.forEach(item => {
282 queryObject = Object.assign(queryObject, item); 293 queryObject = Object.assign(queryObject, item);
@@ -705,7 +716,16 @@ class Group extends Page { @@ -705,7 +716,16 @@ class Group extends Page {
705 this.templateId = first.data('template-id'); 716 this.templateId = first.data('template-id');
706 this.indexIdx = first.data('index-idx'); 717 this.indexIdx = first.data('index-idx');
707 718
  719 + let stateObj = {
  720 + tab_name: this.tabName,
  721 + index_idx: this.indexIdx,
  722 + template_id: this.templateId,
  723 + template_name: this.templateName
  724 + };
  725 + let url = window.location.href;
  726 + let valiable = url.split('?')[0];
708 727
  728 + window.history.replaceState(stateObj, 'page', valiable);
709 729
710 // let selectedChannel = this.selectedChannel; 730 // let selectedChannel = this.selectedChannel;
711 // let requestParams = { 731 // let requestParams = {