Authored by weiqingting

删除文件名称

/**
* 个人中心二维码 controller
* @author: weiqingting<qingting.wei@yoho.cn>
* @date: 2016/05/16
*/
'use strict';
const QRcodeModel = require('../models/qrcode');
exports.QRcode = (req, res, next) => {
let id = req.params.id || 0;
QRcodeModel.getQRcodeData(id, req.user.uid).then((result)=>{
if (result) {
result.ticks = result.ticks.map(item=>{
if (+item.ticket_type === 2) {
item.isgroup = true;
}
return item;
});
}
let vm = {
qrcodeData: result
};
res.render('QRcode', vm);
}).catch(next);
};
/**
* sub app coupon
* @author: lixia.zhang<lixia.zhang@yoho.cn>
* @date: 2016/05/31
*/
var express = require('express'),
path = require('path'),
hbs = require('express-handlebars');
var app = express();
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
app.on('mount', function(parent) {
delete parent.locals.settings; // 不继承父 App 的设置
Object.assign(app.locals, parent.locals);
});
app.set('views', path.join(__dirname, 'views/action'));
app.engine('.hbs', hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: ['./views/partial', `${doraemon}/partial`],
helpers: global.yoho.helpers
}));
// router
app.use(require('./router'));
module.exports = app;
/**
* 个人中心二维码 model
* @author: weiqingting<qingting.wei@yoho.cn>
* @date: 2016/05/16
*/
'use strict';
const logger = global.yoho.logger;
var api = global.yoho.API;
exports.getQRcodeData = (id, uid) => {
return api.get('', {
method: 'app.SpaceOrders.getQrByOrderCode',
order_code: id,
uid: uid
}).then(result => {
if (result && result.code === 200) {
return result.data;
} else {
logger.error(`查看二维码ID: ${id} 接口返回数据错误`);
return false;
}
});
};
/**
* router of sub app product
* @author: weiqingting<qingting.wei@yoho.cn>
* @date: 2016/05/06
*/
'use strict';
const express = require('express');
const router = express.Router(); // eslint-disable-line
const cRoot = './controllers';
const personalController = require(`${cRoot}/qrcode`);
// 查看二维码
router.get('/QRcode/:id', personalController.QRcode);
module.exports = router;
<header id="yoho-header" class="yoho-header boys">
<a href="javascript:history.go(-1);" class="iconfont nav-back"></a>
<p class="nav-title">查看二维码</p>
</header>
<div class="qrcode yoho-page">
<h2 class='qrcode-title'>2016 非常潮流盛世 YO'HOOD门票(限量)1件</h2>
<p class='qrcode-tip'>提示:凭借二维码入场,每场二维码只可使用一次,请妥善保管。</p>
<div class='qrcode-wrap'>
{{#qrcodeData}}
<p class='qrcode-pages'><a class='pagec'>1</a>/{{ticks.length}}</p>
<a class='prev chan'></a>
<a class='next chan'></a>
<div class="swiper-container">
<div class="swiper-wrapper">
{{#each ticks}}
<div class="swiper-slide">
<a class='qrcode-img'><img src="{{qr_image}}"></a>
<p><label class='t'>编号:</label>{{ticket_code}}</p>
{{#if isgroup}}
<p><label class='t'>座位号:</label>{{seat_no}}</p>
{{/if}}
<p><label class='t'>进场时间:</label>{{entrance_time}}</p>
</div>
{{/each}}
</div>
</div>
{{/qrcodeData}}
</div>
</div>
\ No newline at end of file