Authored by runner

Merge branch 'release/4.6' of http://git.yoho.cn/fe/yohobuywap-node into release/4.6

... ... @@ -57,7 +57,7 @@ exports.index = (req, res, next) => {
let params = processPublicData(req, 'SALE', 'sale');
saleModel.getSaleData(params.channel).then((result) => {
res.render('sale/index', Object.assign(params.renderData, {
res.render('sale/index', Object.assign(params.renderData, {
content: result,
floorHeader: {
title: {
... ...
... ... @@ -19,6 +19,8 @@ var $goodsContainer = $('#goods-container'),
$shoesgc = $($goodsChildren.get(2)),
$othergc = $($goodsChildren.get(3));
var $filterMask;
var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
... ... @@ -310,30 +312,44 @@ function search(opt) {
}
$.ajax({
type: 'GET',
url: '/product/sale/filter',
data: $.extend(defaultOpt, {
saleType: '1'
}),
success: function(data) {
$goodsContainer.append(data);
// 初始化filter&注册filter回调
filter.initFilter({
fCbFn: search,
hCbFn: function() {
// 切换active状态到$pre上
$pre.addClass('active');
$pre.siblings('.filter').removeClass('active');
$('#size-swiper-' + $pre.index()).show();
},
missStatus: true
});
}
});
// 筛选初始化
function filterInit() {
$.ajax({
type: 'GET',
url: '/product/sale/filter',
data: $.extend(defaultOpt, {
saleType: '1'
}),
success: function(data) {
if ($filterMask) {
$filterMask.remove();
}
$goodsContainer.append(data);
$filterMask = $('.filter-mask');
// 初始化filter&注册filter回调
filter.initFilter({
fCbFn: search,
hCbFn: function() {
// 切换active状态到$pre上
$pre.addClass('active');
$pre.siblings('.filter').removeClass('active');
$('#size-swiper-' + $pre.index()).show();
},
missStatus: true
});
}
});
}
filterInit();
lazyLoad($('.lazy'));
$listNav.bind('contextmenu', function() {
... ... @@ -376,6 +392,9 @@ $listNav.on('touchend touchcancel', function(e) {
if ($this.attr('class') !== $pre.attr('class')) {
// 重置筛选项
filter.resetFilter();
$('.classify .shower').removeClass('default');
filterInit();
defaultOpt = $.extend({}, storeOpt);
}
$pre = $this; // $pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项
... ... @@ -407,10 +426,6 @@ $listNav.on('touchend touchcancel', function(e) {
default:
break;
}
// 重置筛选项
filter.resetFilter();
defaultOpt = $.extend({}, storeOpt);
}
$active.removeClass('active');
... ...