Browse Source

Disable std-io for interaction problem

pull/6/head
Menci 7 years ago
parent
commit
65ad3238ee
  1. 3
      modules/problem.js
  2. 7
      views/problem_manage.ejs

3
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; problem.file_io_output_name = req.body.file_io_output_name;
if (req.body.type === 'interaction') { if (req.body.type === 'interaction') {
if (!problem.file_io) {
throw new ErrorMessage('交互题目必须使用文件 IO。');
}
throw new ErrorMessage('暂不支持该题目类型。'); throw new ErrorMessage('暂不支持该题目类型。');
} }

7
views/problem_manage.ejs

@ -55,7 +55,7 @@
<div class="inline fields"> <div class="inline fields">
<label>IO 方式</label> <label>IO 方式</label>
<div class="field"> <div class="field">
<div class="ui radio checkbox"> <div class="ui radio checkbox" id="std-io-div">
<input name="io_method" value="std-io" id="std-io" type="radio" onclick="goDisable()"> <input name="io_method" value="std-io" id="std-io" type="radio" onclick="goDisable()">
<label for="std-io">标准 IO</label> <label for="std-io">标准 IO</label>
</div> </div>
@ -125,11 +125,16 @@ $(function () {
$('a[data-tab="traditional"]').click(function () { $('a[data-tab="traditional"]').click(function () {
$('input[name=type]').val('traditional'); $('input[name=type]').val('traditional');
if ($('div[data-tab="interaction"]').attr('data-tab', 'traditional').length) $('a[data-tab="traditional"]').click(); 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 () { $('a[data-tab="interaction"]').click(function () {
$('input[name=type]').val('interaction'); $('input[name=type]').val('interaction');
if ($('div[data-tab="traditional"]').attr('data-tab', 'interaction').length) $('a[data-tab="interaction"]').click(); 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 () { $('a[data-tab="submit-answer"]').click(function () {

Loading…
Cancel
Save