diff --git a/modules/index.js b/modules/index.js index ad53efc..7900e2f 100644 --- a/modules/index.js +++ b/modules/index.js @@ -21,6 +21,7 @@ let User = syzoj.model('user'); let Article = syzoj.model('article'); +let Contest = syzoj.model('contest'); let Divine = require('syzoj-divine'); app.get('/', async (req, res) => { @@ -46,10 +47,13 @@ app.get('/', async (req, res) => { fortune = Divine(res.locals.user.username, res.locals.user.sex); } + let contests = await Contest.query([1, 5], null, [['start_time', 'desc']]); + res.render('index', { ranklist: ranklist, notices: notices, - fortune: fortune + fortune: fortune, + contests: contests }); } catch (e) { syzoj.log(e); diff --git a/views/index.ejs b/views/index.ejs index e286d9f..7c15e23 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -103,9 +103,47 @@ <% } %> +
比赛名称 | +开始时间 | +
---|---|
<%= contest.title %> <%- tag %> | +<%= syzoj.utils.formatDate(contest.start_time) %> | +
<%- syzoj.config.announcement %>
+ <% } %>