Authored by 梁志锋

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

  1 +/**
  2 + * 个人中心二维码 controller
  3 + * @author: weiqingting<qingting.wei@yoho.cn>
  4 + * @date: 2016/05/16
  5 + */
  6 +
  7 +'use strict';
  8 +
  9 +const QRcodeModel = require('../models/qrcode');
  10 +
  11 +exports.QRcode = (req, res, next) => {
  12 + let id = req.params.id || 0;
  13 +
  14 + QRcodeModel.getQRcodeData(id, req.user.uid).then((result)=>{
  15 + if (result) {
  16 + result.ticks = result.ticks.map(item=>{
  17 + if (+item.ticket_type === 2) {
  18 + item.isgroup = true;
  19 + }
  20 + return item;
  21 + });
  22 + }
  23 +
  24 + let vm = {
  25 + qrcodeData: result
  26 + };
  27 +
  28 + res.render('QRcode', vm);
  29 + }).catch(next);
  30 +};
  1 +/**
  2 + * sub app coupon
  3 + * @author: lixia.zhang<lixia.zhang@yoho.cn>
  4 + * @date: 2016/05/31
  5 + */
  6 +
  7 +var express = require('express'),
  8 + path = require('path'),
  9 + hbs = require('express-handlebars');
  10 +
  11 +var app = express();
  12 +
  13 +// set view engin
  14 +var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
  15 +
  16 +app.on('mount', function(parent) {
  17 + delete parent.locals.settings; // 不继承父 App 的设置
  18 + Object.assign(app.locals, parent.locals);
  19 +});
  20 +app.set('views', path.join(__dirname, 'views/action'));
  21 +app.engine('.hbs', hbs({
  22 + extname: '.hbs',
  23 + defaultLayout: 'layout',
  24 + layoutsDir: doraemon,
  25 + partialsDir: ['./views/partial', `${doraemon}/partial`],
  26 + helpers: global.yoho.helpers
  27 +}));
  28 +
  29 +// router
  30 +app.use(require('./router'));
  31 +
  32 +module.exports = app;
  1 +/**
  2 + * 个人中心二维码 model
  3 + * @author: weiqingting<qingting.wei@yoho.cn>
  4 + * @date: 2016/05/16
  5 + */
  6 +'use strict';
  7 +
  8 +const logger = global.yoho.logger;
  9 +var api = global.yoho.API;
  10 +
  11 +exports.getQRcodeData = (id, uid) => {
  12 + return api.get('', {
  13 + method: 'app.SpaceOrders.getQrByOrderCode',
  14 + order_code: id,
  15 + uid: uid
  16 + }).then(result => {
  17 + if (result && result.code === 200) {
  18 + return result.data;
  19 + } else {
  20 + logger.error(`查看二维码ID: ${id} 接口返回数据错误`);
  21 + return false;
  22 + }
  23 + });
  24 +};
  25 +
  1 +/**
  2 + * router of sub app product
  3 + * @author: weiqingting<qingting.wei@yoho.cn>
  4 + * @date: 2016/05/06
  5 + */
  6 +'use strict';
  7 +
  8 +const express = require('express');
  9 +const router = express.Router(); // eslint-disable-line
  10 +const cRoot = './controllers';
  11 +
  12 +const personalController = require(`${cRoot}/qrcode`);
  13 +
  14 +// 查看二维码
  15 +router.get('/QRcode/:id', personalController.QRcode);
  16 +
  17 +module.exports = router;
  1 +<header id="yoho-header" class="yoho-header boys">
  2 + <a href="javascript:history.go(-1);" class="iconfont nav-back"></a>
  3 + <p class="nav-title">查看二维码</p>
  4 +</header>
  5 +<div class="qrcode yoho-page">
  6 + <h2 class='qrcode-title'>2016 非常潮流盛世 YO'HOOD门票(限量)1件</h2>
  7 + <p class='qrcode-tip'>提示:凭借二维码入场,每场二维码只可使用一次,请妥善保管。</p>
  8 + <div class='qrcode-wrap'>
  9 + {{#qrcodeData}}
  10 + <p class='qrcode-pages'><a class='pagec'>1</a>/{{ticks.length}}</p>
  11 + <a class='prev chan'></a>
  12 + <a class='next chan'></a>
  13 + <div class="swiper-container">
  14 + <div class="swiper-wrapper">
  15 + {{#each ticks}}
  16 + <div class="swiper-slide">
  17 + <a class='qrcode-img'><img src="{{qr_image}}"></a>
  18 + <p><label class='t'>编号:</label>{{ticket_code}}</p>
  19 + {{#if isgroup}}
  20 + <p><label class='t'>座位号:</label>{{seat_no}}</p>
  21 + {{/if}}
  22 + <p><label class='t'>进场时间:</label>{{entrance_time}}</p>
  23 + </div>
  24 + {{/each}}
  25 + </div>
  26 + </div>
  27 + {{/qrcodeData}}
  28 + </div>
  29 +</div>
@@ -44,7 +44,8 @@ module.exports = { @@ -44,7 +44,8 @@ module.exports = {
44 infoFile: { 44 infoFile: {
45 name: 'info', 45 name: 'info',
46 level: 'info', 46 level: 'info',
47 - filename: 'logs/info.log' 47 + filename: 'logs/info.log',
  48 + maxFiles: 7
48 }, 49 },
49 errorFile: { 50 errorFile: {
50 name: 'error', 51 name: 'error',
@@ -54,7 +55,7 @@ module.exports = { @@ -54,7 +55,7 @@ module.exports = {
54 }, 55 },
55 udp: { // send by udp 56 udp: { // send by udp
56 level: 'debug', // logger level 57 level: 'debug', // logger level
57 - host: '192.168.102.162', // influxdb host 58 + host: 'influxdblog.yohoops.org', // influxdb host
58 port: '4444' // influxdb port 59 port: '4444' // influxdb port
59 }, 60 },
60 console: { 61 console: {
@@ -16,4 +16,5 @@ module.exports = app => { @@ -16,4 +16,5 @@ module.exports = app => {
16 app.use('/product', require('./apps/product')); 16 app.use('/product', require('./apps/product'));
17 app.use('/guang', require('./apps/guang')); 17 app.use('/guang', require('./apps/guang'));
18 app.use('/activity', require('./apps/activity')); 18 app.use('/activity', require('./apps/activity'));
  19 + app.use('/home', require('./apps/home'));
19 }; 20 };

47.3 KB | W: | H:

47.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
  1 +var $ = require('yoho-jquery');
  2 +var Swiper = require('yoho-swiper');
  3 +var mySwiper;
  4 +
  5 +mySwiper = new Swiper('.swiper-container', {
  6 + onSlideChangeEnd: function(swiper) {
  7 + $('.pagec').html(swiper.snapIndex + 1);
  8 + }
  9 +});
  10 +$('.prev').click(function() {
  11 + mySwiper.slidePrev();
  12 +});
  13 +$('.next').click(function() {
  14 + mySwiper.slideNext();
  15 +});
  1 +@import "qrcode";
  1 +.qrcode {
  2 + padding: 0 30px;
  3 +
  4 + .qrcode-title {
  5 + margin: 30px 0;
  6 + }
  7 +
  8 + .qrcode-tip {
  9 + font-size: 20px;
  10 + color: #c6c6c6;
  11 + background: url("../img/passport/info.png");
  12 + }
  13 +
  14 + .qrcode-say {
  15 + color: #c6c6c6;
  16 + margin-top: 80px;
  17 + }
  18 +
  19 + .qrcode-wrap {
  20 + position: relative;
  21 +
  22 + .chan {
  23 + background: url("../img/channel/up-icon.png");
  24 + background-size: 40px 40px;
  25 + position: absolute;
  26 + top: 50%;
  27 + margin-top: -15px;
  28 + width: 40px;
  29 + height: 40px;
  30 + }
  31 +
  32 + .prev {
  33 + left: 0;
  34 + transform: rotate(-90deg);
  35 + }
  36 +
  37 + .next {
  38 + right: 0;
  39 + transform: rotate(90deg);
  40 + }
  41 + }
  42 +
  43 + .qrcode-pages {
  44 + text-align: center;
  45 + padding: 30px 0;
  46 + letter-spacing: 4px;
  47 + }
  48 +
  49 + .swiper-container {
  50 + width: 412px;
  51 +
  52 + .qrcode-img {
  53 + width: 412px;
  54 + height: 412px;
  55 + display: block;
  56 + margin-bottom: 40px;
  57 +
  58 + img {
  59 + width: 100%;
  60 + height: 100%;
  61 + display: block;
  62 + }
  63 + }
  64 +
  65 + p {
  66 + line-height: 35px;
  67 + height: 35px;
  68 + }
  69 +
  70 + label {
  71 + display: inline-block;
  72 + width: 148px;
  73 + text-align: right;
  74 + margin-right: 40px;
  75 + }
  76 + }
  77 +}
@@ -12,4 +12,5 @@ @@ -12,4 +12,5 @@
12 @import "passport/index"; 12 @import "passport/index";
13 @import "guang/index"; 13 @import "guang/index";
14 @import "cart/chose-panel"; 14 @import "cart/chose-panel";
  15 +@import "home/index";
15 @import "me/index"; 16 @import "me/index";