seckill.js
2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
* 秒杀页面
* @author: 陈峰<feng.chen@yoho.cn>
* @date: 2016/09/08
*/
'use strict';
const headerModel = require('../../../doraemon/models/header');
/**
* [秒杀列表页面]
*/
const _index = (req, res, next) => {
let headerData = headerModel.setNav({
navTitle: '秒杀活动',
navBtn: true,
});
let result = {
products: [{
id: 1,
now: true
},{
id: 2,
wait: true
},{
id: 1,
over: true
},{
id: 1,
chance: true
}],
navs: [{
day: '2016/09/1',
time: '12:00',
over: true
}, {
day: '2016/09/1',
time: '12:00',
over: true
}, {
day: '2016/09/2',
time: '12:00',
over: true
}, {
day: '2016/09/2',
time: '12:00',
over: true
}, {
day: '2016/09/09',
time: '12:00',
over: true
}, {
day: '2016/09/12',
time: '10:40',
now: true
}, {
day: '2016/09/12',
time: '10:50',
wait: true
}, {
day: '2016/09/12',
time: '11:00',
wait: true
}, {
day: '2016/09/12',
time: '11:10',
last: true,
wait: true
}]
};
var hbsHelper = {
helpers: {
statusClass: (nav) => {
if (nav.over) {
return 'over';
} else if(nav.now) {
return 'now';
} else if(nav.wait) {
return 'wait';
} else {
return '';
}
}
}
}
res.render('seckill', Object.assign({
pageHeader: headerData,
pageFooter: true,
width750: true,
times: 12
}, result, hbsHelper));
}
module.exports = {
index: _index
}