Authored by zhangxiaoru

guang list 数据重复

... ... @@ -17,12 +17,14 @@ const indexModel = require('../models/brand');
* @param int channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道
*/
let index = (req, res, next) => {
let genders = req.cookies._Channel || 'boys';
let responseData = {
module: 'channel',
page: 'brand',
// title: '品牌一览 | Yoho!Buy有货 | 潮流购物逛不停',
showFooterTab: footerModel.getUrlData('category')
showFooterTab: footerModel.getUrlData('category', genders)
};
let param = {
... ...
... ... @@ -7,6 +7,8 @@ const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab
const helpers = global.yoho.helpers;
let index = (req, res, next) => {
let gender = req.cookies._Channel || 'boys';
cateModel.getCateData(req.yoho.channel).then((result) => {
res.render('cate', {
module: 'channel',
... ... @@ -18,7 +20,7 @@ let index = (req, res, next) => {
list: result.list,
searchUrl: helpers.urlFormat('/search', null, 'search')
},
showFooterTab: footerModel.getUrlData('category')
showFooterTab: footerModel.getUrlData('category', gender)
});
}).catch(next);
};
... ...
... ... @@ -11,16 +11,19 @@ const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab
const helpers = global.yoho.helpers;
let _renderData = {
let _renderData = (gender) => {
return {
module: 'channel',
page: 'home',
homeHeader: {
searchUrl: helpers.urlFormat('/search', null, 'search')
},
maybeLike: true,
showFooterTab: footerModel.getUrlData('home'),
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
}));
});
... ...
... ... @@ -153,11 +153,14 @@ const pageData = (req, res, next) => {
* @param next
*/
const index = (req, res, next) => {
let gender = req.cookies._Channel || 'boys';
let responseData = {
module: 'guang',
page: 'index',
title: '逛 | Yoho!Buy有货 | 潮流购物逛不停',
showFooterTab: footerModel.getUrlData('guang')
showFooterTab: footerModel.getUrlData('guang', gender)
};
let param = {
... ...
... ... @@ -180,7 +180,7 @@ const getArticle = (param) => {
let resu = {
guang: {
gender: param.gender,
}
};
... ...
... ... @@ -23,6 +23,8 @@ exports.index = (req, res, next) => {
udid: require('md5')(req.ip)
};
let gender = req.cookies._Channel || 'boys';
indexModel.index(params).then(result => {
if (result) {
res.render('home', Object.assign(result, {
... ... @@ -34,7 +36,7 @@ exports.index = (req, res, next) => {
pageChannel: {
boys: true
},
showFooterTab: footerModel.getUrlData('mine')
showFooterTab: footerModel.getUrlData('mine', gender)
}));
}
}).catch(next);
... ...
... ... @@ -8,11 +8,18 @@
const helpers = global.yoho.helpers;
exports.getUrlData = function(type) {
let channels = {
boys: '1,3',
girls: '2,3',
kids: '1,2,3',
lifestyle: '1,2,3'
};
exports.getUrlData = function(type, gender) {
const urlData = {
indexUrl: helpers.urlFormat('/?go=1'), // 首页
categoryUrl: helpers.urlFormat('/cate'), // 分类
guangUrl: helpers.urlFormat('', null, 'guang'), // 逛首页
guangUrl: helpers.urlFormat('', {'gender': channels[gender]}, 'guang'), // 逛首页
shoppingCartUrl: helpers.urlFormat('/cart/index/index'), // 购物车
mineUrl: helpers.urlFormat('/home') // 个人中心
};
... ...