Authored by hongweigao

Merge branch 'feature/collectListYas' into release/5.2

... ... @@ -48,8 +48,7 @@ var $saleReturn = $('#saleReturn');
var dialogTpl = require('hbs/product/coupon-dialog.hbs');
var $goodsIdArr = [],
pageNum = 1;
var $goodsIdArr = [];
function limitedProductUrl(s) {
return window.location.href + '?openby:yohobuy={"action":"go.limitpurchase","params":{"lp":"' + s + '"}}';
... ... @@ -1058,43 +1057,21 @@ function randomString(len) {
/*
* 页面加载完
*/
function initPageYas(pNum) {
var loadYas = {},
starIndex = (parseInt(pNum, 10) - 1) * 5,
endIndex = parseInt(pNum, 10) * 5;
var pageGoods = $goodsIdArr.slice(starIndex, endIndex);
loadYas = {
function initPageYas() {
var loadYas = {
REC_POSE: 100013,
REC_ID: randomString(40),
PRD_ID: pageGoods.join(','),
PRD_NUM: pageGoods.length,
PRD_ID: $goodsIdArr.join(','),
PRD_NUM: $goodsIdArr.length,
ORDER_CODE: '',
ACTION_ID: 0,
PAGE_NUM: pNum
PAGE_NUM: 1
};
// 关键词搜索结果页展示时
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
}
/*
* 左右箭头埋点
*/
function arrowYas($arrow) {
var totalPage = Math.ceil($goodsIdArr.length / 5);
if ($arrow.hasClass('prev') && pageNum > 1) {
pageNum--;
}
if ($arrow.hasClass('next') && pageNum < totalPage) {
pageNum++;
}
initPageYas(pageNum);
}
// 店铺推荐
function loadRecommend() {
$.ajax({
... ... @@ -1126,8 +1103,7 @@ function loadRecommend() {
$('#recommend-content').append(html);
$('.recommend-slider').slider2({
shownum: 5,
isCircle: true,
yasFun: arrowYas
isCircle: true
});
$('.recommend-slider .img-item .goods-id').each(function() {
... ... @@ -1140,32 +1116,29 @@ function loadRecommend() {
}
// 页面加载完,埋点
initPageYas(pageNum);
initPageYas();
});
}
// 点击为您推荐商品埋点
$('.recommend-slider .img-item').click(function() {
var $this = $(this);
var index = parseInt($this.index(), 10) + 1;
var page = index / 5 <= 1 ? '' : Math.ceil(index / 5) + '';
var num = index % 5 ? index % 5 + '' : '5';
var loadYas = {
REC_POSE: 100013,
REC_ID: randomString(40),
PRD_ID: $this.find('.goods-id').html(),
PRD_NUM: page + num,
ORDER_CODE: '',
ACTION_ID: 1,
PAGE_NUM: page === '' ? 1 : page
};
// 点击为您推荐商品埋点
$('.recommend-slider').on('click', '.img-item', function() {
var $this = $(this);
var proId = $this.find('.goods-id').html();
var loadYas = {
REC_POSE: 100013,
REC_ID: randomString(40),
PRD_ID: proId,
PRD_NUM: $goodsIdArr.indexOf(proId) + 1,
ORDER_CODE: '',
ACTION_ID: 1,
PAGE_NUM: 1
};
// 关键词搜索结果页展示时
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
});
});
}
// 关键词搜索结果页展示时
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
});
window.loadRecommend = loadRecommend;
... ...