Authored by 陈轩

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

'use strict';
const utils = '../../../utils';
const productNameProcess = require(`${utils}/product-name-process`);
const serviceApi = global.yoho.ServiceAPI;
const api = global.yoho.API;
... ...
... ... @@ -27,7 +27,8 @@ const payCod = (req, res, next) => {
uid: req.user.uid,
udid: req.sessionID || require('md5')(req.ip) || 'yoho',
orderCode: req.query.order_code,
contentCode: '05afedf76886d732573f10f7451a1703'
contentCode: '05afedf76886d732573f10f7451a1703',
client_id: req.cookies._yasvd || ''
};
// 如果没有uid,跳转到首页
... ...
... ... @@ -32,7 +32,8 @@ const _getOthersBuy2 = (param) => {
productSkn: param.skn,
udid: param.uid,
rec_pos: '100005',
limit: 2
limit: 2,
client_id: param.client_id
}, {
code: 200
}).then((result) => {
... ...
... ... @@ -18,7 +18,6 @@ let _renderData = {
searchUrl: helpers.urlFormat('/search', null, 'search')
},
maybeLike: true,
showFooterTab: footerModel.getUrlData('home'),
pageFooter: true
};
... ... @@ -30,7 +29,6 @@ let _renderData = {
* @return {[type]}
*/
let _channelPage = (req, res, data) => {
let gender = req.cookies._Channel || 'boys';
return channelModel.getChannelData({
gender: data.gender,
uid: _.toString(req.user.uid),
... ... @@ -53,8 +51,19 @@ let _channelPage = (req, res, data) => {
// }
// }].concat(result.content);
// console.log(result.content[9]);
let gender;
if (data.gender === 'boys') {
gender = '1,3';
} else if (data.gender === 'girls') {
gender = '2,3';
} else {
gender = '1,2,3';
}
res.render('channel', Object.assign({}, _renderData, data, result, {
localCss: true
localCss: true,
showFooterTab: footerModel.getUrlData('home', gender),
}));
});
};
... ...
... ... @@ -154,13 +154,11 @@ const pageData = (req, res, next) => {
*/
const index = (req, res, next) => {
let gender = req.cookies._Channel || 'boys';
let responseData = {
module: 'guang',
page: 'index',
title: '逛 | Yoho!Buy有货 | 潮流购物逛不停',
showFooterTab: footerModel.getUrlData('guang', gender)
showFooterTab: footerModel.getUrlData('guang')
};
let param = {
... ...
... ... @@ -23,8 +23,6 @@ exports.index = (req, res, next) => {
udid: require('md5')(req.ip)
};
let gender = req.cookies._Channel || 'boys';
indexModel.index(params).then(result => {
if (result) {
res.render('home', Object.assign(result, {
... ... @@ -36,7 +34,7 @@ exports.index = (req, res, next) => {
pageChannel: {
boys: true
},
showFooterTab: footerModel.getUrlData('mine', gender)
showFooterTab: footerModel.getUrlData('mine')
}));
}
}).catch(next);
... ...
... ... @@ -20,8 +20,9 @@ const mayLike = (req, res, next) => {
let udid = req.sessionID || 'yoho';
let recPos = req.query.rec_pos || 100001;
let channel = req.cookies._Channel && yhChannel[req.cookies._Channel] || 1;
let client_id = req.cookies._yasvd || '';
return mayLikeModel.mayLike(uid, page, limit, gender, udid, recPos, channel).then((result) => {
return mayLikeModel.mayLike(uid, page, limit, gender, udid, recPos, channel, client_id).then((result) => {
res.render('recom/maybe-like', Object.assign({
layout: false,
... ...
... ... @@ -8,14 +8,16 @@ exports.userCenter = (req, res, next) => {
var udid = req.sessionID,
uid = req.user.uid || 0,
yhChannel = req.query.yh_channel || '1',
limit = 30;
limit = 30,
client_id = req.cookies._yasvd || '';
recommendForYouModel.getPreference({
yh_channel: yhChannel,
udid: udid,
limit: limit,
rec_pos: '100004',
uid: uid
uid: uid,
client_id: client_id,
}).then((preferenceData) => {
if (preferenceData.code === 200) {
// 获取信息成功
... ... @@ -30,10 +32,12 @@ exports.userCenter = (req, res, next) => {
};
exports.cart = (req, res, next) => {
var udid = req.sessionID,
let udid = req.sessionID,
uid = req.user.uid || 0,
yhChannel = req.query.yh_channel || '1',
limit = 30;
limit = 30,
client_id = req.cookies._yasvd || '';
if (_.get(req, 'app.locals.wap.cart.removePrefer', false)) {
return res.send('');
}
... ... @@ -42,7 +46,8 @@ exports.cart = (req, res, next) => {
udid: udid,
limit: limit,
rec_pos: '100003',
uid: uid
uid: uid,
client_id: client_id
}).then((preferenceData) => {
if (preferenceData.code === 200) {
... ...
'use strict';
const utils = '../../../utils';
const productNameProcess = require(`${utils}/product-name-process`);
const api = global.yoho.API;
const _ = require('lodash');
... ...
... ... @@ -7,6 +7,7 @@
'use strict';
const _ = require('lodash');
const utils = '../../../utils';
const productNameProcess = require(`${utils}/product-name-process`);
const api = global.yoho.API;
... ...
... ... @@ -5,7 +5,7 @@ const logger = global.yoho.logger;
const utils = '../../../utils';
const productProcess = require(`${utils}/product-process`);
const mayLike = (uid, page, limit, gender, udid, recPos, channel) => {
const mayLike = (uid, page, limit, gender, udid, recPos, channel, clientId) => {
return api.get('', {
method: 'app.search.newLast7day',
uid: uid,
... ... @@ -14,7 +14,8 @@ const mayLike = (uid, page, limit, gender, udid, recPos, channel) => {
udid: udid,
rec_pos: recPos,
yh_channel: channel,
gender: gender
gender: gender,
client_id: clientId
}).then((result) => {
if (result && result.code === 200) {
... ... @@ -59,7 +60,7 @@ const mayLikeKids = (page, limit, channel) => {
});
};
const mayLikelife = (page, limit, channel) => {
const mayLikelife = (page, limit) => {
return api.get('', {
method: 'app.search.lifeStyle',
page: page,
... ... @@ -78,7 +79,7 @@ const mayLikelife = (page, limit, channel) => {
build.goods = productProcess.processProductList(result.data.product_list.top, {showTags: false});
formData.goodsContainer.push(build);
formData.goodsContainer.push(build);
}
if (result.data.product_list.top) {
... ... @@ -90,8 +91,8 @@ const mayLikelife = (page, limit, channel) => {
formData.goodsContainer.push(build);
}
// console.log(formData)
return formData;
return formData;
} else {
logger.error('mayLikelife code no 200');
... ...
'use strict';
const utils = '../../../utils';
const productNameProcess = require(`${utils}/product-name-process`);
var api = global.yoho.API;
const helpers = global.yoho.helpers;
... ...
... ... @@ -139,6 +139,7 @@
{{> common/goods}}
{{/@root.firstPageGoodsList}}
</div>
<div class="search-divide">正在加载...</div>
<div class="default-goods container clearfix"></div>
<div class="new-goods container clearfix"></div>
<div class="sale-goods container clearfix"></div>
... ...
... ... @@ -8,11 +8,11 @@
const helpers = global.yoho.helpers;
exports.getUrlData = function(type) {
exports.getUrlData = function(type, gender) {
const urlData = {
indexUrl: helpers.urlFormat('/?go=1'), // 首页
categoryUrl: helpers.urlFormat('/cate'), // 分类
guangUrl: helpers.urlFormat('', null, 'guang'), // 逛首页
guangUrl: helpers.urlFormat('', gender ? {gender: gender} : null, 'guang'), // 逛首页
shoppingCartUrl: helpers.urlFormat('/cart/index/index'), // 购物车
mineUrl: helpers.urlFormat('/home') // 个人中心
};
... ...
... ... @@ -78,7 +78,7 @@
"postcss-position": "^0.5.0",
"postcss-pxtorem": "^3.3.1",
"postcss-scss": "^0.4.0",
"postcss-short": "^3.0.1",
"postcss-short": "^2.0.1",
"postcss-sprites": "^3.3.0",
"postcss-use": "^2.3.0",
"precss": "^1.4.0",
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('yoho-jquery'),
Hammer = require('yoho-hammer'),
Hammer = require('../common/toy-hammer'),
ellipsis = require('yoho-mlellipsis'),
lazyLoad = require('yoho-jquery-lazyload');
... ... @@ -81,7 +81,7 @@ moreHammer.on('tap', function(e) {
$(window).scrollTop(0, 400); // 滑动到顶部
}
e.preventDefault(); // 防止收缩后误点到商品产生跳转
e.srcEvent.preventDefault(); // 防止收缩后误点到商品产生跳转
});
if ($('#brand-like').length) {
... ... @@ -95,7 +95,7 @@ if ($('#brand-like').length) {
// if (jumpToApp === '1') {
// return true;
// }
e.preventDefault();
e.srcEvent.preventDefault();
if ($this.hasClass('like')) {
opt = 'cancel';
... ...
... ... @@ -578,6 +578,7 @@ function search(opt) {
if (nav.reload) {
if (data.total === 0) {
$('.search-divide').remove();
$container.html(noResult);
}
... ... @@ -596,9 +597,9 @@ function search(opt) {
}, 200);
}
} else {
if (nav.reload) {
$container.html(data);
$('.search-divide').remove();
lazyLoad($container.find('.lazy'));
RES_QTY = $container.find('.total').data('id');
... ... @@ -628,7 +629,9 @@ function search(opt) {
}, 200);
} else {
num = $container.find('.good-info').length;
$('.search-divide').remove();
$container.append(data);
$container.append('<div class="search-divide">正在加载...</div>');
if ($container.find('.total')[1]) {
$container.find('.total')[1].remove();
... ... @@ -709,6 +712,17 @@ function search(opt) {
}
},
error: function() {
var $divide = $('.search-divide');
$divide.html('加载失败,点击重试');
$divide.one('click', function() {
$divide.html('正在加载...');
nav.reload = false;
searching = false;
search();
});
}
});
... ...
... ... @@ -315,4 +315,14 @@
.suspend-home {
bottom: 258px;
}
/*搜索分割*/
.search-divide {
float: left;
height: 50px;
width: 100%;
padding: 10px 0;
color: #ccc;
text-align: center;
}
}
... ...