|
@@ -9,6 +9,8 @@ const express = require('express'); |
|
@@ -9,6 +9,8 @@ const express = require('express'); |
9
|
const router = express.Router(); // eslint-disable-line
|
9
|
const router = express.Router(); // eslint-disable-line
|
10
|
const cRoot = './controllers';
|
10
|
const cRoot = './controllers';
|
11
|
const headerModel = require('../../doraemon/models/header');
|
11
|
const headerModel = require('../../doraemon/models/header');
|
|
|
12
|
+const helpers = global.yoho.helpers;
|
|
|
13
|
+const config = global.yoho.config;
|
12
|
|
14
|
|
13
|
const personalController = require(`${cRoot}/QRcode`);
|
15
|
const personalController = require(`${cRoot}/QRcode`);
|
14
|
|
16
|
|
|
@@ -16,57 +18,65 @@ const homeNav=[ |
|
@@ -16,57 +18,65 @@ const homeNav=[ |
16
|
{
|
18
|
{
|
17
|
title:"交易管理",
|
19
|
title:"交易管理",
|
18
|
subNav:[
|
20
|
subNav:[
|
19
|
- {name:"我的订单",href:"/home/orders",active:true},
|
|
|
20
|
- {name:"我的收藏",href:"/home/favorite"},
|
|
|
21
|
- {name:"我的YOHO币",href:"/home/currency"},
|
|
|
22
|
- {name:"我的红包",href:"/home/redenvelopes"},
|
|
|
23
|
- {name:"我的优惠券",href:"/home/coupons"},
|
|
|
24
|
- {name:"我的VIP",href:"/home/vip"}
|
21
|
+ {name:"我的订单",href:helpers.urlFormat("/home/orders"),active:true},
|
|
|
22
|
+ {name:"我的收藏",href:helpers.urlFormat("/home/favorite")},
|
|
|
23
|
+ {name:"我的YOHO币",href:helpers.urlFormat("/home/currency")},
|
|
|
24
|
+ {name:"我的红包",href:helpers.urlFormat("/home/redenvelopes")},
|
|
|
25
|
+ {name:"我的优惠券",href:helpers.urlFormat("/home/coupons")},
|
|
|
26
|
+ {name:"我的VIP",href:helpers.urlFormat("/home/vip")}
|
25
|
]
|
27
|
]
|
26
|
},
|
28
|
},
|
27
|
{
|
29
|
{
|
28
|
title:"服务中心",
|
30
|
title:"服务中心",
|
29
|
subNav:[
|
31
|
subNav:[
|
30
|
- {name:"我的退/换货",href:"/home/returns"},
|
|
|
31
|
- {name:"我的咨询",href:"/home/consult"},
|
|
|
32
|
- {name:"我的评论",href:"/home/comment"},
|
|
|
33
|
- {name:"我的投诉",href:"/home/complaints"},
|
|
|
34
|
- {name:"我的信息",href:"/home/message",count:0},
|
32
|
+ {name:"我的退/换货",href:helpers.urlFormat("/home/returns")},
|
|
|
33
|
+ {name:"我的咨询",href:helpers.urlFormat("/home/consult")},
|
|
|
34
|
+ {name:"我的评论",href:helpers.urlFormat("/home/comment")},
|
|
|
35
|
+ {name:"我的投诉",href:helpers.urlFormat("/home/complaints")},
|
|
|
36
|
+ {name:"我的信息",href:helpers.urlFormat("/home/message"),count:0},
|
35
|
{name:"在线客服",href:"http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=",isBlank:true}
|
37
|
{name:"在线客服",href:"http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=",isBlank:true}
|
36
|
]
|
38
|
]
|
37
|
},
|
39
|
},
|
38
|
{
|
40
|
{
|
39
|
title:"个人信息管理",
|
41
|
title:"个人信息管理",
|
40
|
subNav:[
|
42
|
subNav:[
|
41
|
- {name:"编辑个人资料",href:"/home/user"},
|
|
|
42
|
- {name:"账号安全",href:"/home/account"},
|
|
|
43
|
- {name:"地址管理",href:"/home/address"},
|
|
|
44
|
- {name:"兑换礼品卡",href:"/home/gift"}
|
43
|
+ {name:"编辑个人资料",href:helpers.urlFormat("/home/user")},
|
|
|
44
|
+ {name:"账号安全",href:helpers.urlFormat("/home/account")},
|
|
|
45
|
+ {name:"地址管理",href:helpers.urlFormat("/home/address")},
|
|
|
46
|
+ {name:"兑换礼品卡",href:helpers.urlFormat("/home/gift")}
|
45
|
]
|
47
|
]
|
46
|
}
|
48
|
}
|
47
|
];
|
49
|
];
|
48
|
|
50
|
|
49
|
- function getHomeNav(req, res, next){
|
51
|
+const getHomeNav = (req, res, next) => {
|
50
|
res.locals.homeNav=homeNav;
|
52
|
res.locals.homeNav=homeNav;
|
51
|
res.locals.userThumb='//img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
|
53
|
res.locals.userThumb='//img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
|
52
|
next();
|
54
|
next();
|
53
|
- }
|
|
|
54
|
- function getCommonHeader(req, res, next){
|
55
|
+}
|
|
|
56
|
+const getCommonHeader= (req, res, next) => {
|
55
|
let channel = req.query.channel ? req.query.channel : 'boys';
|
57
|
let channel = req.query.channel ? req.query.channel : 'boys';
|
56
|
headerModel.requestHeaderData(channel).then((result)=>{
|
58
|
headerModel.requestHeaderData(channel).then((result)=>{
|
57
|
res.locals.headerData=result;
|
59
|
res.locals.headerData=result;
|
58
|
next();
|
60
|
next();
|
59
|
});
|
61
|
});
|
60
|
- }
|
|
|
61
|
- function sessionEffective(req, res, next){
|
62
|
+}
|
|
|
63
|
+const sessionEffective= (req, res, next) => {
|
62
|
if(req.user.uid){
|
64
|
if(req.user.uid){
|
63
|
next();
|
65
|
next();
|
64
|
}
|
66
|
}
|
65
|
- res.redirect(global.yoho.urlFormat("signin.html",{
|
|
|
66
|
- refer:"%2F%2Fwww.yohobuy.com%2Fhome%2Forders"
|
|
|
67
|
- }));
|
67
|
+ let refer = req.cookies.refer;
|
|
|
68
|
+
|
|
|
69
|
+ if (refer) {
|
|
|
70
|
+ refer = decodeURI(req.cookies.refer);
|
|
|
71
|
+ } else {
|
|
|
72
|
+ refer = config.siteUrl;
|
68
|
}
|
73
|
}
|
69
|
-// 专题活动
|
|
|
70
|
-router.get('/QRcode/:id',[sessionEffective,getCommonHeader,getHomeNav],personalController.QRcode);
|
74
|
+ // res.redirect(helpers.urlFormat('/signin.html', {
|
|
|
75
|
+ // refer: refer
|
|
|
76
|
+ // }));
|
|
|
77
|
+ next();
|
|
|
78
|
+}
|
|
|
79
|
+// 查看二维码
|
|
|
80
|
+router.get('/QRcode/:id',sessionEffective,[getCommonHeader,getHomeNav],personalController.QRcode);
|
71
|
|
81
|
|
72
|
module.exports = router; |
82
|
module.exports = router; |