Authored by weiqingting

update

@@ -8,13 +8,16 @@ @@ -8,13 +8,16 @@
8 8
9 const _ = require('lodash'); 9 const _ = require('lodash');
10 const QRcodeModel = require('../models/QRcode'); 10 const QRcodeModel = require('../models/QRcode');
  11 +const helpers = global.yoho.helpers;
11 12
12 exports.QRcode = (req, res) => { 13 exports.QRcode = (req, res) => {
13 let id = req.params.id || 0; 14 let id = req.params.id || 0;
14 QRcodeModel.getQRcodeData(id).then((result)=>{ 15 QRcodeModel.getQRcodeData(id).then((result)=>{
15 let vm={ 16 let vm={
16 - path:[{href:"//www.yohobuy.com",name:"YOHO!BUY 有货首页"},{name:"个人中心"},{name:"查看二维码"}],  
17 - qrcodeData:{} 17 + path:[{href:helpers.urlFormat("/"),name:"YOHO!BUY 有货首页"},{name:"个人中心"},{name:"查看二维码"}],
  18 + qrcodeData:{},
  19 + code:id,
  20 + returnOrder:helpers.urlFormat("/home/orders?type=1")
18 }; 21 };
19 res.render('QRcode',vm); 22 res.render('QRcode',vm);
20 }).catch((err) => { 23 }).catch((err) => {
@@ -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;
@@ -6,17 +6,17 @@ @@ -6,17 +6,17 @@
6 <h2 class="title"> 6 <h2 class="title">
7 </h2> 7 </h2>
8 <div class='subtitle'> 8 <div class='subtitle'>
9 - <h2>虚拟商品 <span class='pad20'>2016 YO'HOOD</span>展览票 8866886008</h2>  
10 - <a class='r-go'>返回我的账单</a> 9 + <h2>虚拟商品 <span class='pad20'>2016 YO'HOOD</span>展览票 {{code}}</h2>
  10 + <a class='r-go' href="{{returnOrder}}">返回我的账单</a>
11 </div> 11 </div>
12 {{#qrcodeData}} 12 {{#qrcodeData}}
13 <div class='qrcmain'> 13 <div class='qrcmain'>
14 <div class="qrcmain-switch"> 14 <div class="qrcmain-switch">
15 <a class="prev gray" href="javascript:;"> 15 <a class="prev gray" href="javascript:;">
16 - <span class="iconfont">&#xe60c;</span> 16 + <span class="iconfont">&#xe60e;</span>
17 </a> 17 </a>
18 <a class="next" href="javascript:;"> 18 <a class="next" href="javascript:;">
19 - <span class="iconfont">&#xe60b;</span> 19 + <span class="iconfont">&#xe60c;</span>
20 </a> 20 </a>
21 </div> 21 </div>
22 <div class='qrcim'> 22 <div class='qrcim'>
@@ -10,20 +10,20 @@ const service = require('../models/back-service'); @@ -10,20 +10,20 @@ const service = require('../models/back-service');
10 const passportHelper = require('../models/passport-helper'); 10 const passportHelper = require('../models/passport-helper');
11 const _ = require('lodash'); 11 const _ = require('lodash');
12 12
13 -helpers.urlFormat = (url, qs) => {  
14 - let localhost = 'http://localhost:6002'; 13 +// helpers.urlFormat = (url, qs) => {
  14 +// let localhost = 'http://localhost:6002';
15 15
16 - if (_.isEmpty(qs)) {  
17 - return localhost + url;  
18 - } 16 +// if (_.isEmpty(qs)) {
  17 +// return localhost + url;
  18 +// }
19 19
20 - const queryString = require('queryString'); 20 +// const queryString = require('queryString');
21 21
22 - let str = queryString.stringify(qs); 22 +// let str = queryString.stringify(qs);
23 23
24 - return localhost + url + '?' + str; 24 +// return localhost + url + '?' + str;
25 25
26 -}; 26 +// };
27 27
28 /** 28 /**
29 * 找回密码主页面 29 * 找回密码主页面
@@ -14,5 +14,5 @@ module.exports = app => { @@ -14,5 +14,5 @@ module.exports = app => {
14 app.use('/product', require('./apps/product')); // 商品相关页面 14 app.use('/product', require('./apps/product')); // 商品相关页面
15 app.use('/passport', require('./apps/passport')); // 登录注册 15 app.use('/passport', require('./apps/passport')); // 登录注册
16 16
17 - app.use('/home', require('./apps/home')); // 登录注册 17 + app.use('/home', require('./apps/home')); // 会员中心
18 }; 18 };
@@ -32,9 +32,13 @@ @@ -32,9 +32,13 @@
32 .p1{ 32 .p1{
33 padding-bottom: 10px; 33 padding-bottom: 10px;
34 font-weight: 700; 34 font-weight: 700;
  35 + padding-left: 25px;
  36 + background: resolve(img/home/qr-tip.png) no-repeat -22px 3px;
35 } 37 }
36 .gray{ 38 .gray{
37 color:#8e8e8e; 39 color:#8e8e8e;
  40 + padding-left: 25px;
  41 + background: resolve(img/home/qr-tip.png) no-repeat 3px -24px;
38 } 42 }
39 } 43 }
40 .qrcmain{ 44 .qrcmain{