Authored by htoooth

Merge branch 'feature/collectListYas' into release/5.2

# Conflicts:
#	config/common.js
... ... @@ -297,7 +297,8 @@ const getBrandData = (params, extra, channel) => {
brand: {
brandBanner: searchHandler.handleBrandBanner(extra),
leftContent: {},
node: extra.node || ''
node: extra.node || '',
brandId: extra.brandId
}
};
... ...
... ... @@ -648,6 +648,7 @@ exports.handleFilterData = (origin, params, total) => {
};
dest.checkedConditions.conditions.push({
name: name,
itemType: 'price',
href: handleFilterUrl(params, {}, {price: true})
});
}
... ... @@ -838,7 +839,8 @@ exports.handleSeniorFilterData = (data, params) => {
});
_.forEach(data.standard, value => {
let sub = [];
let sub = [],
standardName = value.standard_name;
// let parKey = `parameter_${value.standard_id}`;
... ... @@ -848,6 +850,7 @@ exports.handleSeniorFilterData = (data, params) => {
if (ched) {
conditions.push({
name: subValue.standard_name,
itemType: standardName,
href: handleFilterUrl(params, {
standard: getStandard(qStandard, null, {
k: value.standard_id,
... ... @@ -910,7 +913,6 @@ exports.handleFilterDataAll = (data, qs) => {
Object.assign(destFilter, seniorFilter, baseFilter);
_.set(destFilter, 'checkedConditions.conditions', conditions);
return destFilter;
};
... ... @@ -1009,7 +1011,8 @@ exports.handlePathNavData = (data, params, page, channel) => {
break;
}
return {
pathNav: pathNav
pathNav: pathNav,
listType: page
};
};
... ...
... ... @@ -17,15 +17,14 @@ module.exports = {
cookieDomain: '.yohobuy.com',
domains: {
favApi: 'http://192.168.102.31:8092/brower',
// api: 'http://api-test1.yohops.com:9999/',
// service: 'http://service-test1.yohops.com:9999/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
api: 'http://dev-api.yohops.com:9999/',
service: 'http://dev-service.yohops.com:9999/',
//api: 'http://dev-api.yohops.com:9999/',
//service: 'http://dev-service.yohops.com:9999/',
search: 'http://192.168.102.216:8080/yohosearch/'
},
... ... @@ -104,7 +103,7 @@ module.exports = {
}
},
apiCache: {
cache: true
cache: false
},
zookeeperServer: '192.168.102.168:2188'
};
... ...
{{# footPager}}
<div class="foot-pager clearfix">
<div class="foot-pager clearfix" data-total={{../totalCount}}>
<span class="total">
{{# tip}}
{{#if totalText}}
... ...
{{#if pathNav}}
<p class="path-nav">
<p class="path-nav" listType="{{listType}}" brandId="{{brandId}}">
{{#each pathNav}}
{{#if name}}
{{#if href}}
... ...
... ... @@ -6,7 +6,7 @@
<span class="title">已选条件:</span>
<div class="attr-content clearfix">
{{#each conditions}}
<a class="tag" href="{{href}}">
<a class="tag" href="{{href}}" name="{{name}}" itemType="{{itemType}}">
{{#if name}}
{{name}}
{{^}}
... ... @@ -28,7 +28,7 @@
<div class="attr-content clearfix">
{{#each channel}}
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}" name="{{name}}">
{{name}}
</a>
{{/each}}
... ... @@ -42,7 +42,7 @@
<div class="attr-content clearfix">
{{#each gender}}
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}" name="{{name}}">
{{name}}
</a>
{{/each}}
... ... @@ -58,7 +58,7 @@
<ul class="sort-pre clearfix">
{{#each sort}}
<li data-id="{{id}}">
<span class="attr {{#if checked}}checked{{/if}}">
<span class="attr {{#if checked}}checked{{/if}}" name="{{name}}">
{{name}}
<div class="sort-up-icon"></div>
</span>
... ... @@ -70,7 +70,7 @@
{{#each sort}}
<ul class="sort-sub clearfix hide">
{{#each sub}}
<li class="attr {{#if checked}}checked{{/if}}">
<li class="attr {{#if checked}}checked{{/if}}" name="{{name}}">
<a href="{{href}}">{{name}}</a>
</li>
{{/each}}
... ... @@ -88,7 +88,7 @@
<div class="attr-content clearfix">
{{#each misort}}
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}" name="{{name}}">
{{name}}
</a>
{{/each}}
... ... @@ -136,7 +136,7 @@
<div class="attr-content clearfix">
{{#each ageLevel}}
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}" name="{{name}}">
{{name}}
</a>
{{/each}}
... ... @@ -150,7 +150,7 @@
<div class="attr-content clearfix">
{{# price}}
<a class="attr{{#if checked}} checked{{/if}}" href="{{href}}">{{name}}</a>
<a class="attr{{#if checked}} checked{{/if}}" href="{{href}}" name="{{name}}">{{name}}</a>
{{/ price}}
<div class="ud-price-range">
... ... @@ -166,12 +166,12 @@
{{/if}}
{{#if discount}}
<div class="price section">
<div class="discount section">
<span class="title">折扣:</span>
<div class="attr-content clearfix">
{{# discount}}
<a class="attr{{#if checked}} checked{{/if}}" href="{{href}}">¥{{name}}</a>
<a class="attr{{#if checked}} checked{{/if}}" href="{{href}}" name="{{name}}">¥{{name}}</a>
{{/ discount}}
</div>
</div>
... ... @@ -184,7 +184,7 @@
<div class="attr-content clearfix">
{{# color}}
<a class="attr{{#if checked}} checked{{/if}}" href="{{href}}">
<a class="attr{{#if checked}} checked{{/if}}" href="{{href}}" name="{{name}}">
{{#if checked}}
<span class="color-block">
<i class="sub-color-block" style="background: {{rgb}}"></i>
... ... @@ -204,7 +204,7 @@
<div class="attr-content clearfix">
{{# size}}
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a>
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}" name="{{name}}">{{name}}</a>
{{/ size}}
</div>
</div>
... ...
... ... @@ -2,6 +2,7 @@
{{#if product_id}}
<span class="hide product-id">{{product_id}}</span>
{{/if}}
<span class="hide shelve-time">{{shelve_time}}</span>
<div class="tag-container clearfix">
{{# tags}}
{{# is_new_festival}}
... ...
/**
* Created by DELL on 2016.11.9.
*/
var $ = require('yoho-jquery');
function getCookie(name) {
var arr, reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)');
if (arr === document.cookie.match(reg)) {
return unescape(arr[2]);
} else {
return null;
}
}
// 频道、性别、品类、折扣、人群、颜色、尺码、分类
function _getCommonFilterValue() {
var $section = $('.channel, .sort, .discount, .misort, .color, .size');
var $attrchecked = $section.find('.attr-content .attr.checked');
var filterValue = '';
$attrchecked.each(function() {
var $this = $(this);
var key = $this.parents('.attr-content').prev().html(),
name = $this.attr('name');
filterValue += key + name + ';';
});
return filterValue;
}
// 价格、品牌、高级筛选
function _getOtherFilterValue() {
var filterValue = '';
$('.checked-conditions .attr-content .tag').each(function() {
var type = $(this).attr('itemType'),
name = $(this).attr('name');
switch (type) {
case 'brands':
type = '品牌';
break;
case 'price':
type = '价格';
break;
default:
break;
}
filterValue += type + ':' + name + ';';
});
return filterValue;
}
/** *埋点方法***/
function givePoint(op, parameter) {
var CID = 1;
if (!window._yas || !window._yas.sendCustomInfo) {
return false;
}
if (!getCookie('_Channel')) {
// 男:1,女:2,潮童:3,创意生活:4
switch (getCookie('_Channel')) {
case 'boys':
CID = 1;
break;
case 'girls':
CID = 2;
break;
case 'kids':
CID = 3;
break;
case 'lifestyle':
CID = 4;
break;
default:
CID = 1;
}
}
parameter = $.extend({
C_ID: CID
}, parameter);
console.info(parameter);
window._yas.sendCustomInfo({
op: op,
param: JSON.stringify(parameter)
}, true);
}
function getFilterValue() {
return _getCommonFilterValue() + _getOtherFilterValue();
}
exports.givePoint = givePoint;
exports.getFilterValue = getFilterValue;
... ...
... ... @@ -9,9 +9,11 @@
* 页面已经被 nginx 缓存,变化后的数据需要通过 ajax 进行获取后,重新绑定事件。
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
dataLazyLoad = require('../plugins/lazy-load')(document);
var $ = require('yoho-jquery');
var lazyLoad = require('yoho-jquery-lazyload');
var yas = require('../common/data-yas');
var dataLazyLoad = require('../plugins/lazy-load')(document);
var bindEvent = $.Callbacks(); // eslint-disable-line
var clickAcquireCouponEvent = $.Callbacks('unique'); // eslint-disable-line
... ... @@ -449,12 +451,18 @@ bindEvent.add(function() {
// 收藏
$('#collect-product').click(function() {
var $this = $(this),
cancel;
cancel,
coltyp;
if ($this.hasClass('coled')) {
cancel = true;
}
coltyp = cancel ? 2 : 1;
// 收藏埋點
yas.givePoint('YB_COLLECTION_C', {PRD_ID: id, COL_TYP: coltyp });
$.ajax({
type: 'POST',
url: '/product/item/togglecollect',
... ...
... ... @@ -99,7 +99,6 @@ exports.init = function(num) {
containerPt, // 商品列表容器的上内边距
_from = event.target.attr('data-from') || '';
pics = [];
event.target.find('.hideList > li').each(function() {
pic = $(this).data();
... ... @@ -138,6 +137,7 @@ exports.init = function(num) {
if (diffWidth <= 0) {
wrapperX = wrapperX + diffWidth - 25;
}
$goodItemWrapper.attr('activeIndex', event.activeIndex);
$goodItemWrapper.css({
width: wrapperWidth,
left: wrapperX,
... ...
... ... @@ -3,10 +3,30 @@
* @author: sefon 2016-7-12 15:28:22
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
var $ = require('yoho-jquery');
var yas = require('../common/data-yas');
var lazyLoad = require('yoho-jquery-lazyload');
var product = require('./index/product');
var qs = {};
var $footPage = $('.foot-pager1').data('total'),
$productIdArr = [],
$leftUl = $('.sort-container .sort-child-list'),
$leftLi = $leftUl.find('li.active');
var listType = $('.path-nav').attr('listType'),
brandId = $('.path-nav').attr('brandId');
var filterValue = yas.getFilterValue();
var commonParams = {};
$('.good-info .product-id').each(function() {
$productIdArr.push($(this).html());
});
require('../common');
require('../plugins/filter');
... ... @@ -22,3 +42,88 @@ product.init(4);
lazyLoad($('img.lazy'), {
failure_limit: 20
});
qs = window.queryString();
commonParams = {
PAGE_NUM: qs.pager || 1,
FILTER_VALUE: filterValue,
L1_SORT: $leftLi.length > 0 ? $leftLi.parent().prev().attr('title') : '',
L2_SORT: $leftLi.find('a').attr('title') || '',
SORT_TYPE: qs.order || 's_n_desc'
};
// 时间戳格式化
function getLocalTime(nS) {
return new Date(parseInt(nS, 10) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
}
/*
* 页面加载完
*/
$(function() {
var sto = setInterval(function() {
var loadYas = {};
if (window._yas && window._yas.sendCustomInfo) {
loadYas = {
RES_QTY: $footPage || 0,
PRD_LIST: $productIdArr.join(',')
};
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
break;
case 'new':
loadYas.SHELF_TIME = 'ALL';
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 关键词搜索结果页展示时
yas.givePoint('YB_KEYWORD_GOODS_LIST_L', loadYas);
clearInterval(sto);
}
}, 100);
// 点击搜索列表商品
$('.good-item-wrapper').click(function() {
var $this = $(this),
proId = $this.find('.product-id').html(),
aIndex = $this.attr('activeIndex'),
pageNum = qs.pager || 1,
limit = qs.limit || 60,
proNum = (parseInt(pageNum, 10) - 1) * limit + parseInt(aIndex, 10),
shelveTime = $this.find('.shelve-time').html();
var loadYas = {
PRD_ID: proId,
PRD_NUM: proNum
};
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
break;
case 'new':
loadYas.SHELF_TIME = getLocalTime(shelveTime);
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 点击搜索列表商品埋点
yas.givePoint('YB_KEYWORD_GOODS_LIST_C', loadYas);
});
});
... ...
... ... @@ -3,10 +3,30 @@
* @author: sefon 2016-7-12 15:28:22
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
var $ = require('yoho-jquery');
var yas = require('../common/data-yas');
var lazyLoad = require('yoho-jquery-lazyload');
var product = require('./index/product');
var qs = {};
var $footPage = $('.foot-pager1').data('total'),
$productIdArr = [],
$leftUl = $('.sort-container .sort-child-list'),
$leftLi = $leftUl.find('li.active');
var listType = $('.path-nav').attr('listType'),
brandId = $('.path-nav').attr('brandId');
var filterValue = yas.getFilterValue();
var commonParams = {};
$('.good-info .product-id').each(function() {
$productIdArr.push($(this).html());
});
require('../common');
require('../plugins/filter');
... ... @@ -15,6 +35,93 @@ require('./detail/latest-walk');
product.init(4);
lazyLoad($('img.lazy'), {
failure_limit: 20
});
qs = window.queryString();
commonParams = {
PAGE_NUM: qs.pager || 1,
FILTER_VALUE: filterValue,
L1_SORT: $leftLi.length > 0 ? $leftLi.parent().prev().attr('title') : '',
L2_SORT: $leftLi.find('a').attr('title') || '',
SORT_TYPE: qs.order || 's_n_desc'
};
// 时间戳格式化
function getLocalTime(nS) {
return new Date(parseInt(nS, 10) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
}
/*
* 页面加载完
*/
$(function() {
var sto = setInterval(function() {
var loadYas = {};
if (window._yas && window._yas.sendCustomInfo) {
loadYas = {
RES_QTY: $footPage || 0,
PRD_LIST: $productIdArr.join(',')
};
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
break;
case 'new':
loadYas.SHELF_TIME = 'ALL';
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 关键词搜索结果页展示时
yas.givePoint('YB_KEYWORD_GOODS_LIST_L', loadYas);
clearInterval(sto);
}
}, 100);
// 点击搜索列表商品
$('.good-item-wrapper').click(function() {
var $this = $(this),
proId = $this.find('.product-id').html(),
aIndex = $this.attr('activeIndex'),
pageNum = qs.pager || 1,
limit = qs.limit || 60,
proNum = (parseInt(pageNum, 10) - 1) * limit + parseInt(aIndex, 10),
shelveTime = $this.find('.shelve-time').html();
var loadYas = {
PRD_ID: proId,
PRD_NUM: proNum
};
switch (listType) {
case 'search':
loadYas.KEYWORD = qs.query || '';
break;
case 'brand':
loadYas.BRAND_ID = brandId;
break;
case 'new':
loadYas.SHELF_TIME = getLocalTime(shelveTime);
break;
default:// 品类查找sort
loadYas.CATEGORY_ID = qs.misort || qs.msort || '';
break;
}
loadYas = $.extend(loadYas, commonParams);
// 点击搜索列表商品埋点
yas.givePoint('YB_KEYWORD_GOODS_LIST_C', loadYas);
});
});
... ...