Authored by 梁志锋

Merge remote-tracking branch 'origin/develop' into develop

/**
* 个人中心二维码 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
... ...
... ... @@ -44,7 +44,8 @@ module.exports = {
infoFile: {
name: 'info',
level: 'info',
filename: 'logs/info.log'
filename: 'logs/info.log',
maxFiles: 7
},
errorFile: {
name: 'error',
... ... @@ -54,7 +55,7 @@ module.exports = {
},
udp: { // send by udp
level: 'debug', // logger level
host: '192.168.102.162', // influxdb host
host: 'influxdblog.yohoops.org', // influxdb host
port: '4444' // influxdb port
},
console: {
... ...
... ... @@ -16,4 +16,5 @@ module.exports = app => {
app.use('/product', require('./apps/product'));
app.use('/guang', require('./apps/guang'));
app.use('/activity', require('./apps/activity'));
app.use('/home', require('./apps/home'));
};
... ...

47.3 KB | W: | H:

47.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
var $ = require('yoho-jquery');
var Swiper = require('yoho-swiper');
var mySwiper;
mySwiper = new Swiper('.swiper-container', {
onSlideChangeEnd: function(swiper) {
$('.pagec').html(swiper.snapIndex + 1);
}
});
$('.prev').click(function() {
mySwiper.slidePrev();
});
$('.next').click(function() {
mySwiper.slideNext();
});
... ...
@import "qrcode";
... ...
.qrcode {
padding: 0 30px;
.qrcode-title {
margin: 30px 0;
}
.qrcode-tip {
font-size: 20px;
color: #c6c6c6;
background: url("../img/passport/info.png");
}
.qrcode-say {
color: #c6c6c6;
margin-top: 80px;
}
.qrcode-wrap {
position: relative;
.chan {
background: url("../img/channel/up-icon.png");
background-size: 40px 40px;
position: absolute;
top: 50%;
margin-top: -15px;
width: 40px;
height: 40px;
}
.prev {
left: 0;
transform: rotate(-90deg);
}
.next {
right: 0;
transform: rotate(90deg);
}
}
.qrcode-pages {
text-align: center;
padding: 30px 0;
letter-spacing: 4px;
}
.swiper-container {
width: 412px;
.qrcode-img {
width: 412px;
height: 412px;
display: block;
margin-bottom: 40px;
img {
width: 100%;
height: 100%;
display: block;
}
}
p {
line-height: 35px;
height: 35px;
}
label {
display: inline-block;
width: 148px;
text-align: right;
margin-right: 40px;
}
}
}
... ...
... ... @@ -12,4 +12,5 @@
@import "passport/index";
@import "guang/index";
@import "cart/chose-panel";
@import "home/index";
@import "me/index";
... ...