Authored by yyq

商品详情面包屑导航

... ... @@ -205,8 +205,6 @@ const _processFloorData = d => {
let floorTitle;
let floorData;
console.log(data);
// 处理banner
if (_isBannerFloor(data)) {
floorData = floorMap.slider(data.data);
... ...
... ... @@ -13,6 +13,7 @@ const item = require('../models/item');
* @function index
*/
const index = (req, res, next) => {
req.params.channel = req.yoho.channel;
item.getProductItemData(req.params, req.url, req.user.uid).then(result => {
if (_.isEmpty(result)) {
return next();
... ...
... ... @@ -166,21 +166,37 @@ const setSeoInfo = (goodInfo, nav) => {
* @param { string } name 商品名称
* @return { Object } 面包屑导航数据
*/
const setPathNav = (data, name) => {
const setPathNav = (data, name, channel) => {
let resData = {};
let link = channel,
gender;
channel = channel || 'men';
switch (channel) {
case 'men': // 男
link = '';
gender = '1,3';
break;
case 'women': // 女
gender = '2,3';
break;
default: // 其它
gender = '1,2,3';
break;
}
if (!_.isEmpty(data)) {
let navs = [{
link: helpers.urlFormat(''),
name: 'MEN首页' // 待处理
link: helpers.urlFormat(`/${link}`),
name: `${_.toUpper(channel)}首页`
}];
let sort = data.sort[0];
navs.push({
link: helpers.urlFormat('/list', {
msort: sort.sort_id
// gender: '' // 待处理
msort: sort.sort_id,
gender: gender
}),
name: sort.sort_name,
pathTitle: sort.sort_name
... ... @@ -191,9 +207,8 @@ const setPathNav = (data, name) => {
navs.push({
link: helpers.urlFormat('/list', {
msort: sort.sort_id,
misort: sort.sub.sort_id
// gender: '' // 待处理
misort: sort.sub.sort_id,
gender: gender
}),
name: sort.sub[0].sort_name,
pathTitle: sort.sub[0].sort_name
... ...
... ... @@ -93,7 +93,7 @@ const getProductItemData = (params, url, uid) => {
_.set(data, 'goodInfo.productFav', mulRes.productFav);
Object.assign(data,
itemFun.setPathNav(mulRes.sort, result.productName), // 面包屑导航
itemFun.setPathNav(mulRes.sort, result.productName, params.channel), // 面包屑导航
itemFun.setDescriptionData(mulRes.sizeInfo, mulRes.comfort), // DESCRIPTION商品描述
itemFun.setMaterialData(mulRes.sizeInfo), // MATERIALS材料洗涤
itemFun.setSizeData(mulRes.sizeInfo, mulRes.modelTry), // SIZEINFO尺码信息
... ...
... ... @@ -38,7 +38,7 @@ const getBannerData = (code) => {
return resData;
});
}
};
module.exports = {
getBannerData
... ...