Authored by 陈轩

activity:vip_day

@@ -66,11 +66,13 @@ app.use(session({ @@ -66,11 +66,13 @@ app.use(session({
66 cookie: { 66 cookie: {
67 domain: 'yohobuy.com', 67 domain: 'yohobuy.com',
68 httpOnly: false 68 httpOnly: false
69 - }, 69 + }
  70 +
  71 + /* ,
70 store: new MemcachedStore({ 72 store: new MemcachedStore({
71 hosts: config.memcache.session, 73 hosts: config.memcache.session,
72 prefix: 'yohobuy_session:' 74 prefix: 'yohobuy_session:'
73 - }) 75 + })*/
74 })); 76 }));
75 77
76 app.use((req, res, next) => { 78 app.use((req, res, next) => {
  1 +/* eslint no-unused-vars: ["error", { "args": "none" }]*/
  2 +'use strict';
  3 +exports.index = (req, res, next) => {
  4 + res.locals.module = 'activity';
  5 + res.locals.page = 'vip_day';
  6 + res.locals.width750 = true;
  7 +
  8 + res.render('vip_day/index');
  9 +};
  10 +
  11 +exports.crazyWheel = (req, res, next) => {
  12 + res.locals.module = 'activity';
  13 + res.locals.page = 'crazy_wheel';
  14 + res.locals.width750 = true;
  15 +
  16 + res.render('vip_day/crazy_wheel');
  17 +};
  18 +
  19 +exports.crazyLuck = (req, res, next) => {
  20 + res.locals.module = 'activity';
  21 + res.locals.page = 'crazy_luck';
  22 + res.locals.width750 = true;
  23 +
  24 + res.render('vip_day/crazy_luck');
  25 +};
@@ -14,6 +14,7 @@ const wechat = require(`${cRoot}/wechat`); @@ -14,6 +14,7 @@ const wechat = require(`${cRoot}/wechat`);
14 const student = require(`${cRoot}/student`); 14 const student = require(`${cRoot}/student`);
15 const live = require(`${cRoot}/live`); 15 const live = require(`${cRoot}/live`);
16 const invite = require(`${cRoot}/invite`); 16 const invite = require(`${cRoot}/invite`);
  17 +const vipDay = require(`${cRoot}/vipDay`);
17 18
18 // routers 19 // routers
19 20
@@ -61,5 +62,9 @@ router.get('/invite/getwxinfo', invite.getwxinfo); @@ -61,5 +62,9 @@ router.get('/invite/getwxinfo', invite.getwxinfo);
61 router.get('/invite/shareover', invite.shareover); 62 router.get('/invite/shareover', invite.shareover);
62 router.get('/invite/over', invite.over); 63 router.get('/invite/over', invite.over);
63 64
  65 +router.get('/vip_day', vipDay.index);
  66 +router.get('/vip_day/crazy_wheel', vipDay.crazyWheel);
  67 +router.get('/vip_day/crazy_luck', vipDay.crazyLuck);
  68 +
64 69
65 module.exports = router; 70 module.exports = router;
  1 +var Game = function(canvas, option) {
  2 + canvas.style.backgroundColor = option.background;
  3 + this.canvas = canvas;
  4 + this.context = canvas.getContext('2d');
  5 +
  6 + this.w = canvas.width = option.width;
  7 + this.h = canvas.height = option.height;
  8 +
  9 +
  10 + this.itemW = option.width / 3;
  11 + this.itemH = option.height / 3;
  12 +};
  13 +
  14 +Game.prototype = {
  15 + _supportTouch: function() { },
  16 + start: function() { },
  17 + pause: function() { },
  18 + addItem: function() {},
  19 + addEvent: function() { }
  20 +};
  21 +
  22 +Game.Button = function() {
  23 +};
  24 +
  25 +Game.Button.prototype = {
  26 + addEventListener: function(type, handle) {
  27 +
  28 + }
  29 +};
  30 +
  31 +Game.Cursor = function() {
  32 +
  33 +};
  34 +
  35 +document.addEventListener('DOMContentLoaded', function() {
  36 + var canvas = document.querySelector('#stage');
  37 + var width = 500;
  38 + var height = 400;
  39 + var itemW = width / 3;
  40 + var itemH = height / 3;
  41 +
  42 + var game = new Game(canvas, {
  43 + width: width,
  44 + height: height,
  45 + background: '#32212c'
  46 + });
  47 + var button = new Game.Button();
  48 + var cursor = new Game.Cursor();
  49 + var context = game.context;
  50 +
  51 + button.addEventListener('click', function() {
  52 +
  53 + });
  54 +
  55 +
  56 +
  57 + function drawLine(c) {
  58 + var i, j;
  59 + var action = function(begin, end) {
  60 + c.lineWidth = 1;
  61 + c.strokeStyle = 'black';
  62 + c.beginPath();
  63 + c.moveTo(begin.x, begin.y);
  64 + c.lineTo(end.x, end.y);
  65 + c.stroke();
  66 + };
  67 +
  68 + for (i = itemH; i < height; i = i + itemH) {
  69 + action({ x: 0, y: i }, { x: width, y: i });
  70 + }
  71 +
  72 + for (j = itemW; j < width; j = j + itemW) {
  73 + action({ x: j, y: 0 }, { x: j, y: height });
  74 + }
  75 + }
  76 +
  77 + function drawStage(c) {
  78 + drawLine(c);
  79 + }
  80 +
  81 + drawStage(context);
  82 + game.addItem(button);
  83 + game.addItem(cursor);
  84 + game.start();
  85 +});
  86 +
  87 +