Authored by zhangxiaoru

plustar

/**
* 国际优选
* @author: zxr<xiaoru.zhang@yoho.cn>
* @date: 2016/09/12
*/
'use strict';
const mRoot = '../models';
const plustarModel = require(`${mRoot}/plustar`);
const headerModel = require('../../../doraemon/models/header'); // 头部model
// let channels = {
// boys: 1,
// girl: 2,
// kids: 3,
// lifestyle: 4
// };
const getListData = (req, res, next) => {
let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1;
let recom = '4';
let all = '1';
//console.log(gender);
plustarModel.getListData(gender, recom, all).then((result) => {
res.render('plustar/list', {
module: 'plustar',
page: 'list',
pageHeader: headerModel.setNav({
navTitle: '国际优选'
}),
ps: {
sName: '设计师',
pName: '经典潮牌'
}
});
}).catch(next);
};
module.exports = {
getListData
};
\ No newline at end of file
... ...
'use strict';
const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const _ = require('lodash');
const productProcess = require('../../../utils/product-process');
const getContentData = (gender, type) => {
return serviceAPI.get('guang/api/v3/plustar/getlist', {
gender: gender,
brand_type: type
}).then((result) => {
if (result && result.code === 200) {
//console.log(result)
return result;
} else {
logger.error('列表 list data return code is not 200');
return {};
}
});
};
const getListData = (gender, recom, all) => {
return Promise.all([getContentData(gender, recom), getContentData(gender, all)]).then((result) => {
return {
star: result[0],
plus: result[1]
};
});
};
module.exports = {
getListData,
getContentData
};
\ No newline at end of file
... ...
... ... @@ -13,6 +13,7 @@ const plusstar = require(cRoot + '/plusstar');
const index = require(cRoot + '/index');
const opt = require(cRoot + '/opt');
const info = require(cRoot + '/info');
const plustar = require(cRoot + '/plustar');
const router = express.Router(); // eslint-disable-line
... ... @@ -38,4 +39,6 @@ router.post('/opt/praiseArticle', opt.praiseArticle); // 资讯文章点赞 (H5
router.get('/info/index', info.index); // 逛详情页
router.get('/plustar', plustar.getListData); //国际优选
module.exports = router;
... ...
<div class="ps-list-page ps-page yoho-page">
{{# ps}}
<ul id="nav-tab" class="nav-tab clearfix">
<li class="star-nav focus">{{sName}}</li>
<li class="plus-nav">{{pName}}</li>
</ul>
<div id="ps-content" class="ps-content">
<ul class="star-content content">
{{# star}}
{{> ps_item}}
{{/ star}}
</ul>
<ul class="plus-content content hide">
{{# plus}}
{{> guang/ps_item}}
{{/ plus}}
</ul>
</div>
{{/ ps}}
</div>
\ No newline at end of file
... ...
<li class="plus-star-row">
{{#if imgs}}
<div class="swiper-container">
<div class="swiper-wrapper">
{{# imgs}}
<div class="swiper-slide">
<a href={{url}}>
<img class="swiper-lazy" data-src={{img}}>
</a>
</div>
{{/ imgs}}
</div>
<div class="swiper-pagination">
<div class="pagination-inner">
</div>
</div>
</div>
{{^}}
<a href={{url}}>
<img class="lazy" data-original={{img}}>
</a>
{{/if}}
{{# deps}}
<p class="brand-deps">{{.}}</p>
{{/ deps}}
</li>
\ No newline at end of file
... ...