Authored by 郭成尧

sale-nav-url

... ... @@ -93,7 +93,7 @@ let index = (req, res, next) => {
// 扩展头部频道选择数据
Object.assign(params.renderData.pageHeader, {
saleNav: saleModel.saleNav(params.channel, req.params[0] || !req.query.channel)
saleNav: saleModel.saleNav(params.channel)
});
// 此处 channel 需要读取 cookies 的 channel
... ...
... ... @@ -14,7 +14,6 @@ const processTime = require(`${utils}/time-process`);
const _ = require('lodash');
const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const helpers = global.yoho.helpers;
/**
* 排序转换
... ... @@ -46,32 +45,28 @@ const channelType = {
* 产品要求,SALE的导航显示 Boy,Girl 单数形式
*/
const channelHash = {
boys: 'Boy',
girls: 'Girl',
kids: 'Kid',
boys: 'Boys',
girls: 'Girls',
kids: 'Kids',
lifestyle: 'Lifestyle'
};
const saleNav = (channel, shortUrl) => {
const saleNav = (channel) => {
return {
channel: channelHash[channel],
list: [
{
title: 'Boy',
url: shortUrl ? helpers.urlFormat('/product/boys-sale/') :
helpers.urlFormat('/product/sale', {channel: 'boys'})
title: 'Boys',
url: '/boys-sale'
}, {
title: 'Girl',
url: shortUrl ? helpers.urlFormat('/product/girls-sale/') :
helpers.urlFormat('/product/sale', {channel: 'girls'})
title: 'Girls',
url: '/girls-sale'
}, {
title: 'Kid',
url: shortUrl ? helpers.urlFormat('/product/kids-sale/') :
helpers.urlFormat('/product/sale', {channel: 'kids'})
title: 'Kids',
url: '/kids-sale'
}, {
title: 'Lifestyle',
url: shortUrl ? helpers.urlFormat('/product/lifestyle-sale/') :
helpers.urlFormat('/product/sale', {channel: 'lifestyle'})
url: '/lifestyle-sale'
}
]
};
... ...