Authored by zhangxiaoru

品牌 埋点

... ... @@ -37,6 +37,8 @@ var $input = $('#search-input input'),
$buriedpoint = $('.buriedpoint'),
$search = $('#search');
var C_ID, filext = {}, total, argument;
var shopId, sort, brand, outlets, app_type, age_level, msort, misort, coin, app_version, first_load = true;
// 默认筛选条件
... ... @@ -81,6 +83,8 @@ require('../../common');
ellipsis.init();
C_ID = window._ChannelVary[window.cookie('_Channel')];
// pageCache 获取是否收藏
(function() {
if ($('.domain').val()) {
... ... @@ -297,6 +301,7 @@ function search(opt) {
break;
}
$.extend(filext, ext);
$.extend(defaultOpt, ext); // 扩展筛选项
}
... ... @@ -373,6 +378,7 @@ function search(opt) {
loading.showLoadingMask();
}
argument = setting;
$.ajax({
type: 'GET',
... ... @@ -381,7 +387,9 @@ function search(opt) {
success: function(data) {
var noResult = '<p class="no-result">未找到相关搜索结果</p>',
num,
$container;
$container,
goodIds = [],
yasparm;
switch (navType) {
case 'newest':
... ... @@ -400,21 +408,65 @@ function search(opt) {
break;
}
yasparm = {
C_ID: C_ID,
BRAND_ID: setting.shop_id,
PAGE_NUM: setting.page,
FILTER_VALUE: opt ? JSON.stringify(filext).replace(/\{|\}|\"/g, '') : '',
SORT_TYPE: setting.type
};
if (data === '' || (data.list && data.list.length <= 0)) {
nav.end = true;
if (nav.reload) {
$container.html(noResult);
yasparm = Object.assign(yasparm, {
PRD_LIST: '',
RES_QTY: 0
});
setTimeout(function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_BRAND_GOODS_LIST_C',
param: JSON.stringify(yasparm)
}, true);
}
}, 200);
}
} else {
if (nav.reload) {
var goodList = [];
$(data).each(function(i, goodInfo) {
if ($(goodInfo).hasClass('good-info')) {
goodList.push(goodInfo);
goodIds.push($(goodInfo).data('good-id'));
} else if ($(goodInfo).hasClass('total')) {
total = $(goodInfo).data('id');
}
});
yasparm = Object.assign(yasparm, {
PRD_LIST: JSON.stringify(goodIds).replace(/\[|\]/g, ''),
RES_QTY: total
});
setTimeout(function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_BRAND_GOODS_LIST_C',
param: JSON.stringify(yasparm)
}, true);
}
}, 200);
if (first_load) {
first_load = false;
... ... @@ -429,6 +481,32 @@ function search(opt) {
num = $container.find('.good-info').length;
$container.append(data);
if ($container.find('.total')) {
$container.find('.total').remove();
}
$container.find('.good-info:gt(' + (num - 1) + ')').each(function() {
var goodid = $(this).data('good-id');
if (goodid) {
goodIds.push(goodid);
}
});
yasparm = Object.assign(yasparm, {
PRD_LIST: total,
RES_QTY: JSON.stringify(goodIds).replace(/\[|\]/g, '')
});
setTimeout(function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_BRAND_GOODS_LIST_C',
param: JSON.stringify(yasparm)
}, true);
}
}, 200);
// lazy good-infos who append in
lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy'));
}
... ... @@ -811,3 +889,26 @@ $listNav.on('touchstart', 'li', function() {
require('../../common/footer');
require('./coupon');
//点击事件埋点
$('#goods-container').on('click', '.good-info', function() {
var PRD_ID = $(this).data('good-id'),
PRD_NUM = $(this).index() + 1,
FILTER_VALUE = filext ? JSON.stringify(filext).replace(/\{|\}|\"/g, '') : '';
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_BRAND_GOODS_LIST_C',
param: JSON.stringify({
C_ID: C_ID,
PRD_ID: PRD_ID,
PRD_NUM: PRD_NUM,
PAGE_NUM: Math.ceil(PRD_NUM / 60),
FILTER_VALUE: FILTER_VALUE,
SORT_TYPE: argument ? argument.type : ''
})
}, true);
}
// return false;
});
\ No newline at end of file
... ...