Authored by zhangxiaoru

plustarDetail

... ... @@ -9,18 +9,17 @@ 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
boys: '1,3',
girl: '2,3',
kids: '3,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);
console.log(gender)
plustarModel.getListData(gender, recom, all).then((result) => {
... ... @@ -41,6 +40,36 @@ const getListData = (req, res, next) => {
}).catch(next);
};
const getDetailData = (req, res, next) => {
let id = req.query.id || 342;
let uid = req.user.uid;
let udid = req.sessionID;
let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || '1,3';
let isApp = req.query.app_version || req.query.appVersion || false;
let clientType = req.body.client_type || '';
if (clientType.toLowerCase() === 'ios' && version) {
clientType = 'iphone';
} else if (clientType.toLowerCase() === 'android' && version) {
clientType = 'android';
} else {
clientType = 'h5';
}
plustarModel.getDetailData(id, uid, udid, gender, isApp, clientType).then((result) => {
res.render('plustar/detail', {
module: 'guang',
page: 'plustar-detail',
pageHeader: headerModel.setNav({
navTitle: '品牌介绍'
}),
pageFooter: true,
ps: result
});
}).catch(next);
};
module.exports = {
getListData
getListData,
getDetailData
};
... ...
... ... @@ -3,6 +3,8 @@ const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const _ = require('lodash');
const productProcess = require('../../../utils/product-process');
const logger = global.yoho.logger;
const camelCase = global.yoho.camelCase;
const formaData = (data, gender) => {
let build = [];
... ... @@ -64,8 +66,6 @@ const getContentData = (gender, type) => {
});
};
const getListData = (gender, recom, all) => {
return Promise.all([getContentData(gender, recom), getContentData(gender, all)]).then((result) => {
return {
... ... @@ -75,7 +75,37 @@ const getListData = (gender, recom, all) => {
});
};
const getRelatedEditorial = () => {
};
const getBrandData = (id, clientType) => {
return serviceAPI.get('guang/api/v1/plustar/getbrandinfo', {
id: id,
client_type: clientType
}).then((result) => {
if (result && result.code === 200) {
//console.log(result.data)
return camelCase(result.data);
} else {
logger.error('detail data return code is not 200');
return {};
}
});
};
const getDetailData = (id, uid, udid, gender, isApp, clientType) => {
return Promise.all([getBrandData(id, clientType), getRelatedEditorial(gender)]).then((result) => {
return result;
});
};
module.exports = {
getListData,
getContentData
getContentData,
getDetailData
};
... ...
... ... @@ -41,6 +41,7 @@ router.get('/info/index', info.index); // 逛详情页
router.get('/info/mini', info.mini); // 逛mini内容页
router.get('/info/foryoho', info.foryoho); // 逛foryoho内容页
router.get('/plustar', plustar.getListData); // 国际优选
router.get('/plustar', plustar.getListData); // 国际优选列表页
router.get('/plustar/brandinfo', plustar.getDetailData); // 国际优选详情页
module.exports = router;
... ...
<div class="ps-detail-page ps-page yoho-page">
{{# ps}}
<div id="brand-info" class="header brand-info ps-block" data-id="{{brandId}}">
<img class="banner lazy" src="{{image coverImg 640 309}}">
<img class="logo lazy" data-original="{{brandIco}}">
<div class="header-content clearfix">
<p class="name-islike-container">
<span class="name">{{brandName}}</span>
<a id="brand-like" class="brand-islike iconfont {{# isLike}}like{{/ isLike}}" href="{{likeUrl}}">
&#xe605;
</a>
</p>
<div id="more-intro-click-range" class="clearfix">
<p id="intro" class="intro">
{{{brandIntro}}}
</p>
{{#if brandIntro}}
<span id="more-intro" class="more-intro">
<span id="intro-more-txt">more</span>
<i class="icon iconfont">&#xe609;</i>
</span>
{{/if}}
</div>
</div>
</div>
{{# newArrival}}
<div class="new-arrival ps-block">
<div class="floor-header-more">
<h2>NEW ARRIVAL</h2>
<a class="more-btn iconfont buriedpoint" href="{{moreUrl}}" data-bp-id="shop_more_btn_0">&#xe606;</a>
</div>
<div class="new-arrival-content clearfix">
{{# naList}}
{{> good}}
{{/ naList}}
</div>
<div class="more-goods-container">
<a class="mg-text" href="{{moreUrl}}">
更多商品
<span class="more-prods iconfont">&#xe604;</span>
</a>
</div>
</div>
{{/ newArrival}}
{{#if infos}}
<div class="related-infos ps-block">
<div>
<h2 class="related-info-title">相关资讯</h2>
</div>
<div id="related-infos-container" class="related-infos-container">
{{# infos}}
{{> guang/info}}
{{/ infos}}
</div>
</div>
{{/if}}
<input id="jump-to-app" type="hidden" value="{{jumpToApp}}">
{{!-- wx-share --}}
<input id="shareLink" type="hidden" value="{{shareLink}}">
<input id="shareImg" type="hidden" value="{{shareImg}}">
<input id="shareTitle" type="hidden" value="{{shareTitle}}">
<input id="shareDesc" type="hidden" value="{{shareDesc}}">
{{/ ps}}
</div>
\ No newline at end of file
... ...