...
|
...
|
@@ -11,16 +11,19 @@ const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab |
|
|
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
let _renderData = {
|
|
|
module: 'channel',
|
|
|
page: 'home',
|
|
|
homeHeader: {
|
|
|
searchUrl: helpers.urlFormat('/search', null, 'search')
|
|
|
},
|
|
|
maybeLike: true,
|
|
|
showFooterTab: footerModel.getUrlData('home'),
|
|
|
pageFooter: true
|
|
|
};
|
|
|
let _renderData = (gender) => {
|
|
|
return {
|
|
|
module: 'channel',
|
|
|
page: 'home',
|
|
|
homeHeader: {
|
|
|
searchUrl: helpers.urlFormat('/search', null, 'search')
|
|
|
},
|
|
|
maybeLike: true,
|
|
|
showFooterTab: footerModel.getUrlData('home', gender),
|
|
|
pageFooter: true
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 频道页生成函数
|
...
|
...
|
@@ -30,12 +33,14 @@ let _renderData = { |
|
|
* @return {[type]}
|
|
|
*/
|
|
|
let _channelPage = (req, res, data) => {
|
|
|
let gender = req.cookies._Channel || 'boys';
|
|
|
return channelModel.getChannelData({
|
|
|
gender: data.gender,
|
|
|
uid: _.toString(req.user.uid),
|
|
|
limit: 6// 首屏先获取前6个楼层,其余用ajax获取
|
|
|
}).then(result => {
|
|
|
_renderData.homeHeader.defaultTerms = result.defaultTerms;
|
|
|
let links = _renderData(gender);
|
|
|
links.homeHeader.defaultTerms = result.defaultTerms;
|
|
|
|
|
|
if (!result.content.length || !result.sideNav.length) {
|
|
|
res.set('Cache-Control', 'no-cache');
|
...
|
...
|
@@ -52,7 +57,7 @@ let _channelPage = (req, res, data) => { |
|
|
// }
|
|
|
// }].concat(result.content);
|
|
|
// console.log(result.content[9]);
|
|
|
res.render('channel', Object.assign({}, _renderData, data, result, {
|
|
|
res.render('channel', Object.assign({}, links, data, result, {
|
|
|
localCss: true
|
|
|
}));
|
|
|
});
|
...
|
...
|
|