Authored by 梁志锋

Merge remote-tracking branch 'remotes/origin/hotfix/logname'

... ... @@ -53,6 +53,7 @@ module.exports = {
handleExceptions: true
},
udp: { // send by udp
measurement: 'yohobuywap_node_log',
level: 'debug', // logger level
host: '192.168.102.162', // influxdb host
port: '4444' // influxdb port
... ...
... ... @@ -19,7 +19,8 @@ module.exports = function(specificGender) {
page = 0,
gender = null,
num,
url;
url,
RECPOSE = '';
// The kidsType can be specified by the parameter. Add by @ZhaoBiao
var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
... ... @@ -49,6 +50,13 @@ module.exports = function(specificGender) {
url = '/product/recom/maylike?gender=' + gender;
}
// 首页男生和女生,推荐位ID,埋点
if (window.location.pathname === '/boys') {
RECPOSE = 110001;
} else if (window.location.pathname === '/girls') {
RECPOSE = 110002;
}
$curNav = $navList.children('.focus');
if (lifestyleType) {
... ... @@ -99,6 +107,7 @@ module.exports = function(specificGender) {
page: page + 1
},
success: function(data) {
var PRDID = [];
if (data === ' ') {
loading.hideLoadingMask();
... ... @@ -158,6 +167,21 @@ module.exports = function(specificGender) {
$title[0].mlellipsis(2);
});
// 为您优选埋点 start
PRDID = [];
$(data).closest('.good-info').each(function() {
PRDID.push($(this).data('id'));
});
window.givePoint({
REC_POSE: RECPOSE,
PRD_ID: PRDID.join(','),
PRD_NUM: $(data).closest('.good-info').length,
ACTION_ID: 0,
page_num: page
});
// 为您优选埋点 end
},
error: function() {
tip.show('网络断开连接了~');
... ... @@ -186,4 +210,21 @@ module.exports = function(specificGender) {
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
// 为您优选埋点
$('.maybe-like .goods-list').on('click', 'a', function() {
var pageNum = 50;
index = $(this).closest('.good-info').index() + 1;
window.givePoint({
REC_POSE: RECPOSE,
PRD_ID: $(this).closest('.good-info').data('id'),
PRD_NUM: index % pageNum === 0 ? pageNum : index % pageNum,
ACTION_ID: 1,
page_num: Math.ceil(index / pageNum)
});
return true;
});
};
... ...
... ... @@ -10,6 +10,10 @@ var $footer = $('#yoho-footer'),
$yohoPage = $('.yoho-page'),
$header = $('.yoho-header');
// 为您优选-40位随机数指纹请求id
var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) +
'_' + Math.floor(Math.random() * 1000000 + 1000000));
function cookie(name) {
var cookies = document.cookie,
cookieVal,
... ... @@ -294,6 +298,51 @@ if ($footer.find('.user-name').text().length === 11) {
$footer.find('.user-name').html(phoneHidden($footer.find('.user-name').text()));
}
// 为您优选埋点 http://redmine.yoho.cn/issues/10117
function givePoint(parameter) {
var CID = 1;
if (!window._yas || !window._yas.sendCustomInfo) {
return false;
}
// 男:1,女:2,潮童:3,创意生活:4
switch (cookie('_Channel')) {
case 'boys':
CID = 1;
break;
case 'girls':
CID = 2;
break;
case 'kids':
CID = 3;
break;
case 'lifestyle':
CID = 4;
break;
}
parameter = $.extend({
REC_POSE: '',
REC_ID: RECID,
PRD_ID: '',
PRD_NUM: 0,
C_ID: CID,
ACTION_ID: 0,
page_num: 1
}, parameter);
if (parameter.REC_POSE === '' || parameter.PRD_ID === '') {
return true;
}
window._yas.sendCustomInfo({
op: 'YB_CHOOSE_FOR_YOU_Y',
uid: getUid(),
param: JSON.stringify(parameter)
}, true);
}
// 暴露公共接口
window.cookie = cookie;
... ... @@ -312,3 +361,5 @@ window.rePosFooter = rePosFooter;
window.reMarginFooter = reMarginFooter;
window.queryString = queryString();
window.givePoint = givePoint;
... ...
... ... @@ -42,9 +42,10 @@ function initNavScroll(opt) {
}
// 获取url中的参数
function getUrlParam(name) {
function getUrlParam(name, url) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); // 构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); // 匹配目标参数
var urlTest = url || window.location.href;
var r = urlTest.slice(urlTest.indexOf('?') + 1).match(reg); // 匹配目标参数
// 返回参数值
if (r !== null) {
... ... @@ -76,6 +77,20 @@ function activeNav() {
var $nav = $('#index_nav');
var index = getUrlParam('yh_channel');
// 判断是否有首页选项
var flag = false;
$nav.find('li').each(function() {
var $this = $(this);
var url = $this.find('a').attr('href');
var code = getUrlParam('content_code', url);
if (code === 'c19ffa03f053f4cac3690b22c8da26b7') {
flag = true;
return false;
}
});
getOtherIndex();
if (index === null) {
index = getUrlParam('type');
... ... @@ -85,6 +100,9 @@ function activeNav() {
$nav.find('li[data-type=' + index + ']').addClass('active').siblings().removeClass('active');
}
} else {
if (!flag) {
index -= 1;
}
$nav.find('li:not([data-nav="other"])').eq(index).addClass('active').siblings().removeClass('active');
}
... ...
... ... @@ -253,7 +253,7 @@
.messages {
width: 84%;
height: 4rem;
position: absolute;
position: fixed;
background: rgba(0, 0, 0, 0.9);
border-radius: 0.6rem;
left: 8%;
... ...