Showing
7 changed files
with
46 additions
and
38 deletions
@@ -11,8 +11,6 @@ const mRoot = '../models'; | @@ -11,8 +11,6 @@ const mRoot = '../models'; | ||
11 | const headerModel = require('../../../doraemon/models/header'); | 11 | const headerModel = require('../../../doraemon/models/header'); |
12 | const saleModel = require(`${mRoot}/sale`); | 12 | const saleModel = require(`${mRoot}/sale`); |
13 | 13 | ||
14 | -const helpers = global.yoho.helpers; | ||
15 | - | ||
16 | // const queryParam = { | 14 | // const queryParam = { |
17 | // brand: '0', | 15 | // brand: '0', |
18 | // gender: '1,2,3', | 16 | // gender: '1,2,3', |
@@ -47,17 +45,6 @@ const _processPublicData = (req, title, page) => { | @@ -47,17 +45,6 @@ const _processPublicData = (req, title, page) => { | ||
47 | }; | 45 | }; |
48 | 46 | ||
49 | /** | 47 | /** |
50 | - * 频道转换 | ||
51 | - * 产品要求,SALE的导航显示 Boy,Girl 单数形式 | ||
52 | - */ | ||
53 | -const channelHash = { | ||
54 | - boys: 'Boy', | ||
55 | - girls: 'Girl', | ||
56 | - kids: 'Kid', | ||
57 | - lifestyle: 'Lifestyle' | ||
58 | -}; | ||
59 | - | ||
60 | -/** | ||
61 | * sale 首页 资源位获取 | 48 | * sale 首页 资源位获取 |
62 | * @param {[object]} req | 49 | * @param {[object]} req |
63 | * @param {[object]} res | 50 | * @param {[object]} res |
@@ -71,25 +58,10 @@ let index = (req, res, next) => { | @@ -71,25 +58,10 @@ let index = (req, res, next) => { | ||
71 | } | 58 | } |
72 | 59 | ||
73 | saleModel.getSaleData(params.channel).then((result) => { | 60 | saleModel.getSaleData(params.channel).then((result) => { |
61 | + | ||
62 | + // 扩展头部频道选择数据 | ||
74 | Object.assign(params.renderData.pageHeader, { | 63 | Object.assign(params.renderData.pageHeader, { |
75 | - saleNav: { | ||
76 | - channel: channelHash[req.yoho.channel], | ||
77 | - list: [ | ||
78 | - { | ||
79 | - title: 'Boy', | ||
80 | - url: helpers.urlFormat('/product/sale', {channel: 'boys'}) | ||
81 | - }, { | ||
82 | - title: 'Girl', | ||
83 | - url: helpers.urlFormat('/product/sale', {channel: 'girls'}) | ||
84 | - }, { | ||
85 | - title: 'Kid', | ||
86 | - url: helpers.urlFormat('/product/sale', {channel: 'kids'}) | ||
87 | - }, { | ||
88 | - title: 'Lifestyle', | ||
89 | - url: helpers.urlFormat('/product/sale', {channel: 'lifestyle'}) | ||
90 | - } | ||
91 | - ] | ||
92 | - } | 64 | + saleNav: saleModel.saleNav(req.yoho.channel) |
93 | }); | 65 | }); |
94 | res.render('sale/index', Object.assign(params.renderData, { | 66 | res.render('sale/index', Object.assign(params.renderData, { |
95 | content: result, | 67 | content: result, |
@@ -97,7 +69,8 @@ let index = (req, res, next) => { | @@ -97,7 +69,8 @@ let index = (req, res, next) => { | ||
97 | title: { | 69 | title: { |
98 | title: '最新降价' | 70 | title: '最新降价' |
99 | } | 71 | } |
100 | - } | 72 | + }, |
73 | + pageChannel: false // 需求中,头部不需要跟随频道变颜色 | ||
101 | })); | 74 | })); |
102 | }).catch(next); | 75 | }).catch(next); |
103 | }; | 76 | }; |
@@ -15,6 +15,7 @@ const processTime = require(`${utils}/time-process`); | @@ -15,6 +15,7 @@ const processTime = require(`${utils}/time-process`); | ||
15 | const _ = require('lodash'); | 15 | const _ = require('lodash'); |
16 | const api = global.yoho.API; | 16 | const api = global.yoho.API; |
17 | const serviceAPI = global.yoho.ServiceAPI; | 17 | const serviceAPI = global.yoho.ServiceAPI; |
18 | +const helpers = global.yoho.helpers; | ||
18 | 19 | ||
19 | /** | 20 | /** |
20 | * 排序转换 | 21 | * 排序转换 |
@@ -40,6 +41,38 @@ const channelType = { | @@ -40,6 +41,38 @@ const channelType = { | ||
40 | }; | 41 | }; |
41 | 42 | ||
42 | /** | 43 | /** |
44 | + * 频道转换 | ||
45 | + * 产品要求,SALE的导航显示 Boy,Girl 单数形式 | ||
46 | + */ | ||
47 | +const channelHash = { | ||
48 | + boys: 'Boy', | ||
49 | + girls: 'Girl', | ||
50 | + kids: 'Kid', | ||
51 | + lifestyle: 'Lifestyle' | ||
52 | +}; | ||
53 | + | ||
54 | +const saleNav = (channel) => { | ||
55 | + return { | ||
56 | + channel: channelHash[channel], | ||
57 | + list: [ | ||
58 | + { | ||
59 | + title: 'Boy', | ||
60 | + url: helpers.urlFormat('/product/sale', {channel: 'boys'}) | ||
61 | + }, { | ||
62 | + title: 'Girl', | ||
63 | + url: helpers.urlFormat('/product/sale', {channel: 'girls'}) | ||
64 | + }, { | ||
65 | + title: 'Kid', | ||
66 | + url: helpers.urlFormat('/product/sale', {channel: 'kids'}) | ||
67 | + }, { | ||
68 | + title: 'Lifestyle', | ||
69 | + url: helpers.urlFormat('/product/sale', {channel: 'lifestyle'}) | ||
70 | + } | ||
71 | + ] | ||
72 | + }; | ||
73 | +}; | ||
74 | + | ||
75 | +/** | ||
43 | * 资源位code码 | 76 | * 资源位code码 |
44 | */ | 77 | */ |
45 | const contentCode = contentCodeConfig.sale; | 78 | const contentCode = contentCodeConfig.sale; |
@@ -351,5 +384,6 @@ module.exports = { | @@ -351,5 +384,6 @@ module.exports = { | ||
351 | getDiscountDetailData, | 384 | getDiscountDetailData, |
352 | getVipData, | 385 | getVipData, |
353 | getFilterData, | 386 | getFilterData, |
354 | - getSearchData | 387 | + getSearchData, |
388 | + saleNav | ||
355 | }; | 389 | }; |
1 | {{#pageHeader}} | 1 | {{#pageHeader}} |
2 | {{# @root.pageChannel}} | 2 | {{# @root.pageChannel}} |
3 | <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}}"> | 3 | <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}}"> |
4 | +{{^}} | ||
5 | +<header id="yoho-header" class="yoho-header"> | ||
4 | {{/ @root.pageChannel}} | 6 | {{/ @root.pageChannel}} |
5 | {{#navBack}} | 7 | {{#navBack}} |
6 | <a href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back"></a> | 8 | <a href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back"></a> |
@@ -36,6 +38,8 @@ | @@ -36,6 +38,8 @@ | ||
36 | {{#navBtn}} | 38 | {{#navBtn}} |
37 | {{# @root.pageChannel}} | 39 | {{# @root.pageChannel}} |
38 | <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}}"> | 40 | <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}}"> |
41 | +{{^}} | ||
42 | +<div class="homebuttom hide"> | ||
39 | {{/ @root.pageChannel}} | 43 | {{/ @root.pageChannel}} |
40 | <ul> | 44 | <ul> |
41 | <li> | 45 | <li> |
@@ -13,6 +13,7 @@ var search = require('./sale/search'); | @@ -13,6 +13,7 @@ var search = require('./sale/search'); | ||
13 | require('../common'); | 13 | require('../common'); |
14 | 14 | ||
15 | search.start(); | 15 | search.start(); |
16 | +lazyload($('img.lazy')); | ||
16 | 17 | ||
17 | $('.swiper-container').each(function() { | 18 | $('.swiper-container').each(function() { |
18 | if ($(this).find('.swiper-slide').length > 1) { | 19 | if ($(this).find('.swiper-slide').length > 1) { |
@@ -39,8 +40,6 @@ $(function() { | @@ -39,8 +40,6 @@ $(function() { | ||
39 | $saleNavSelect.toggleClass('show'); | 40 | $saleNavSelect.toggleClass('show'); |
40 | }); | 41 | }); |
41 | 42 | ||
42 | - lazyload($('img.lazy')); | ||
43 | - | ||
44 | // 读取会员专享商品 | 43 | // 读取会员专享商品 |
45 | $.ajax({ | 44 | $.ajax({ |
46 | url: '/product/sale/search', | 45 | url: '/product/sale/search', |
@@ -71,7 +71,6 @@ var $listNav = $('#list-nav'), | @@ -71,7 +71,6 @@ var $listNav = $('#list-nav'), | ||
71 | $pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项 | 71 | $pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项 |
72 | searching; | 72 | searching; |
73 | 73 | ||
74 | -require('../../common/suspend-cart'); // 悬浮购物车 | ||
75 | require('../../common'); | 74 | require('../../common'); |
76 | 75 | ||
77 | ellipsis.init(); | 76 | ellipsis.init(); |
-
Please register or login to post a comment