Authored by ccbikai

SALE 头部导航处理

... ... @@ -11,6 +11,8 @@ const mRoot = '../models';
const headerModel = require('../../../doraemon/models/header');
const saleModel = require(`${mRoot}/sale`);
const helpers = global.yoho.helpers;
// const queryParam = {
// brand: '0',
// gender: '1,2,3',
... ... @@ -34,6 +36,7 @@ const _processPublicData = (req, title, page) => {
module: 'product',
page: page,
title: title,
saleNav: true,
pageHeader: headerModel.setNav({
navTitle: title,
navBtn: false
... ... @@ -44,6 +47,17 @@ const _processPublicData = (req, title, page) => {
};
/**
* 频道转换
* 产品要求,SALE的导航显示 Boy,Girl 单数形式
*/
const channelHash = {
boys: 'Boy',
girls: 'Girl',
kids: 'Kid',
lifestyle: 'Lifestyle'
};
/**
* sale 首页 资源位获取
* @param {[object]} req
* @param {[object]} res
... ... @@ -53,6 +67,26 @@ let index = (req, res, next) => {
let params = _processPublicData(req, 'SALE', 'sale');
saleModel.getSaleData(params.channel).then((result) => {
Object.assign(params.renderData.pageHeader, {
saleNav: {
channel: channelHash[req.yoho.channel] || req.yoho.channel,
list: [
{
title: 'Boy',
url: helpers.urlFormat('/product/sale', {channel: 'boys'})
}, {
title: 'Girl',
url: helpers.urlFormat('/product/sale', {channel: 'girls'})
}, {
title: 'Kid',
url: helpers.urlFormat('/product/sale', {channel: 'kids'})
}, {
title: 'Lifestyle',
url: helpers.urlFormat('/product/sale', {channel: 'lifestyle'})
}
]
}
});
res.render('sale/index', Object.assign(params.renderData, {
content: result,
floorHeader: {
... ...
... ... @@ -20,7 +20,19 @@
{{#navTitle}}
<p class="nav-title">{{.}}</p>
{{/navTitle}}
{{#saleNav}}
<span class="sale-nav nav-home">
{{channel}} &#xe616;
</span>
{{/saleNav}}
</header>
{{#if saleNav.list}}
<div class="sale-nav-select">
{{#each saleNav.list}}
<a href="{{url}}">{{title}}</a>
{{/each}}
</div>
{{/if}}
{{#navBtn}}
{{# @root.pageChannel}}
<div class="homebuttom hide {{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}{{#if lifestyle}} life-style{{/if}}">
... ...
.yoho-header {
.sale-nav {
text-transform: capitalize;
}
+ .sale-nav-select {
position: absolute;
top: 90px;
right: 10px;
z-index: 2;
background: #000;
text-align: center;
a {
display: block;
color: #fff;
}
}
}
.sale-page {
overflow: hidden;
background-color: #f0f0f0;
... ...