diff --git a/modules/contest.js b/modules/contest.js index 85c9ec9..656c772 100644 --- a/modules/contest.js +++ b/modules/contest.js @@ -53,6 +53,7 @@ app.get('/contest/:id/edit', async (req, res) => { res.render('contest_edit', { contest: contest, problems: problems, + contest_id, admins: admins }); } catch (e) { @@ -63,6 +64,17 @@ app.get('/contest/:id/edit', async (req, res) => { } }); +app.get('/api/contest/problem/:id', async (req, res) => { + try { + const id = req.params.id; + let contest = await Contest.findById(id); + let problems = await contest.problems.split('|').mapAsync(async id => await Problem.findById(id)); + res.send({ problems}); + } catch(e) { + res.send({ error_code: e.errno, error_msg: '失败' }); + } +}) + app.post('/contest/:id/edit', async (req, res) => { try { if (!res.locals.user || !res.locals.user.is_admin) throw new ErrorMessage('您没有权限进行此操作。'); @@ -96,7 +108,7 @@ app.post('/contest/:id/edit', async (req, res) => { if (!req.body.title.trim()) throw new ErrorMessage('比赛名不能为空。'); contest.title = req.body.title; contest.subtitle = req.body.subtitle; - if (!Array.isArray(req.body.problems)) req.body.problems = [req.body.problems]; + if (!Array.isArray(req.body.problems) && typeof req.body.problems==='string') req.body.problems = req.body.problems.split(','); if (!Array.isArray(req.body.admins)) req.body.admins = [req.body.admins]; contest.problems = req.body.problems.join('|'); contest.admins = req.body.admins.join('|'); diff --git a/views/admin_classify.ejs b/views/admin_classify.ejs index 6310d9b..1e40705 100644 --- a/views/admin_classify.ejs +++ b/views/admin_classify.ejs @@ -71,6 +71,7 @@ :total="problemCount"> + @@ -112,6 +113,7 @@ +<% include problem_table %> + + + + <% if (syzoj.config.google_analytics && syzoj.config.google_analytics !== 'UA-XXXXXXXX-X') { %> + + diff --git a/views/submissions.ejs b/views/submissions.ejs index 08fc7aa..c4bb7c8 100644 --- a/views/submissions.ejs +++ b/views/submissions.ejs @@ -6,9 +6,6 @@ font-size: 1.2em; margin-right: 1px; } - .padding{ - overflow-x: auto; - }