Merge branch 'dev' into virusdefender-dev

* dev:
  修改后端problem中的的命名规范
  前端创建题目界面增加输入描述和输出描述
  后端增加输入描述与输出描述两个字段,并修改其相关的后端内容
This commit is contained in:
virusdefender
2015-08-13 18:16:18 +08:00
8 changed files with 106 additions and 14 deletions

View File

@@ -53,10 +53,17 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito
}
}
},
source: {
input_description: {
validators: {
notEmpty: {
message: "请输入题目来源"
message: "请填写输入描述"
}
}
},
output_description: {
validators: {
notEmpty: {
message: "请填写输出描述"
}
}
}
@@ -72,10 +79,6 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito
bs_alert("题目描述不能为空!");
return;
}
if (vm.hint == '') {
bs_alert("提示不能为空!");
return;
}
var ajaxData = {
title: vm.title,
description: vm.description,
@@ -86,6 +89,8 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito
hint: vm.hint,
source: vm.source,
tags: $("#tags").tagEditor("getTags")[0].tags,
input_description: vm.input_description,
output_description: vm.output_description,
difficulty: vm.difficulty
};
if (vm.samples.length == 0) {
@@ -93,6 +98,13 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito
return;
}
for(var i = 0; i < vm.samples.length; i++){
if (vm.samples[i].input == "" || vm.samples[i].output == ""){
bs_alert("样例输入与样例输出不能为空!");
return;
}
}
if (tags.length == 0) {
bs_alert("请至少添加一个标签,这将有利于用户发现你的题目!");
return;
@@ -147,12 +159,14 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito
description: "",
cpu: 1000,
memory: 256,
samples: [],
samples: [{input: "", output: "", "visible": true}],
hint: "",
visible: true,
difficulty: 0,
tags: [],
tag: "",
input_description: "",
output_description: "",
test_case_id: "",
testCaseList: [],
uploadSuccess: false,