Authored by 梁志锋

Merge remote-tracking branch 'origin/master'

... ... @@ -257,7 +257,7 @@ const qq = {
doPassportCallback(openId, nickname, 'qq', req, res).catch(next);
})(req, res, next);
} else {
return next(new Error('Auth State Mismatch'));
return next('Auth State Mismatch' + req.originalUrl);
}
}
};
... ...
... ... @@ -176,7 +176,7 @@ exports.consultUpvoteOrUseful = (req, res, next) => {
message: '用户id为空',
data: helpers.urlFormat('/signin.html', {
refer: helpers.urlFormat('/product/detail/consults', {
product_id: req.body.product_id,
product_id: req.body.productId,
total: req.body.total
})
})
... ...
... ... @@ -77,7 +77,7 @@ const getConsults = (id, page, limit) => {
}).then(result => {
let data = {};
if (result.data && result.data.list) {
if (result && result.data && result.data.list) {
Object.assign(data, {
list: _formatConsultsList(result.data.list),
pageTotal: result.data.page_total,
... ... @@ -100,8 +100,8 @@ let _processComment = (data) => {
_.forEach(data.pageResponse.list, (item) => {
result.comments.push({
userName: item.userInfo.nickName,
desc: `${item.goods.color_name}/${item.goods.size_name}`,
userName: item.userInfo ? item.userInfo.nickName : '',
desc: item.goods ? `${item.goods.color_name}/${item.goods.size_name}` : '',
content: item.content,
time: helpers.dateFormat('YYYY-MM-DD HH:mm:ss', new Date(item.createTime * 1000))
});
... ... @@ -121,7 +121,7 @@ let getCommentInfo = (params) => {
}, params), {
cache: true
}).then((result) => {
if (result.code === 200) {
if (result && result.code === 200) {
return _processComment(result.data);
}
... ... @@ -205,7 +205,7 @@ let addConsult = (uid, productId, content) => {
};
return api.post('', params).then(result => {
if (result.code !== 200) {
if (!result || !result.code || result.code !== 200) {
return false;
}
return result;
... ...
... ... @@ -26,10 +26,10 @@ const getSizeInfo = (sizeInfo) => {
dest.goodsDescription.detail = {};
dest.goodsDescription.detail.list = [];
if (!_.isEmpty(sizeInfo.productDescBo.erpProductId)) {
if (_.has(sizeInfo, 'productDescBo.erpProductId')) {
let sex = '通用';
switch (sizeInfo.productDescBo.gender) {
switch (_.get(sizeInfo, 'productDescBo.gender', 0)) {
case 1:
sex = '男款';
break;
... ... @@ -43,17 +43,17 @@ const getSizeInfo = (sizeInfo) => {
dest.goodsDescription.title = '商品信息';
dest.goodsDescription.enTitle = 'DESCRIPTION';
temp = {};
temp.param = '编号:' + sizeInfo.productDescBo.erpProductId;
temp.param = '编号:' + _.get(sizeInfo, 'productDescBo.erpProductId', '');
dest.goodsDescription.detail.list.push(temp);
temp = {};
temp.param = '颜色:' + sizeInfo.productDescBo.colorName;
temp.param = '颜色:' + _.get(sizeInfo, 'productDescBo.colorName', '');
dest.goodsDescription.detail.list.push(temp);
temp = {};
temp.param = '性别:' + sex;
dest.goodsDescription.detail.list.push(temp);
}
if (!_.isEmpty(sizeInfo.productDescBo.standardBos)) {
if (_.has(sizeInfo, 'productDescBo.standardBos')) {
_.forEach(sizeInfo.productDescBo.standardBos, function(value) {
temp = {};
temp.param = value.standardName + ':' +
... ... @@ -62,12 +62,12 @@ const getSizeInfo = (sizeInfo) => {
dest.goodsDescription.detail.list.push(temp);
});
}
if (_.isEmpty(sizeInfo.phrase)) {
if (sizeInfo.phrase) {
dest.goodsDescription.desc = sizeInfo.phrase;
}
// 尺码信息
if (!_.isEmpty(sizeInfo.sizeInfoBo)) {
if (sizeInfo.sizeInfoBo) {
dest.sizeInfo = {};
dest.sizeInfo.title = '尺码信息';
dest.sizeInfo.enTitle = 'SIZE INFO';
... ... @@ -75,9 +75,9 @@ const getSizeInfo = (sizeInfo) => {
dest.sizeInfo.detail.list = [];
// 参考尺码
let boyReference = sizeInfo.productExtra.boyReference;
let girlReference = sizeInfo.productExtra.girlReference;
let gender = sizeInfo.productDescBo.gender ? sizeInfo.productDescBo.gender : 3;
let boyReference = _.get(sizeInfo, 'productExtra.boyReference', null);
let girlReference = _.get(sizeInfo, 'productExtra.girlReference', null);
let gender = _.get(sizeInfo, 'productDescBo.gender', 3);
let referenceName = '参考尺码';
if ((gender === 1 && boyReference) || (gender === 2 && girlReference)) {
... ... @@ -91,16 +91,18 @@ const getSizeInfo = (sizeInfo) => {
let referenceList = [];
// 判断是否显示参考尺码
let showReference = (boyReference &&
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].boyReferSize)) || (girlReference &&
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].girlReferSize));
let showReference = (boyReference && sizeInfo.sizeInfoBo &&
sizeInfo.sizeInfoBo.sizeBoList && sizeInfo.sizeInfoBo.sizeBoList[0] &&
sizeInfo.sizeInfoBo.sizeBoList[0].boyReferSize) ||
(girlReference && sizeInfo.sizeInfoBo && sizeInfo.sizeInfoBo.sizeBoList &&
sizeInfo.sizeInfoBo.sizeBoList[0] && sizeInfo.sizeInfoBo.sizeBoList[0].girlReferSize);
if (showReference) {
referenceList[0] = {};
referenceList[0].param = referenceName;
}
if (!_.isEmpty(sizeInfo.sizeInfoBo.sizeAttributeBos)) {
if (_.has(sizeInfo, 'sizeInfoBo.sizeAttributeBos')) {
// [{param: attrName}] th
let sizeNameList = [];
... ... @@ -112,38 +114,40 @@ const getSizeInfo = (sizeInfo) => {
// {id: [{param: str},......]} sizeBoGroup[id][0] 属性名, sizeBoGroup[id][index] 属性值
let sizeBoGroup = {};
_.forEach(sizeInfo.sizeInfoBo.sizeAttributeBos, function(attr) {
sizeBoGroup[attr.id] = [];
sizeBoGroup[attr.id][0] = {};
sizeBoGroup[attr.id][0].param = _.isEmpty(attr.attributeName) ?
' ' : attr.attributeName;
});
_.forEach(sizeInfo.sizeInfoBo.sizeBoList, function(value) {
if (_.has(sizeInfo, 'sizeInfoBo.sizeAttributeBos')) {
_.forEach(sizeInfo.sizeInfoBo.sizeAttributeBos, function(attr) {
sizeBoGroup[attr.id] = [];
sizeBoGroup[attr.id][0] = {};
sizeBoGroup[attr.id][0].param = attr.attributeName;
});
}
temp = {};
temp.param = value.sizeName;
sizeNameList.push(temp);
if (_.has(sizeInfo, 'sizeInfoBo.sizeBoList')) {
_.forEach(sizeInfo.sizeInfoBo.sizeBoList, function(value) {
if (boyReference && (gender === 1 || gender === 3)) {
temp = {};
temp.param = value.boyReferSize.referenceName || '';
referenceList.push(temp);
} else if (girlReference && (gender === 2 || gender === 3)) {
temp = {};
temp.param = value.girlReferSize.referenceName || '';
referenceList.push(temp);
} else {
showReference = false;
}
_.forEach(value.sortAttributes, function(attr) {
temp = {};
temp.param = attr.sizeValue || ' ';
sizeBoGroup[attr.id].push(temp);
temp.param = value.sizeName;
sizeNameList.push(temp);
if (boyReference && (gender === 1 || gender === 3)) {
temp = {};
temp.param = (value.boyReferSize && value.boyReferSize.referenceName) || '';
referenceList.push(temp);
} else if (girlReference && (gender === 2 || gender === 3)) {
temp = {};
temp.param = (value.girlReferSize && value.girlReferSize.referenceName) || '';
referenceList.push(temp);
} else {
showReference = false;
}
_.forEach(value.sortAttributes, function(attr) {
temp = {};
temp.param = attr.sizeValue || ' ';
sizeBoGroup[attr.id].push(temp);
});
});
});
}
// 根据模板页面的显示,按表格一列一列来显示
dest.sizeInfo.detail.list[0] = {};
... ... @@ -163,7 +167,7 @@ const getSizeInfo = (sizeInfo) => {
}
// 测量方式
if (!_.isEmpty(sizeInfo.sizeImage)) {
if (sizeInfo.sizeImage) {
dest.measurementMethod = {};
dest.measurementMethod.title = '测量方式';
... ... @@ -172,7 +176,7 @@ const getSizeInfo = (sizeInfo) => {
}
// 模特试穿, 竖着输出排列显示
if (!_.isEmpty(sizeInfo.modelBos)) {
if (sizeInfo.modelBos) {
let reference = {
title: '模特试穿',
enTitle: 'REFERENCE'
... ... @@ -263,7 +267,7 @@ const getSizeInfo = (sizeInfo) => {
}
// 商品材质
if (!_.isEmpty(sizeInfo.productMaterialList)) {
if (sizeInfo.productMaterialList) {
dest.materials = {};
dest.materials.title = '商品材质';
dest.materials.enTitle = 'MATERIALS';
... ... @@ -279,7 +283,7 @@ const getSizeInfo = (sizeInfo) => {
}
// 洗涤提示
if (!_.isEmpty(sizeInfo.washTipsBoList)) {
if (sizeInfo.washTipsBoList) {
dest.washTips = {};
dest.washTips.list = [];
_.forEach(sizeInfo.washTipsBoList, function(value) {
... ... @@ -288,16 +292,17 @@ const getSizeInfo = (sizeInfo) => {
}
// 详情配图
if (!_.isEmpty(sizeInfo.productIntroBo.productIntro)) {
if (_.has(sizeInfo, 'productIntroBo.productIntro')) {
let productIntro = '';
if (!_.isEmpty(sizeInfo.productDescBo.phrase)) {
if (_.has(sizeInfo, 'productDescBo.phrase')) {
productIntro = productIntro + sizeInfo.productDescBo.phrase +
'<br />';
}
productIntro = productIntro + sizeInfo.productIntroBo.productIntro;
if (!_.isEmpty(productIntro) && productIntro !== '') {
if (_.has(sizeInfo, 'productIntroBo.productIntro')) {
productIntro = productIntro + sizeInfo.productIntroBo.productIntro;
}
if (productIntro) {
dest.productDetail = {};
dest.productDetail.title = '商品详情';
dest.productDetail.enTitle = 'DETAILS';
... ...
... ... @@ -59,6 +59,6 @@ exports.serverError = () => {
isErr: true
});
}
next(err);
next();
};
};
... ...
{
"name": "m-yohobuy-node",
"version": "4.8.12",
"version": "4.8.14",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...

23.4 KB | W: | H:

2.5 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -11,8 +11,7 @@
var goodsConsultsEle = $('#goods-consults')[0],
goodsConsultsHammer = goodsConsultsEle && new Hammer(goodsConsultsEle);
var productId,
total;
var total;
function showCountPlus($el) {
var $count = $el.find('.animate-count');
... ... @@ -30,7 +29,6 @@
(function() {
var queryStr = window.location.search.substring(1);
productId = queryStr.split('&')[0].split('=')[1];
total = queryStr.split('&')[1] ? queryStr.split('&')[1].split('=')[1] : null;
}());
... ... @@ -56,7 +54,7 @@
url: url,
data: {
id: id,
productId: productId,
productId: window.queryString.product_id,
total: total
}
}).done(function(data) {
... ...