From 65ad3238eeee41ec96c0ad785bf2261f493085b9 Mon Sep 17 00:00:00 2001 From: Menci Date: Thu, 13 Jul 2017 18:40:20 +0800 Subject: [PATCH] Disable std-io for interaction problem --- modules/problem.js | 3 +++ views/problem_manage.ejs | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/problem.js b/modules/problem.js index e558ba5..1aaa45d 100644 --- a/modules/problem.js +++ b/modules/problem.js @@ -499,6 +499,9 @@ app.post('/problem/:id/manage', app.multer.fields([{ name: 'testdata', maxCount: problem.file_io_output_name = req.body.file_io_output_name; if (req.body.type === 'interaction') { + if (!problem.file_io) { + throw new ErrorMessage('交互题目必须使用文件 IO。'); + } throw new ErrorMessage('暂不支持该题目类型。'); } diff --git a/views/problem_manage.ejs b/views/problem_manage.ejs index 2de676c..9be6ea0 100644 --- a/views/problem_manage.ejs +++ b/views/problem_manage.ejs @@ -55,7 +55,7 @@
-
+
@@ -125,11 +125,16 @@ $(function () { $('a[data-tab="traditional"]').click(function () { $('input[name=type]').val('traditional'); if ($('div[data-tab="interaction"]').attr('data-tab', 'traditional').length) $('a[data-tab="traditional"]').click(); + + $('#std-io')[0].disabled = false; }); $('a[data-tab="interaction"]').click(function () { $('input[name=type]').val('interaction'); if ($('div[data-tab="traditional"]').attr('data-tab', 'interaction').length) $('a[data-tab="interaction"]').click(); + + $('#std-io')[0].disabled = true; + $('#file-io').click(); }); $('a[data-tab="submit-answer"]').click(function () {