Authored by 郝肖肖

潮流优选,楼层banner埋点

@@ -88,10 +88,11 @@ const getResources = (params, options) => { @@ -88,10 +88,11 @@ const getResources = (params, options) => {
88 }; 88 };
89 89
90 if (res.focus_type * 1 === 1) { 90 if (res.focus_type * 1 === 1) {
91 - data.focus1 = [];  
92 - data.focus1.push(list); 91 + data.focus1 = list;
  92 + data.focus1.id = res.template_id;
93 } else { 93 } else {
94 data.focus2 = list; 94 data.focus2 = list;
  95 + data.focus1.id = res.template_id;
95 } 96 }
96 97
97 break; 98 break;
1 <div class="resources"> 1 <div class="resources">
2 <!--banner--> 2 <!--banner-->
3 - {{#each result.focus1}} 3 + {{#if result.focus1}}
4 <div class="banner-top"> 4 <div class="banner-top">
5 <div class="banner-swiper swiper-container"> 5 <div class="banner-swiper swiper-container">
6 - <ul class="swiper-wrapper">  
7 - {{#each data}} 6 + <ul class="swiper-wrapper" data-id={{result.focus1.id}}>
  7 + {{#each result.focus1.data}}
8 {{#if @first}} 8 {{#if @first}}
9 <li class="swiper-slide"> 9 <li class="swiper-slide">
10 <a href="{{url}}"> 10 <a href="{{url}}">
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 </div> 27 </div>
28 </div> 28 </div>
29 </div> 29 </div>
30 - {{/each}} 30 + {{/if}}
31 31
32 {{#each result.title_image}} 32 {{#each result.title_image}}
33 <div class="header-title"> 33 <div class="header-title">
@@ -14,6 +14,8 @@ var $footer = $('#yoho-footer'), @@ -14,6 +14,8 @@ var $footer = $('#yoho-footer'),
14 var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) + 14 var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) +
15 '_' + Math.floor(Math.random() * 1000000 + 1000000)); 15 '_' + Math.floor(Math.random() * 1000000 + 1000000));
16 16
  17 +var _ChannelVary = {boys: 1, girls: 2, kids: 3, lifestyle: 4};
  18 +
17 function cookie(name) { 19 function cookie(name) {
18 var cookies = document.cookie, 20 var cookies = document.cookie,
19 cookieVal, 21 cookieVal,
@@ -307,22 +309,7 @@ function givePoint(parameter) { @@ -307,22 +309,7 @@ function givePoint(parameter) {
307 } 309 }
308 310
309 // 男:1,女:2,潮童:3,创意生活:4 311 // 男:1,女:2,潮童:3,创意生活:4
310 - switch (cookie('_Channel')) {  
311 - case 'boys':  
312 - CID = 1;  
313 - break;  
314 - case 'girls':  
315 - CID = 2;  
316 - break;  
317 - case 'kids':  
318 - CID = 3;  
319 - break;  
320 - case 'lifestyle':  
321 - CID = 4;  
322 - break;  
323 - default:  
324 - CID = 1;  
325 - } 312 + CID = _ChannelVary[cookie('_Channel')] || 1;
326 313
327 parameter = $.extend({ 314 parameter = $.extend({
328 REC_POSE: '', 315 REC_POSE: '',
@@ -365,3 +352,5 @@ window.reMarginFooter = reMarginFooter; @@ -365,3 +352,5 @@ window.reMarginFooter = reMarginFooter;
365 window.queryString = queryString(); 352 window.queryString = queryString();
366 353
367 window.givePoint = givePoint; 354 window.givePoint = givePoint;
  355 +
  356 +window._ChannelVary = _ChannelVary;
@@ -11,7 +11,8 @@ var plusstar = {}, @@ -11,7 +11,8 @@ var plusstar = {},
11 var windowHeight = $(window).height(); 11 var windowHeight = $(window).height();
12 var scrollFn, 12 var scrollFn,
13 scrollTop, 13 scrollTop,
14 - RECPOSE; 14 + RECPOSE,
  15 + CID;
15 16
16 require('../common'); 17 require('../common');
17 18
@@ -50,7 +51,19 @@ plusstar = { @@ -50,7 +51,19 @@ plusstar = {
50 51
51 $(this).find('li').removeClass('focus'); 52 $(this).find('li').removeClass('focus');
52 $liDom.addClass('focus'); 53 $liDom.addClass('focus');
  54 + that.ParentLiDom = $liDom;// 保留当前tab先中的对象
53 that.tabNav($liDom.data('code')); 55 that.tabNav($liDom.data('code'));
  56 +
  57 + // 点击潮流优选上方的TAB按钮时
  58 + if (window._yas && window._yas.sendCustomInfo) {
  59 + window._yas.sendCustomInfo({
  60 + op: 'YB_FASHION_HOME_L',
  61 + param: JSON.stringify({
  62 + C_ID: CID,
  63 + TAB_ID: $liDom.index() + 1
  64 + })
  65 + }, true);
  66 + }
54 }); 67 });
55 68
56 // start -- 默认选中 69 // start -- 默认选中
@@ -64,9 +77,20 @@ plusstar = { @@ -64,9 +77,20 @@ plusstar = {
64 that.tabNav($liDom.data('code')); 77 that.tabNav($liDom.data('code'));
65 78
66 // ent -- 默认选中 79 // ent -- 默认选中
  80 + that.ParentLiDom = $liDom;// 保留当前tab先中的对象
  81 + setTimeout(function() {
  82 + that._yas();
  83 + }, 1000);
  84 + },
  85 + _yas: function() {
  86 + var that = this;
  87 +
  88 + if (!window._yas || !window._yas.sendCustomInfo) {
  89 + return false;
  90 + }
67 91
68 // 商品单击埋点 92 // 商品单击埋点
69 - RECPOSE = $liDom.index() === 0 ? 100014 : 100015; 93 + RECPOSE = that.ParentLiDom.index() !== 0 ? 100015 : 100014;
70 $('.plusstar-resources').bind('click', function(event) { 94 $('.plusstar-resources').bind('click', function(event) {
71 95
72 var $goodInfo = $(event.target).closest('.good-info'), 96 var $goodInfo = $(event.target).closest('.good-info'),
@@ -83,6 +107,36 @@ plusstar = { @@ -83,6 +107,36 @@ plusstar = {
83 page_num: Math.ceil(index / that.common.pagesize) 107 page_num: Math.ceil(index / that.common.pagesize)
84 }); 108 });
85 }); 109 });
  110 +
  111 + // 潮流优选首页加载时
  112 + window._yas.sendCustomInfo({
  113 + op: 'YB_FASHION_HOME_L',
  114 + param: JSON.stringify({
  115 + C_ID: CID,
  116 + TAB_ID: that.ParentLiDom.index() + 1
  117 + })
  118 + }, true);
  119 +
  120 + // 头部banner楼层埋点
  121 + $('.plusstar-resources .banner-top').find('ul').bind('click', function(event) {
  122 + var $dom = $(event.target).closest('.li'),
  123 + index;
  124 +
  125 + index = $dom.index() + 1;
  126 + window._yas.sendCustomInfo({
  127 + op: 'YB_FASHION_HOME_L',
  128 + param: JSON.stringify({
  129 + C_ID: CID,
  130 + TAB_ID: that.ParentLiDom.index() + 1,
  131 + F_ID: $(this).data('id'),
  132 + F_NAME: '焦点图',
  133 + F_URL: $dom.find('a').attr('href'),
  134 + F_INDEX: 1,
  135 + I_INDEX: index
  136 + })
  137 + }, true);
  138 + });
  139 +
86 }, 140 },
87 tabNav: function(code) { 141 tabNav: function(code) {
88 var that = this; 142 var that = this;
@@ -215,6 +269,9 @@ scrollFn = debounce(function() { @@ -215,6 +269,9 @@ scrollFn = debounce(function() {
215 }, 200); 269 }, 200);
216 270
217 $(function() { 271 $(function() {
  272 + // 男:1,女:2,潮童:3,创意生活:4
  273 + CID = window._ChannelVary[window.cookie('_Channel')] || 1;
  274 +
218 if (!(window.queryString.app_version || window.queryString.appVersion)) { 275 if (!(window.queryString.app_version || window.queryString.appVersion)) {
219 $('.tab-nav').css({ 276 $('.tab-nav').css({
220 position: 'relative' 277 position: 'relative'
@@ -233,5 +290,4 @@ $(function() { @@ -233,5 +290,4 @@ $(function() {
233 $(window).scroll(function() { 290 $(window).scroll(function() {
234 scrollFn(); 291 scrollFn();
235 }); 292 });
236 -  
237 }); 293 });