...
|
...
|
@@ -9,6 +9,8 @@ const express = require('express'); |
|
|
const router = express.Router(); // eslint-disable-line
|
|
|
const cRoot = './controllers';
|
|
|
const headerModel = require('../../doraemon/models/header');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const config = global.yoho.config;
|
|
|
|
|
|
const personalController = require(`${cRoot}/QRcode`);
|
|
|
|
...
|
...
|
@@ -16,57 +18,65 @@ const homeNav=[ |
|
|
{
|
|
|
title:"交易管理",
|
|
|
subNav:[
|
|
|
{name:"我的订单",href:"/home/orders",active:true},
|
|
|
{name:"我的收藏",href:"/home/favorite"},
|
|
|
{name:"我的YOHO币",href:"/home/currency"},
|
|
|
{name:"我的红包",href:"/home/redenvelopes"},
|
|
|
{name:"我的优惠券",href:"/home/coupons"},
|
|
|
{name:"我的VIP",href:"/home/vip"}
|
|
|
{name:"我的订单",href:helpers.urlFormat("/home/orders"),active:true},
|
|
|
{name:"我的收藏",href:helpers.urlFormat("/home/favorite")},
|
|
|
{name:"我的YOHO币",href:helpers.urlFormat("/home/currency")},
|
|
|
{name:"我的红包",href:helpers.urlFormat("/home/redenvelopes")},
|
|
|
{name:"我的优惠券",href:helpers.urlFormat("/home/coupons")},
|
|
|
{name:"我的VIP",href:helpers.urlFormat("/home/vip")}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
title:"服务中心",
|
|
|
subNav:[
|
|
|
{name:"我的退/换货",href:"/home/returns"},
|
|
|
{name:"我的咨询",href:"/home/consult"},
|
|
|
{name:"我的评论",href:"/home/comment"},
|
|
|
{name:"我的投诉",href:"/home/complaints"},
|
|
|
{name:"我的信息",href:"/home/message",count:0},
|
|
|
{name:"我的退/换货",href:helpers.urlFormat("/home/returns")},
|
|
|
{name:"我的咨询",href:helpers.urlFormat("/home/consult")},
|
|
|
{name:"我的评论",href:helpers.urlFormat("/home/comment")},
|
|
|
{name:"我的投诉",href:helpers.urlFormat("/home/complaints")},
|
|
|
{name:"我的信息",href:helpers.urlFormat("/home/message"),count:0},
|
|
|
{name:"在线客服",href:"http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=",isBlank:true}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
title:"个人信息管理",
|
|
|
subNav:[
|
|
|
{name:"编辑个人资料",href:"/home/user"},
|
|
|
{name:"账号安全",href:"/home/account"},
|
|
|
{name:"地址管理",href:"/home/address"},
|
|
|
{name:"兑换礼品卡",href:"/home/gift"}
|
|
|
{name:"编辑个人资料",href:helpers.urlFormat("/home/user")},
|
|
|
{name:"账号安全",href:helpers.urlFormat("/home/account")},
|
|
|
{name:"地址管理",href:helpers.urlFormat("/home/address")},
|
|
|
{name:"兑换礼品卡",href:helpers.urlFormat("/home/gift")}
|
|
|
]
|
|
|
}
|
|
|
];
|
|
|
|
|
|
function getHomeNav(req, res, next){
|
|
|
res.locals.homeNav=homeNav;
|
|
|
res.locals.userThumb='//img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
|
|
|
next();
|
|
|
}
|
|
|
function getCommonHeader(req, res, next){
|
|
|
const getHomeNav = (req, res, next) => {
|
|
|
res.locals.homeNav=homeNav;
|
|
|
res.locals.userThumb='//img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
|
|
|
next();
|
|
|
}
|
|
|
const getCommonHeader= (req, res, next) => {
|
|
|
let channel = req.query.channel ? req.query.channel : 'boys';
|
|
|
headerModel.requestHeaderData(channel).then((result)=>{
|
|
|
res.locals.headerData=result;
|
|
|
next();
|
|
|
});
|
|
|
}
|
|
|
function sessionEffective(req, res, next){
|
|
|
if(req.user.uid){
|
|
|
next();
|
|
|
}
|
|
|
res.redirect(global.yoho.urlFormat("signin.html",{
|
|
|
refer:"%2F%2Fwww.yohobuy.com%2Fhome%2Forders"
|
|
|
}));
|
|
|
}
|
|
|
// 专题活动
|
|
|
router.get('/QRcode/:id',[sessionEffective,getCommonHeader,getHomeNav],personalController.QRcode);
|
|
|
}
|
|
|
const sessionEffective= (req, res, next) => {
|
|
|
if(req.user.uid){
|
|
|
next();
|
|
|
}
|
|
|
let refer = req.cookies.refer;
|
|
|
|
|
|
if (refer) {
|
|
|
refer = decodeURI(req.cookies.refer);
|
|
|
} else {
|
|
|
refer = config.siteUrl;
|
|
|
}
|
|
|
// res.redirect(helpers.urlFormat('/signin.html', {
|
|
|
// refer: refer
|
|
|
// }));
|
|
|
next();
|
|
|
}
|
|
|
// 查看二维码
|
|
|
router.get('/QRcode/:id',sessionEffective,[getCommonHeader,getHomeNav],personalController.QRcode);
|
|
|
|
|
|
module.exports = router; |
...
|
...
|
|