Authored by 陈轩

activity:vip_day

... ... @@ -66,11 +66,13 @@ app.use(session({
cookie: {
domain: 'yohobuy.com',
httpOnly: false
},
}
/* ,
store: new MemcachedStore({
hosts: config.memcache.session,
prefix: 'yohobuy_session:'
})
})*/
}));
app.use((req, res, next) => {
... ...
/* eslint no-unused-vars: ["error", { "args": "none" }]*/
'use strict';
exports.index = (req, res, next) => {
res.locals.module = 'activity';
res.locals.page = 'vip_day';
res.locals.width750 = true;
res.render('vip_day/index');
};
exports.crazyWheel = (req, res, next) => {
res.locals.module = 'activity';
res.locals.page = 'crazy_wheel';
res.locals.width750 = true;
res.render('vip_day/crazy_wheel');
};
exports.crazyLuck = (req, res, next) => {
res.locals.module = 'activity';
res.locals.page = 'crazy_luck';
res.locals.width750 = true;
res.render('vip_day/crazy_luck');
};
... ...
... ... @@ -14,6 +14,7 @@ const wechat = require(`${cRoot}/wechat`);
const student = require(`${cRoot}/student`);
const live = require(`${cRoot}/live`);
const invite = require(`${cRoot}/invite`);
const vipDay = require(`${cRoot}/vipDay`);
// routers
... ... @@ -61,5 +62,9 @@ router.get('/invite/getwxinfo', invite.getwxinfo);
router.get('/invite/shareover', invite.shareover);
router.get('/invite/over', invite.over);
router.get('/vip_day', vipDay.index);
router.get('/vip_day/crazy_wheel', vipDay.crazyWheel);
router.get('/vip_day/crazy_luck', vipDay.crazyLuck);
module.exports = router;
... ...
<canvas id="stage"></canvas>
\ No newline at end of file
... ...
crazy_wheel
\ No newline at end of file
... ...
index
\ No newline at end of file
... ...
var Game = function(canvas, option) {
canvas.style.backgroundColor = option.background;
this.canvas = canvas;
this.context = canvas.getContext('2d');
this.w = canvas.width = option.width;
this.h = canvas.height = option.height;
this.itemW = option.width / 3;
this.itemH = option.height / 3;
};
Game.prototype = {
_supportTouch: function() { },
start: function() { },
pause: function() { },
addItem: function() {},
addEvent: function() { }
};
Game.Button = function() {
};
Game.Button.prototype = {
addEventListener: function(type, handle) {
}
};
Game.Cursor = function() {
};
document.addEventListener('DOMContentLoaded', function() {
var canvas = document.querySelector('#stage');
var width = 500;
var height = 400;
var itemW = width / 3;
var itemH = height / 3;
var game = new Game(canvas, {
width: width,
height: height,
background: '#32212c'
});
var button = new Game.Button();
var cursor = new Game.Cursor();
var context = game.context;
button.addEventListener('click', function() {
});
function drawLine(c) {
var i, j;
var action = function(begin, end) {
c.lineWidth = 1;
c.strokeStyle = 'black';
c.beginPath();
c.moveTo(begin.x, begin.y);
c.lineTo(end.x, end.y);
c.stroke();
};
for (i = itemH; i < height; i = i + itemH) {
action({ x: 0, y: i }, { x: width, y: i });
}
for (j = itemW; j < width; j = j + itemW) {
action({ x: j, y: 0 }, { x: j, y: height });
}
}
function drawStage(c) {
drawLine(c);
}
drawStage(context);
game.addItem(button);
game.addItem(cursor);
game.start();
});
... ...