Authored by weiqingting

fixed qrcode

... ... @@ -12,6 +12,15 @@ const helpers = global.yoho.helpers;
exports.QRcode = (req, res, next) => {
let id = req.query.orderCode || 0;
let bg={
'16-1':'//img13.static.yhbimg.com/yhb-img02/2016/07/28/14/02509790c87f7b26fc523fc81cdd2ee684.jpg',
'17-1':'//img13.static.yhbimg.com/yhb-img02/2016/07/28/14/02509790c87f7b26fc523fc81cdd2ee684.jpg',
'16-2':'//img13.static.yhbimg.com/yhb-img02/2016/07/28/14/0243ee8b76d1af13fe546b3538036ab3a9.jpg',
'17-2':'//img13.static.yhbimg.com/yhb-img02/2016/07/28/14/028d1fa99a0a22d882587aa0a309b41637.jpg'
}
let bgkey='16-1';
QRcodeModel.getQRcodeData(id,req.user.uid).then((result)=>{
if (result) {
result.ticks = result.ticks.map(item=>{
... ... @@ -20,12 +29,16 @@ exports.QRcode = (req, res, next) => {
}
return item;
});
if(result.ticks.length){
bgkey=[/月(\d+)/g.exec(result.ticks[0].entrance_time)[1],result.ticks[0].ticket_type].join('-');
}
}
let vm = {
path: [{href: helpers.urlFormat('/'), name: 'YOHO!BUY 有货首页'}, {name: '个人中心'},{name: '订单中心'}, {name: '查看二维码'}],
qrcodeData: result,
code: id,
bgsrc:bg[bgkey],
returnOrder: helpers.urlFormat('/home/orders')
};
... ...
... ... @@ -76,12 +76,12 @@ const sessionEffective = (req, res, next) => {
refer = config.siteUrl;
}
// res.redirect(helpers.urlFormat('/signin.html', {
// refer: refer
// }));
res.redirect(helpers.urlFormat('/signin.html', {
refer: refer
}));
};
// 查看二维码
router.get('/QRcode', sessionEffective, [getCommonHeader, getHomeNav], personalController.QRcode);
router.get('/QRcode',sessionEffective,[getHomeNav,getCommonHeader],personalController.QRcode);
module.exports = router;
... ...
... ... @@ -76,7 +76,7 @@
</div>
<div id="print_wrap" style='display:none'>
<div class='print_qrcode'>
<img src="//img13.static.yhbimg.com/yhb-img02/2016/07/26/14/0294ebae2eb2e865d2f6f352d9bd4d4a1b.png"/>
<img src="{{bgsrc}}"/>
<div class='print_content'>
</div>
</div>
... ...
... ... @@ -49,7 +49,6 @@ $('.btn-qcode').click(function() {
$('.center', '.qrctxt').each(function() {
html.push('<li>');
var src = $(this).find('img').attr('src');
html.push('<img src=\'' + src + '\'/>');
var bianhao = $(this).find('.bianhao').text();
html.push('<p>' + bianhao + '</p>');
var zuoweihao = $(this).find('.zuoweihao').text();
... ... @@ -62,6 +61,8 @@ $('.btn-qcode').click(function() {
$('.print_content').html(html.join(''));
document.body.innerHTML = $('#print_wrap').show().html();
window.print();
setTimeout(function(argument) {
window.print();
},1000);
return false;
});
... ...