Authored by ccbikai

SALE 频道优化

... ... @@ -11,8 +11,6 @@ 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',
... ... @@ -47,17 +45,6 @@ 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
... ... @@ -71,25 +58,10 @@ let index = (req, res, next) => {
}
saleModel.getSaleData(params.channel).then((result) => {
// 扩展头部频道选择数据
Object.assign(params.renderData.pageHeader, {
saleNav: {
channel: channelHash[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'})
}
]
}
saleNav: saleModel.saleNav(req.yoho.channel)
});
res.render('sale/index', Object.assign(params.renderData, {
content: result,
... ... @@ -97,7 +69,8 @@ let index = (req, res, next) => {
title: {
title: '最新降价'
}
}
},
pageChannel: false // 需求中,头部不需要跟随频道变颜色
}));
}).catch(next);
};
... ...
... ... @@ -15,6 +15,7 @@ const processTime = require(`${utils}/time-process`);
const _ = require('lodash');
const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const helpers = global.yoho.helpers;
/**
* 排序转换
... ... @@ -40,6 +41,38 @@ const channelType = {
};
/**
* 频道转换
* 产品要求,SALE的导航显示 Boy,Girl 单数形式
*/
const channelHash = {
boys: 'Boy',
girls: 'Girl',
kids: 'Kid',
lifestyle: 'Lifestyle'
};
const saleNav = (channel) => {
return {
channel: channelHash[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'})
}
]
};
};
/**
* 资源位code码
*/
const contentCode = contentCodeConfig.sale;
... ... @@ -351,5 +384,6 @@ module.exports = {
getDiscountDetailData,
getVipData,
getFilterData,
getSearchData
getSearchData,
saleNav
};
... ...
... ... @@ -14,5 +14,3 @@
</div>
{{> common/query-param}}
{{> common/suspend-cart}}
... ...
{{#pageHeader}}
{{# @root.pageChannel}}
<header id="yoho-header" class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}{{#if lifestyle}} life-style{{/if}}">
{{^}}
<header id="yoho-header" class="yoho-header">
{{/ @root.pageChannel}}
{{#navBack}}
<a href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back">&#xe610;</a>
... ... @@ -36,6 +38,8 @@
{{#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}}">
{{^}}
<div class="homebuttom hide">
{{/ @root.pageChannel}}
<ul>
<li>
... ...
... ... @@ -13,6 +13,7 @@ var search = require('./sale/search');
require('../common');
search.start();
lazyload($('img.lazy'));
$('.swiper-container').each(function() {
if ($(this).find('.swiper-slide').length > 1) {
... ... @@ -39,8 +40,6 @@ $(function() {
$saleNavSelect.toggleClass('show');
});
lazyload($('img.lazy'));
// 读取会员专享商品
$.ajax({
url: '/product/sale/search',
... ...
... ... @@ -71,7 +71,6 @@ var $listNav = $('#list-nav'),
$pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项
searching;
require('../../common/suspend-cart'); // 悬浮购物车
require('../../common');
ellipsis.init();
... ...
... ... @@ -18,6 +18,7 @@
width: 100%;
height: 90px;
background-color: #000;
background-image: linear-gradient(#323232, #414141);
color: #fff;
line-height: 90px;
... ...