Authored by weiqingting

update

... ... @@ -8,13 +8,16 @@
const _ = require('lodash');
const QRcodeModel = require('../models/QRcode');
const helpers = global.yoho.helpers;
exports.QRcode = (req, res) => {
let id = req.params.id || 0;
QRcodeModel.getQRcodeData(id).then((result)=>{
let vm={
path:[{href:"//www.yohobuy.com",name:"YOHO!BUY 有货首页"},{name:"个人中心"},{name:"查看二维码"}],
qrcodeData:{}
path:[{href:helpers.urlFormat("/"),name:"YOHO!BUY 有货首页"},{name:"个人中心"},{name:"查看二维码"}],
qrcodeData:{},
code:id,
returnOrder:helpers.urlFormat("/home/orders?type=1")
};
res.render('QRcode',vm);
}).catch((err) => {
... ...
... ... @@ -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){
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();
}
function getCommonHeader(req, res, 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){
}
const sessionEffective= (req, res, next) => {
if(req.user.uid){
next();
}
res.redirect(global.yoho.urlFormat("signin.html",{
refer:"%2F%2Fwww.yohobuy.com%2Fhome%2Forders"
}));
let refer = req.cookies.refer;
if (refer) {
refer = decodeURI(req.cookies.refer);
} else {
refer = config.siteUrl;
}
// 专题活动
router.get('/QRcode/:id',[sessionEffective,getCommonHeader,getHomeNav],personalController.QRcode);
// res.redirect(helpers.urlFormat('/signin.html', {
// refer: refer
// }));
next();
}
// 查看二维码
router.get('/QRcode/:id',sessionEffective,[getCommonHeader,getHomeNav],personalController.QRcode);
module.exports = router;
... ...
... ... @@ -6,17 +6,17 @@
<h2 class="title">
</h2>
<div class='subtitle'>
<h2>虚拟商品 <span class='pad20'>2016 YO'HOOD</span>展览票 8866886008</h2>
<a class='r-go'>返回我的账单</a>
<h2>虚拟商品 <span class='pad20'>2016 YO'HOOD</span>展览票 {{code}}</h2>
<a class='r-go' href="{{returnOrder}}">返回我的账单</a>
</div>
{{#qrcodeData}}
<div class='qrcmain'>
<div class="qrcmain-switch">
<a class="prev gray" href="javascript:;">
<span class="iconfont">&#xe60c;</span>
<span class="iconfont">&#xe60e;</span>
</a>
<a class="next" href="javascript:;">
<span class="iconfont">&#xe60b;</span>
<span class="iconfont">&#xe60c;</span>
</a>
</div>
<div class='qrcim'>
... ...
... ... @@ -10,20 +10,20 @@ const service = require('../models/back-service');
const passportHelper = require('../models/passport-helper');
const _ = require('lodash');
helpers.urlFormat = (url, qs) => {
let localhost = 'http://localhost:6002';
// helpers.urlFormat = (url, qs) => {
// let localhost = 'http://localhost:6002';
if (_.isEmpty(qs)) {
return localhost + url;
}
// if (_.isEmpty(qs)) {
// return localhost + url;
// }
const queryString = require('queryString');
// const queryString = require('queryString');
let str = queryString.stringify(qs);
// let str = queryString.stringify(qs);
return localhost + url + '?' + str;
// return localhost + url + '?' + str;
};
// };
/**
* 找回密码主页面
... ...
... ... @@ -14,5 +14,5 @@ module.exports = app => {
app.use('/product', require('./apps/product')); // 商品相关页面
app.use('/passport', require('./apps/passport')); // 登录注册
app.use('/home', require('./apps/home')); // 登录注册
app.use('/home', require('./apps/home')); // 会员中心
};
... ...
... ... @@ -32,9 +32,13 @@
.p1{
padding-bottom: 10px;
font-weight: 700;
padding-left: 25px;
background: resolve(img/home/qr-tip.png) no-repeat -22px 3px;
}
.gray{
color:#8e8e8e;
padding-left: 25px;
background: resolve(img/home/qr-tip.png) no-repeat 3px -24px;
}
}
.qrcmain{
... ...