Authored by 徐祁xuqi

Merge remote-tracking branch 'origin/feature/givePoint'

@@ -19,7 +19,8 @@ module.exports = function(specificGender) { @@ -19,7 +19,8 @@ module.exports = function(specificGender) {
19 page = 0, 19 page = 0,
20 gender = null, 20 gender = null,
21 num, 21 num,
22 - url; 22 + url,
  23 + RECPOSE = '';
23 24
24 // The kidsType can be specified by the parameter. Add by @ZhaoBiao 25 // The kidsType can be specified by the parameter. Add by @ZhaoBiao
25 var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false, 26 var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
@@ -49,6 +50,13 @@ module.exports = function(specificGender) { @@ -49,6 +50,13 @@ module.exports = function(specificGender) {
49 url = '/product/recom/maylike?gender=' + gender; 50 url = '/product/recom/maylike?gender=' + gender;
50 } 51 }
51 52
  53 + // 首页男生和女生,推荐位ID,埋点
  54 + if (window.location.pathname === '/boys') {
  55 + RECPOSE = 110001;
  56 + } else if (window.location.pathname === '/girls') {
  57 + RECPOSE = 110002;
  58 + }
  59 +
52 $curNav = $navList.children('.focus'); 60 $curNav = $navList.children('.focus');
53 61
54 if (lifestyleType) { 62 if (lifestyleType) {
@@ -99,6 +107,7 @@ module.exports = function(specificGender) { @@ -99,6 +107,7 @@ module.exports = function(specificGender) {
99 page: page + 1 107 page: page + 1
100 }, 108 },
101 success: function(data) { 109 success: function(data) {
  110 + var PRDID = [];
102 111
103 if (data === ' ') { 112 if (data === ' ') {
104 loading.hideLoadingMask(); 113 loading.hideLoadingMask();
@@ -158,6 +167,21 @@ module.exports = function(specificGender) { @@ -158,6 +167,21 @@ module.exports = function(specificGender) {
158 167
159 $title[0].mlellipsis(2); 168 $title[0].mlellipsis(2);
160 }); 169 });
  170 +
  171 + // 为您优选埋点 start
  172 + PRDID = [];
  173 + $(data).closest('.good-info').each(function() {
  174 + PRDID.push($(this).data('id'));
  175 + });
  176 + window.givePoint({
  177 + REC_POSE: RECPOSE,
  178 + PRD_ID: PRDID.join(','),
  179 + PRD_NUM: $(data).closest('.good-info').length,
  180 + ACTION_ID: 0,
  181 + page_num: page
  182 + });
  183 +
  184 + // 为您优选埋点 end
161 }, 185 },
162 error: function() { 186 error: function() {
163 tip.show('网络断开连接了~'); 187 tip.show('网络断开连接了~');
@@ -186,4 +210,21 @@ module.exports = function(specificGender) { @@ -186,4 +210,21 @@ module.exports = function(specificGender) {
186 $(window).scroll(function() { 210 $(window).scroll(function() {
187 window.requestAnimationFrame(scrollHandler); 211 window.requestAnimationFrame(scrollHandler);
188 }); 212 });
  213 +
  214 + // 为您优选埋点
  215 + $('.maybe-like .goods-list').on('click', 'a', function() {
  216 +
  217 + var pageNum = 50;
  218 +
  219 + index = $(this).closest('.good-info').index() + 1;
  220 +
  221 + window.givePoint({
  222 + REC_POSE: RECPOSE,
  223 + PRD_ID: $(this).closest('.good-info').data('id'),
  224 + PRD_NUM: index % pageNum === 0 ? pageNum : index % pageNum,
  225 + ACTION_ID: 1,
  226 + page_num: Math.ceil(index / pageNum)
  227 + });
  228 + return true;
  229 + });
189 }; 230 };
@@ -10,6 +10,10 @@ var $footer = $('#yoho-footer'), @@ -10,6 +10,10 @@ var $footer = $('#yoho-footer'),
10 $yohoPage = $('.yoho-page'), 10 $yohoPage = $('.yoho-page'),
11 $header = $('.yoho-header'); 11 $header = $('.yoho-header');
12 12
  13 +// 为您优选-40位随机数指纹请求id
  14 +var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) +
  15 + '_' + Math.floor(Math.random() * 1000000 + 1000000));
  16 +
13 function cookie(name) { 17 function cookie(name) {
14 var cookies = document.cookie, 18 var cookies = document.cookie,
15 cookieVal, 19 cookieVal,
@@ -294,6 +298,51 @@ if ($footer.find('.user-name').text().length === 11) { @@ -294,6 +298,51 @@ if ($footer.find('.user-name').text().length === 11) {
294 $footer.find('.user-name').html(phoneHidden($footer.find('.user-name').text())); 298 $footer.find('.user-name').html(phoneHidden($footer.find('.user-name').text()));
295 } 299 }
296 300
  301 +// 为您优选埋点 http://redmine.yoho.cn/issues/10117
  302 +function givePoint(parameter) {
  303 + var CID = 1;
  304 +
  305 + if (!window._yas || !window._yas.sendCustomInfo) {
  306 + return false;
  307 + }
  308 +
  309 + // 男: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 + }
  324 +
  325 + parameter = $.extend({
  326 + REC_POSE: '',
  327 + REC_ID: RECID,
  328 + PRD_ID: '',
  329 + PRD_NUM: 0,
  330 + C_ID: CID,
  331 + ACTION_ID: 0,
  332 + page_num: 1
  333 + }, parameter);
  334 +
  335 + if (parameter.REC_POSE === '' || parameter.PRD_ID === '') {
  336 + return true;
  337 + }
  338 +
  339 + window._yas.sendCustomInfo({
  340 + op: 'YB_CHOOSE_FOR_YOU_Y',
  341 + uid: getUid(),
  342 + param: JSON.stringify(parameter)
  343 + }, true);
  344 +}
  345 +
297 // 暴露公共接口 346 // 暴露公共接口
298 window.cookie = cookie; 347 window.cookie = cookie;
299 348
@@ -312,3 +361,5 @@ window.rePosFooter = rePosFooter; @@ -312,3 +361,5 @@ window.rePosFooter = rePosFooter;
312 window.reMarginFooter = reMarginFooter; 361 window.reMarginFooter = reMarginFooter;
313 362
314 window.queryString = queryString(); 363 window.queryString = queryString();
  364 +
  365 +window.givePoint = givePoint;