Authored by 李靖

联调

'use strict';
const mRoot = '../models';
const newGuangModel = require(`${mRoot}/guang-new`);
const headerModel = require('../../../doraemon/models/header'); // 头部model
exports.index = (req, res) => {
const typeLib = require('../../../config/type-lib');
const channels = {
boys: 1,
girl: 2,
kids: 3,
lifestyle: 4
};
exports.index = (req, res, next) => {
let responseData = {
pageHeader: headerModel.setNav({
navTitle: '逛'
... ... @@ -15,7 +25,14 @@ exports.index = (req, res) => {
localCss: true
};
let params = {};
let params = {
gender: req.query.gender ||
req.query.channel && typeLib.channels[req.query.channel] ||
req.cookies._Channel && channels[req.cookies._Channel] ||
'1,3',
};
res.render('guang-new', Object.assign(responseData, params));
req.ctx(newGuangModel).index(params).then(result => {
res.render('guang-new', Object.assign(responseData, result));
}).catch(next);
};
... ...
'use strict';
const _ = require('lodash');
class newGuang extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
_indexRes(params) {
let options = {
url: '/operations/api/v5/resource/get',
data: {
content_code: '44153d54effebaf803a2deee06b3ea5a',
gender: params.gender
},
api: global.yoho.ServiceAPI
};
return this.get(options).then(result => {
return result;
});
}
index(params) {
return Promise.all([
this._indexRes(params)
]).then((result) => {
let resu = {
floorRes: {}
};
if (_.get(result, '[0].data')) {
_.forEach(result[0].data, (val) => {
if (val.template_name === 'focus') {
resu.floorRes.focus = _.get(val, 'data');
}
if (val.template_name === '3:4ImageListFloor') {
resu.floorRes.type = _.get(val, 'data.list');
}
if (val.template_name === 'GuangRqFloor') {
resu.floorRes.renQi = _.get(val, 'data.list');
}
if (val.template_name === 'GuangRqFloor') {
resu.floorRes.daPei = _.get(val, 'data.list');
}
if (val.template_name === 'GuangRqFloor') {
resu.floorRes.haoHuo = _.get(val, 'data.list');
}
});
}
return resu;
});
}
}
module.exports = newGuang;
... ...
<div class="guang-new-page yoho-page">
{{#if floorRes.focus}}
<div class="swiper-top">
<div class="swiper-container">
<div class="swiper-wrapper">
{{# floorRes.focus}}
<div class="swiper-slide">
<img src="http://img12.static.yhbimg.com/article/2017/10/27/18/02fa575c14cb40d9599875b8e437564f91.jpg" />
</div>
<div class="swiper-slide">
<img src="http://img12.static.yhbimg.com/article/2017/10/27/18/02fa575c14cb40d9599875b8e437564f91.jpg" />
</div>
<div class="swiper-slide">
<img src="http://img12.static.yhbimg.com/article/2017/10/27/18/02fa575c14cb40d9599875b8e437564f91.jpg" />
</div>
<div class="swiper-slide">
<img src="http://img12.static.yhbimg.com/article/2017/10/27/18/02fa575c14cb40d9599875b8e437564f91.jpg" />
</div>
<div class="swiper-slide">
<img src="http://img12.static.yhbimg.com/article/2017/10/27/18/02fa575c14cb40d9599875b8e437564f91.jpg" />
</div>
<div class="swiper-slide">
<img src="http://img12.static.yhbimg.com/article/2017/10/27/18/02fa575c14cb40d9599875b8e437564f91.jpg" />
<a href="{{url}}">
<img src="{{image2 src w=750 h=322 q=60}}" alt="{{title}}" />
</a>
</div>
{{/ floorRes.focus}}
</div>
<div class="swiper-pagination">
<div class="wiper-pagination-bullets"></div>
</div>
</div>
</div>
{{/if}}
{{#if floorRes.type}}
<div class="swiper-tab">
<div class="swiper-container">
<div class="swiper-wrapper">
{{#floorRes.type}}
<div class="swiper-slide">
<a href="https://www.baidu.com/">
<div class="tab-item" style="background-image: url(http://img12.static.yhbimg.com/goodsimg/2017/09/11/14/02402a9298765b8042740b7df2ee541e27.jpg)">
<div class="cover"></div>
<div class="title">11</div>
</div>
</a>
</div>
<div class="swiper-slide">
<a href="https://www.baidu.com/">
<div class="tab-item" style="background-image: url(http://img12.static.yhbimg.com/goodsimg/2017/09/11/14/02402a9298765b8042740b7df2ee541e27.jpg)">
<div class="cover"></div>
<div class="title">22</div>
</div>
</a>
</div>
<div class="swiper-slide">
<a href="https://www.baidu.com/">
<div class="tab-item" style="background-image: url(http://img12.static.yhbimg.com/goodsimg/2017/09/11/14/02402a9298765b8042740b7df2ee541e27.jpg)">
<div class="cover"></div>
<div class="title">33</div>
</div>
</a>
</div>
<div class="swiper-slide">
<a href="https://www.baidu.com/">
<div class="tab-item" style="background-image: url(http://img12.static.yhbimg.com/goodsimg/2017/09/11/14/02402a9298765b8042740b7df2ee541e27.jpg)">
<div class="cover"></div>
<div class="title">44</div>
</div>
</a>
</div>
<div class="swiper-slide">
<a href="https://www.baidu.com/">
<div class="tab-item" style="background-image: url(http://img12.static.yhbimg.com/goodsimg/2017/09/11/14/02402a9298765b8042740b7df2ee541e27.jpg)">
<div class="cover"></div>
<div class="title">55</div>
</div>
</a>
</div>
<div class="swiper-slide">
<a href="https://www.baidu.com/">
<div class="tab-item" style="background-image: url(http://img12.static.yhbimg.com/goodsimg/2017/09/11/14/02402a9298765b8042740b7df2ee541e27.jpg)">
<div class="cover"></div>
<div class="title">66</div>
</div>
</a>
</div>
<div class="swiper-slide">
<a href="https://www.baidu.com/">
<div class="tab-item" style="background-image: url(http://img12.static.yhbimg.com/goodsimg/2017/09/11/14/02402a9298765b8042740b7df2ee541e27.jpg)">
<a href="{{url}}">
<div class="tab-item" style="background-image: url({{image2 src w=100 h=320 q=60}})">
<div class="cover"></div>
<div class="title">77</div>
<div class="title">{{alt}}</div>
</div>
</a>
</div>
{{/floorRes.type}}
</div>
</div>
</div>
{{/if}}
{{#if floorRes.renQi}}
<div class="big-title">
人气
<span class="iconfont">MORE&nbsp;&#xe604;</span>
<a class="iconfont" href="//guang.m.yohobuy.com/?type=1001">MORE&nbsp;&#xe604;</a>
</div>
<div class="swiper-page">
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="page-c">
<img src="http://img12.static.yhbimg.com/article/2017/10/27/18/02fa575c14cb40d9599875b8e437564f91.jpg" />
<div class="info">
<p class="name eps">DICKIES从诞生之日起就旨在出品高品质DICKIES从诞生之日起就旨在出品高品质</p>
<p class="type">1潮流</p>
</div>
</div>
</div>
<div class="swiper-slide">
<div class="page-c">
<img src="http://img10.static.yhbimg.com/yhb-img01/2017/10/27/11/01351c47cc94b9cdbf401ea243f5e16086.jpg" />
<div class="info">
<p class="name eps">DICKIES从诞生之日起就旨在出品高品质DICKIES从诞生之日起就旨在出品高品质</p>
<p class="type">2潮流</p>
{{# floorRes.renQi}}
<div class="swiper-slide">
<a href="//guang.m.yohobuy.com/info/index?id={{id}}">
<div class="page-c">
<img src="{{image2 src w=690 h=430 q=60}}" />
<div class="info">
<p class="name eps">{{title}}</p>
<p class="type eps">{{intro}}</p>
</div>
</div>
</div>
</div>
<div class="swiper-slide">
<div class="page-c">
<img src="http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg" />
<div class="info">
<p class="name eps">DICKIES从诞生之日起就旨在出品高品质DICKIES从诞生之日起就旨在出品高品质</p>
<p class="type">3潮流</p>
</div>
</div>
</div>
<div class="swiper-slide">
<div class="page-c">
<img src="http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01f86a6951f771405d8034ec75ef990714.jpg" />
<div class="info">
<p class="name eps">DICKIES从诞生之日起就旨在出品高品质DICKIES从诞生之日起就旨在出品高品质</p>
<p class="type">4潮流</p>
</div>
</div>
</div>
<div class="swiper-slide">
<div class="page-c">
<img src="http://img10.static.yhbimg.com/yhb-img01/2017/10/27/12/01fee21a2b9808e42f02ad2217b59a1491.jpg" />
<div class="info">
<p class="name eps">DICKIES从诞生之日起就旨在出品高品质DICKIES从诞生之日起就旨在出品高品质</p>
<p class="type">5潮流</p>
</div>
</div>
</a>
</div>
{{/ floorRes.renQi}}
</div>
</div>
</div>
{{/if}}
{{#if floorRes.daPei}}
<div class="big-title">
搭配
<span class="iconfont">MORE&nbsp;&#xe604;</span>
<a class="iconfont" href="//guang.m.yohobuy.com/?type=2">MORE&nbsp;&#xe604;</a>
</div>
<div class="swiper-collocation">
<div class="swiper-container">
<div class="swiper-wrapper">
{{# floorRes.daPei}}
<div class="swiper-slide">
<img src="http://img10.static.yhbimg.com/article/2017/10/23/16/01b08f8dee3abc9025cd677e46d875a6b9.jpg" />
<p class="eps-2">把自己的星座穿在身上,这样的高街风你喜欢吗?</p>
</div>
<div class="swiper-slide">
<img src="http://img10.static.yhbimg.com/article/2017/10/23/16/01b08f8dee3abc9025cd677e46d875a6b9.jpg" />
<p class="eps-2">把自己的星座穿在身上,这样的高街风你喜欢吗?</p>
</div>
<div class="swiper-slide">
<img src="http://img10.static.yhbimg.com/article/2017/10/23/16/01b08f8dee3abc9025cd677e46d875a6b9.jpg" />
<p class="eps-2">把自己的星座穿在身上,这样的高街风你喜欢吗?</p>
</div>
<div class="swiper-slide">
<img src="http://img10.static.yhbimg.com/article/2017/10/23/16/01b08f8dee3abc9025cd677e46d875a6b9.jpg" />
<p class="eps-2">把自己的星座穿在身上,这样的高街风你喜欢吗?</p>
</div>
<div class="swiper-slide">
<img src="http://img10.static.yhbimg.com/article/2017/10/23/16/01b08f8dee3abc9025cd677e46d875a6b9.jpg" />
<p class="eps-2">把自己的星座穿在身上,这样的高街风你喜欢吗?</p>
<a href="//guang.m.yohobuy.com/info/index?id={{id}}">
<img src="{{image2 src w=590 h=370 q=60}}" />
<p class="eps-2">{{title}}</p>
</a>
</div>
{{/ floorRes.daPei}}
</div>
</div>
</div>
{{/if}}
<div class="big-title">
限定
<span class="iconfont">MORE&nbsp;&#xe604;</span>
... ... @@ -234,33 +141,25 @@
<div class="swiper-pagination"></div>
</div>
</div>
{{#if floorRes.haoHuo}}
<div class="big-title">
好货
<span class="iconfont">MORE&nbsp;&#xe604;</span>
</div>
<div class="goods-list clearfix">
{{# floorRes.haoHuo}}
<div class="goods-item">
<img src="http://img10.static.yhbimg.com/yhb-img01/2017/10/27/12/01fee21a2b9808e42f02ad2217b59a1491.jpg" />
<div class="info">
<p class="name eps-2 eps-3">DICKES从1922年诞生之日起就旨在出品高品质的穿着体验!</p>
<p class="tips">#潮流行动#</p>
</div>
</div>
<div class="goods-item">
<img src="http://img10.static.yhbimg.com/yhb-img01/2017/10/27/12/01fee21a2b9808e42f02ad2217b59a1491.jpg" />
<div class="info">
<p class="name eps-2 eps-3">DICKES从1922年诞生之日起就旨在出品高品质的穿着体验!</p>
<p class="tips">#潮流行动#</p>
</div>
</div>
<div class="goods-item">
<img src="http://img10.static.yhbimg.com/yhb-img01/2017/10/27/12/01fee21a2b9808e42f02ad2217b59a1491.jpg" />
<div class="info">
<p class="name eps-2 eps-3">DICKES从1922年诞生之日起就旨在出品高品质的穿着体验!</p>
<p class="tips">#潮流行动#</p>
</div>
<a href="//guang.m.yohobuy.com/info/index?id={{id}}">
<img src="{{image2 src w=360 h=224 q=60}}" />
<div class="info">
<p class="name eps-2 eps-3">{{title}}</p>
<p class="tips">#潮流行动#</p>
</div>
</a>
</div>
{{/ floorRes.haoHuo}}
</div>
{{/if}}
<div class="big-title">
人物
<span class="iconfont">MORE&nbsp;&#xe604;</span>
... ... @@ -317,11 +216,11 @@
</div>
</div>
</div>
<div class="big-title">
<div class="big-title hide">
<span class="iconfont">MORE&nbsp;&#xe604;</span>
</div>
<div class="guang-list">
<div class="guang-list hide">
<div class="guang-item">
<div class="page-c">
<img src="http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg" />
... ... @@ -331,33 +230,8 @@
</div>
</div>
</div>
<div class="guang-item">
<div class="page-c">
<img src="http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg" />
<div class="info">
<p class="name eps-2">DICKIES从诞生之日起就旨在出品高品质DICKIES从诞生之日起就旨在出品高品质</p>
<p class="type">3潮流</p>
</div>
</div>
</div>
</div>
<div class="trend-list">
<div class="trend-item">
<img src="http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg" />
<p class="intro eps-2">虽然每一年说流行这个那个颜色,但是相信很多潮人穿上身的还是逃不开黑白灰,真是无趣的要...</p>
<div class="auther">
<div class="pic" style="background-image:url(http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg)"></div>
<div class="name">川本小一</div>
</div>
</div>
<div class="trend-item">
<img src="http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg" />
<p class="intro eps-2">虽然每一年说流行这个那个颜色,但是相信很多潮人穿上身的还是逃不开黑白灰,真是无趣的要...</p>
<div class="auther">
<div class="pic" style="background-image:url(http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg)"></div>
<div class="name">川本小一</div>
</div>
</div>
<div class="trend-list hide">
<div class="trend-item">
<img src="http://img11.static.yhbimg.com/yhb-img01/2017/10/27/11/01ea9512175a0c5795bfd01048271b654e.jpg" />
<p class="intro eps-2">虽然每一年说流行这个那个颜色,但是相信很多潮人穿上身的还是逃不开黑白灰,真是无趣的要...</p>
... ...
... ... @@ -51,7 +51,8 @@ class GuangNew extends Page {
depth: 0,
modifier: 1,
slideShadows: false
}
},
touchRatio: 0.01,
});
}
}
... ...
... ... @@ -68,9 +68,14 @@ html {
.swiper-top {
width: 750px;
height: 469px;
height: 322px;
margin-bottom: 20px;
img {
width: 100%;
height: 100%;
}
.swiper-slide {
width: 750px;
height: 100%;
... ... @@ -220,7 +225,8 @@ html {
.swiper-slide-prev {
.page-c {
height: auto !important;
opacity: 1 !important;
opacity: 0 !important;
transition: all 1s;
}
}
... ... @@ -230,7 +236,8 @@ html {
.page-c {
height: auto !important;
opacity: 1 !important;
opacity: 0 !important;
transition: all 1s;
}
}
... ... @@ -249,7 +256,7 @@ html {
.swiper-slide {
width: 590px;
height: 100%;
margin-right: 30px;
margin: 0 15px;
img {
width: 590px;
... ...