Authored by 姜枫

merge from shop-optim

... ... @@ -237,6 +237,7 @@ const shop = {
return _.split(uidString, '=')[1];
},
/**
* TODO TAR 店铺和品牌收藏状态调用新的接口
* 基础模板收藏
... ... @@ -255,6 +256,7 @@ const shop = {
res.json(Object.assign({code: 200}, result));
}).catch(next);
},
/**
* TODO TAR 店铺和品牌收藏状态调用新的接口
* @param req
... ... @@ -263,8 +265,9 @@ const shop = {
brandFav(req, res, next) {
let brandId = req.query.brandId;
let uid = req.user.uid;
if (!brandId) {
return res.json({code: 404})
return res.json({code: 404});
}
return listModel.getBrandIntro(brandId, uid).then(result => {
res.json(result);
... ... @@ -272,6 +275,7 @@ const shop = {
},
shopHotList(req, res, next) {
let skns = req.query.skns;
return listModel.searchProductBySkn(skns).then(hotList => {
hotList = productProcess.processProductList(hotList, {isApp: req.yoho.isApp});
_.forEach(hotList, (value, key) => {
... ... @@ -287,6 +291,7 @@ const shop = {
}).catch(next);
}
};
/**
* 从 useragent 获取 uid
* @returns {*}
... ...
... ... @@ -45,6 +45,7 @@ var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
require('../common');
// 默认筛选条件
var defaultOpt = require('../common/query-param');
... ... @@ -53,7 +54,7 @@ var defaultOpt = require('../common/query-param');
var param = location.search;
var isApp = param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1;
//不阻塞字体文件加载
// 不阻塞字体文件加载
setTimeout(function() {
if (isApp) {
$.ajax({
... ... @@ -97,7 +98,7 @@ var defaultOpt = require('../common/query-param');
skns: $('.popularity-title').data('skns'),
},
success: function(data) {
$('.product-warp>.goods-container').html(data)
$('.product-warp>.goods-container').html(data);
},
error: function() {
tip.show('网络断开连接了~');
... ... @@ -128,7 +129,7 @@ var defaultOpt = require('../common/query-param');
});
}
});
}, 0)
}, 0);
}());
... ... @@ -237,6 +238,7 @@ function getPageGoods(info) {
navType = info.data.type;
nav = navInfo[navType];
// 不需要重新加载并且数据请求结束
if (nav.end && toTop) {
toTop = false;
... ... @@ -296,6 +298,7 @@ function newData(callback) {
callback && $.isFunction(callback) && callback();
};
var result = getPageGoods(req);
if (!result) {
callback && callback();
}
... ... @@ -324,6 +327,7 @@ function hotData(callback) {
callback && $.isFunction(callback) && callback();
};
var result = getPageGoods(req);
if (!result) {
callback && callback();
}
... ... @@ -340,8 +344,9 @@ function tabChange(dom, index) {
// 首页导航
(function(nav, posNav, main) {
var scrollToNav1 = function() {
window.scrollTo(0, $('#nav').offset().top + 5)
}
window.scrollTo(0, $('#nav').offset().top + 5);
};
$(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function() {
var index = $(this).index(),
activeTab = $(this).attr('tab');
... ... @@ -384,7 +389,9 @@ function scrollHandler() {
nav2OffsetTop = $('#list-nav').length ? $('#list-nav').offset().top : 0;
var tra;
//分页加载店铺商品列表
// 分页加载店铺商品列表
if (sTop > scH - winH * 2 && viewType === 1) {
if ($pre !== undefined) {
search({
... ... @@ -397,7 +404,7 @@ function scrollHandler() {
}
}
//分页加载“上新”和“人气”商品数据
// 分页加载“上新”和“人气”商品数据
if (sTop + winH * 2 > scH) {
switch (viewType) {
case 2:
... ... @@ -427,7 +434,7 @@ function scrollHandler() {
document.addEventListener('touchmove', function(e) {
// sub classify不阻止默认事件
if ($(e.target).closest('.sub-classify').length === 0) {
//e.preventDefault();
// e.preventDefault();
}
if ($('.filter-mask').length && !$('.filter-mask').hasClass('hide')) {
e.preventDefault();
... ... @@ -453,7 +460,7 @@ $(window).ready(function() {
scH = $('#scroller').outerHeight();
}, 500);
$(document).scroll(scrollHandler)
$(document).scroll(scrollHandler);
lazyLoad($('img.lazy'));
});
... ... @@ -723,6 +730,7 @@ $newList.on('touchstart', 'li', function(e) {
}
$pre = $('.first-li-more');
var nav = navInfo[navType];
if (nav.reload) {
search({
type: 'shop_id',
... ... @@ -745,7 +753,7 @@ $(document).on('touchstart', function(e) {
}
});
function subNavScrollTo() {
window.scrollTo(0, $('#list-nav').offset().top + 5)
window.scrollTo(0, $('#list-nav').offset().top + 5);
}
$subNav.on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li'),
... ... @@ -775,6 +783,7 @@ $subNav.on('touchend touchcancel', function(e) {
subNavScrollTo();
return true;
}
// 最新li 列表
$newList.addClass('hide');
... ...
... ... @@ -90,7 +90,7 @@ ellipsis.init();
},
dataType: 'json',
success: function(data) {
$('.con').text(data.intro)
$('.con').text(data.intro);
if (data.collected) {
$('.brand-header .btn-col').addClass('coled');
}
... ... @@ -110,7 +110,7 @@ ellipsis.init();
if (data.is_favorite === 'Y') {
$('.brand-header .btn-col').addClass('coled');
}
$('.con').text(data.shop_intro)
$('.con').text(data.shop_intro);
},
error: function() {
tip.show('网络断开连接了~');
... ... @@ -413,9 +413,11 @@ function search(opt) {
goodList.push(goodInfo);
}
});
if (first_load) {
first_load = false;
//移除头四个
// 移除头四个
goodList.splice(0, 4);
$container.append(goodList);
} else {
... ... @@ -580,6 +582,7 @@ $newList.on('touchstart', 'li', function(e) {
}
$pre = $('.first-li-more');
var nav = navInfo[navType];
if (nav.reload) {
search();
}
... ... @@ -613,6 +616,7 @@ $listNav.on('touchend touchcancel', function(e) {
newListHide();
return true;
}
// 最新li 列表
$newList.addClass('hide');
... ...