Authored by 徐炜

Merge remote-tracking branch 'origin/release/wap-optim' into release/wap-optim

... ... @@ -72,6 +72,8 @@ class Auth {
let encryptionUid = aes.encryptionUid(uid);
if (data) {
data.profile_name = (data.profile_name || '').replace(/::/g, '');
let uidCookie = `${data.profile_name}::${encryptionUid}::${data.vip_info && data.vip_info.title}::${token}`;
res.cookie('_UID', uidCookie, {
... ...
... ... @@ -415,7 +415,15 @@ const favoriteBrand = (req, res, next) => {
if (appVersion && appVersion !== 'false') {
uid = req.query.uid ? crypto.decrypt('', req.query.uid) : req.cookies.appUid;
if (req.query.uid) {
try {
uid = crypto.decrypt('', req.query.uid);
} catch (err) {
uid = req.query.uid;
}
} else {
uid = req.cookies.appUid;
}
uid = parseInt(uid, 10);
if (!uid || uid === 'undefined') {
... ...
... ... @@ -116,7 +116,7 @@ const _getShopInfo = (shopId, uid) => {
method: 'app.shops.getIntro',
shop_id: shopId,
uid: uid || 0
}, {code: 200, cache: true}).then((result) => {
}, {code: 200}).then((result) => {
return result.data;
});
};
... ... @@ -130,7 +130,7 @@ const getShopIntro = (shopId, uid) => {
method: 'app.shops.getIntro',
shop_id: shopId,
uid: uid
}, {code: 200, cache: true}).then(result => {
}, {code: 200}).then(result => {
return result.data;
});
};
... ... @@ -466,7 +466,7 @@ const _formShopData = (data, shopId, isApp) => {
}, formatData);
} else {
formatData = _.assign({
allGoods: `${helpers.urlFormat('', allGoodsParam, 'search')}&openby:yohobuy={"action":"go.list","params":{"title":"全部商品", "actiontype":"0","shop_id":${shopId},"page":"1"}}`,//eslint-disable-line
allGoods: `${helpers.urlFormat('', allGoodsParam, 'search')}&openby:yohobuy={"action":"go.list","params":{"title":"全部商品", "actiontype":"0","shop_id":${shopId}}}`,//eslint-disable-line
shopIntroHref: helpers.urlFormat('/product/index/intro', {
shop_id: shopId,
app_version: isApp
... ...
... ... @@ -153,8 +153,6 @@ const _searchGoods = (params) => {
params.app_type = 1;
}
console.log(method, params);
return api.get('', _.assign({
method: method
}, params), {
... ...
... ... @@ -151,6 +151,12 @@
</a>
</li>
</ul>
<div class='new-list classics hide'>
<ul>
<li class='active default' data-bp-id='shop_listnav_default_1'>默认</li>
<li class='new' data-bp-id='shop_listnav_new_1'>最新</li>
</ul>
</div>
</div>
<div class="discount-area first">
... ... @@ -217,12 +223,6 @@
</a>
</li>
</ul>
<div class='new-list classics hide'>
<ul>
<li class='active default' data-bp-id='shop_listnav_default_1'>默认</li>
<li class='new' data-bp-id='shop_listnav_new_1'>最新</li>
</ul>
</div>
</div>
{{> common/filter}}
{{/ shopIndex}}
... ...
... ... @@ -21,20 +21,11 @@ module.exports = {
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/'
//api: 'http://api-test3.yohops.com:9999/',
//service: 'http://service-test3.yohops.com:9999/',
//liveApi: 'http://testapi.live.yohops.com:9999/',
//singleApi: 'http://api-test3.yohops.com:9999/'
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/'
// favApi: 'http://192.168.102.31:8092/brower',
// api: 'http://192.168.102.205:8080/gateway/',
// service: 'http://192.168.102.205:8080/gateway/',
// search: 'http://192.168.102.216:8080/yohosearch/'
// api: 'http://api.yoho.yohoops.org/',
// service: 'http://service.yoho.yohoops.org/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
// api: 'http://dev-api.yohops.com:9999/',
// service: 'http://dev-service.yohops.com:9999/',
... ...
{
"name": "m-yohobuy-node",
"version": "11.11.3",
"version": "11.11.4",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -38,7 +38,7 @@ var $subNav = $('.home-sub-nav'),
brand = $('input[name="brand"]').val(),
coverChannel = $('input[name="coverChannel"]').val(),
favId = $('input[name="favId"]').val(),
uid = $('input[name="uid"]').val();
uid = window.queryString.uid;
var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
... ... @@ -70,12 +70,13 @@ var defaultOpt = require('../common/query-param');
$.ajax({
type: 'GET',
url: '/product/index/shopFav',
url: location.protocol + '//m.yohobuy.com/product/index/shopFav',
xhrFields: {
withCredentials: true
},
data: {
shopId: $('.shopId').val()
shopId: $('.shopId').val(),
uid: uid
},
success: function(data) {
if (data.collect) {
... ... @@ -123,6 +124,8 @@ var defaultOpt = require('../common/query-param');
// 切换active状态到$pre上
$pre.addClass('active');
$('#pos-list').addClass('hide');
$pre.siblings('.filter').removeClass('active');
subNavScrollTo();
}
... ... @@ -383,7 +386,10 @@ function tabChange(dom, index) {
function scrollHandler() {
function scrollHandler(e) {
if (!$('.filter-mask').hasClass('hide')) {
return;
}
var scrollCall,
sTop = $(document).scrollTop(),
scH = $('#scroller').outerHeight(),
... ... @@ -424,9 +430,15 @@ function scrollHandler() {
}
$nav2.removeClass('hide');
$nav1.addClass('hide');
if (!$newList.hasClass('hide')) {
$newList.addClass('classics');
}
} else if (sTop > nav1OffsetTop && $('#nav').length) {
$nav1.removeClass('hide');
$nav2.addClass('hide');
if (!$newList.hasClass('hide')) {
$newList.removeClass('classics');
}
} else {
$nav1.addClass('hide');
$nav2.addClass('hide');
... ... @@ -439,7 +451,8 @@ document.addEventListener('touchmove', function(e) {
// e.preventDefault();
}
if ($('.filter-mask').length && !$('.filter-mask').hasClass('hide')) {
e.preventDefault();
// e.preventDefault();
// e.stopPropagation();
}
}, false);
... ... @@ -655,7 +668,7 @@ function search(opt, callback) {
bindGoodThumbClick();
setTimeout(function() {
callback && callback();
}, 0)
}, 0);
},
error: function() {
tip.show('网络断开连接了~');
... ... @@ -699,6 +712,7 @@ $newList.on('touchstart', 'li', function(e) {
}
$newList.addClass('hide');
$('#pos-list').addClass('hide');
$firstLiDom.find('.nav-txt').text($(this).text());
$firstLiDom.attr('data-bp-id', bpIdData).addClass('active').siblings().removeClass('active');
$subNav.find('.first-li-more').removeClass('new default sale').addClass(cls);
... ... @@ -780,6 +794,11 @@ $subNav.on('touchend touchcancel', function(e) {
if ($this.hasClass('first-li-more')) {
filter.hideFilter();
$newList.toggleClass('hide');
if ($('#pos-list').hasClass('hide')) {
$newList.removeClass('classics');
} else {
$newList.addClass('classics');
}
if ($this.hasClass('default')) {
$newList.find('li.default').addClass('active').siblings().removeClass('active');
} else if ($this.hasClass('new')) {
... ... @@ -788,119 +807,133 @@ $subNav.on('touchend touchcancel', function(e) {
$newList.find('li.sale').addClass('active').siblings().removeClass('active');
}
newListHide();
if ($('#pos-list').hasClass('hide')) {
subNavScrollTo();
}
return true;
}
// 最新li 列表
$newList.addClass('hide');
if ($this.hasClass('filter')) {
} else {
// 最新li 列表
$newList.addClass('hide');
// 筛选面板切换状态
if ($this.hasClass('active') && !$('.filter-mask').hasClass('hide')) {
$('.home-sub-nav>li.filter').removeClass('active');
$this.removeClass('active');
filter.hideFilter();
} else {
$('.home-sub-nav>li.filter').addClass('active');
$this.addClass('active');
if ($this.hasClass('filter')) {
filter.showFilter();
// 筛选面板切换状态
if ($this.hasClass('active') && !$('.filter-mask').hasClass('hide')) {
$('.home-sub-nav>li.filter').removeClass('active');
$this.removeClass('active');
filter.hideFilter();
if ($this.closest('.pos-list').length > 0) {
$('.filter-mask').addClass('call-by-fix').css('top', '');
} else {
$('.filter-mask').removeClass('call-by-fix').css('top', $this.offset().top + nav1H);
}
$('.home-sub-nav>li.filter').addClass('active');
$this.addClass('active');
}
if ($('#pos-list').hasClass('hide')) {
subNavScrollTo();
}
} else {
filter.showFilter();
filter.hideFilter();// 隐藏面板
if ($this.hasClass('new')) {
cname = '.new';
navType = 'newest';
} else if ($this.hasClass('price')) {
cname = '.price';
navType = 'price';
} else if ($this.hasClass('discount')) {
cname = '.discount';
navType = 'discount';
} else if ($this.hasClass('default')) {
cname = '.default';
navType = 'default';
}
nav = navInfo[navType];
var reloadCb = function() {
$goodsContainer.children('.container:not(.hide)').addClass('hide');
switch (navType) {
case 'newest':
$ngc.removeClass('hide');
break;
case 'price':
$pgc.removeClass('hide');
break;
if ($this.closest('.pos-list').length > 0) {
$('.filter-mask').addClass('call-by-fix').css('top', '');
} else {
$('.filter-mask').removeClass('call-by-fix').css('top', $this.offset().top + nav1H);
}
if ($('#pos-list').hasClass('hide')) {
$('#pos-list').removeClass('hide');
}
case 'discount':
$dgc.removeClass('hide');
break;
case 'default':
$defaultgc.removeClass('hide');
break;
default:
break;
}
}
if ($this.hasClass('active')) {
} else {
filter.hideFilter();// 隐藏面板
// 最新无排序切换
if ($this.hasClass('new')) {
return;
cname = '.new';
navType = 'newest';
} else if ($this.hasClass('price')) {
cname = '.price';
navType = 'price';
} else if ($this.hasClass('discount')) {
cname = '.discount';
navType = 'discount';
} else if ($this.hasClass('default')) {
cname = '.default';
navType = 'default';
}
if ($this.hasClass('price') || $this.hasClass('discount')) {
$this = $subNav.find(cname);
nav = navInfo[navType];
var reloadCb = function() {
$goodsContainer.children('.container:not(.hide)').addClass('hide');
switch (navType) {
case 'newest':
$ngc.removeClass('hide');
break;
case 'price':
$pgc.removeClass('hide');
break;
case 'discount':
$dgc.removeClass('hide');
break;
case 'default':
$defaultgc.removeClass('hide');
break;
default:
break;
}
};
// 价格/折扣切换排序状态
$this.find('.icon > .iconfont').toggleClass('cur');
nav.reload = true; // 重置reload,HTML会被替换为逆序的HTML
nav.order = nav.order === 0 ? 1 : 0; // 切换排序
if ($this.hasClass('active')) {
}
} else {
$active = $subNav.find('.active');
// 最新无排序切换
if ($this.hasClass('new')) {
return;
}
if ($active.hasClass('filter')) {
if ($this.hasClass('price') || $this.hasClass('discount')) {
$this = $subNav.find(cname);
// 若之前active项为筛选,则隐藏筛选面板
filter.hideFilter();
}
$subNav.children().removeClass('active');
$subNav.find(cname).addClass('active');
}
if (!$('#pos-list').hasClass('hide')) {
subNavScrollTo();
// 价格/折扣切换排序状态
$this.find('.icon > .iconfont').toggleClass('cur');
nav.reload = true; // 重置reload,HTML会被替换为逆序的HTML
nav.order = nav.order === 0 ? 1 : 0; // 切换排序
}
} else {
$active = $subNav.find('.active');
if ($active.hasClass('filter')) {
// 若之前active项为筛选,则隐藏筛选面板
filter.hideFilter();
}
$subNav.children().removeClass('active');
$subNav.find(cname).addClass('active');
}
if (!$('#pos-list').hasClass('hide')) {
subNavScrollTo();
}
if (nav.reload) {
search({
type: 'shop_id',
id: shopId,
brand: brand,
appVersion: appVersion,
url: '/product/search/search',
nextPage: false
}, reloadCb);
}
}
if (nav.reload) {
search({
type: 'shop_id',
id: shopId,
brand: brand,
appVersion: appVersion,
url: '/product/search/search',
nextPage: false
}, reloadCb);
}
if ($('#list-nav').offset().top > $(document).scrollTop() && $('.filter-mask').hasClass('hide')) {
if ($this.hasClass('first-li-more') && !$('#pos-list').hasClass('hide')) {
if ($('.new-list').hasClass('hide')) {
$('.new-list').removeClass('full-height');
$('#pos-list').addClass('hide');
} else {
$('.new-list').addClass('full-height');
}
} else {
$('#pos-list').addClass('hide');
}
} else {
$('.new-list').removeClass('full-height');
}
e.stopPropagation();
});
... ... @@ -945,7 +978,7 @@ $collect.on('touchstart', function() {
$.ajax({
method: 'get',
url: '' + '/product/opt/favoriteBrand',
url: location.protocol + '//m.yohobuy.com/product/opt/favoriteBrand',
data: {
id: favId ? favId : shopId,
appVersion: appVersion,
... ...
... ... @@ -9,6 +9,12 @@
&.new-shop {
position: initial;
overflow: initial;
#pos-nav {
z-index: 99;
}
#pos-list {
z-index: 100;
}
#pos-nav, #pos-list {
position: fixed;
left: 0;
... ... @@ -619,12 +625,15 @@
font-size: 28px;
color: #444;
position: absolute;
z-index: 5;
z-index: 102;
&.classics {
position: fixed;
top: 81px;
top: 80px;
left: 0px;
}
&.full-height {
height: 100%;
}
li {
margin-left: 35px;
height: 88px;
... ... @@ -642,10 +651,19 @@
}
}
}
.no-result {
margin-top: 320px;
color: #ccc;
vertical-align: middle;
text-align: center;
font-size: 1.2em;
}
}
.shop-index + .filter-mask {
margin-top: 1px;
z-index: 101;
.filter-body {
overflow: auto;
... ...