Merge branch 'dev' into virusdefender-dev
* dev: (21 commits) [前端]整理格式,去掉tab(以前用vim,它自己给加的),去掉调试用的console.log[CI SKIP] [前端]统一admin中js命名方式. 为提交列表添加返回按钮[CI SKIP] [前端]修复bug,更正了不恰当的foreach循环,(js里for(var key in array)不仅遍历了数组元素,还将遍历数组其他的属性以及成员方法),修复了显示编辑区函数对选中小组错误的清除方法.(原来的做法将导致某些情况下旧的小组无法移除编辑区域. 增添了切换编辑比赛的提示,防止用户丢失为保存的信息. 添加问题列表对可见比赛的筛选[CI SKIP] [前端-BUG]修复比赛编辑区可见状态显示错误,(忘记加vm.),增加编辑成功隐藏编辑框的行为,更加方便[CI SKIP] [前端]添加比赛题目列表可见字段的显示,方便比赛管理[CI SKIP] [BUG-fix]返回按钮提示确认,修复不能弹出的问题[CI SKIP] 修复typo in submission/views.py Swagger UI docs中的拼写错误[CI SKIP] [前端]修复userList.js中关于翻页按钮状态控制函数参数的错误. 修复刚刚提交的bug[CI SKIP] [前端]修复userList页面avalon重定义问题[CI SKIP] [前端]修复问题管理(后台)页面的avalon重复定义的问题[CI SKIP] [前端]整理js格式. 修复小bugs,关于比赛密码修改变量名称的错误,小组修改变量名称错误(以上都是在修改比赛页面内)[CI SKIP] [后台]修复contestAdmin,比赛和问题API的逻辑问题,主要针对超级管理员和普通管理员的差别.写了测试,是两个api测试覆盖率达100% [migration]改model漏了一个.....[CI SKIP] [前端-后台]比赛管理,对添加,编辑,列表页面的avalon使用方法做了统一的改变,防止出现页内模板改变但页面不刷新的情况下导致avalon功能间歇性异常的问题,但是代码量变大了一些,还算是整洁.具体是所有页面的avalon只在页面第一次加载的时候初始化,再次加载时只对vm内部变量重新初始化,而不调用avalon.define了[CI SKIP] [后端]添加修改比赛题目添加对题目分数的支持 [后端]为比赛problem model添加分数(score)字段,用于记分模式的比赛 [后端]修复typo,工作正常,没写测试还 [前端]修改比赛列表页面,添加了编辑比赛,编辑比赛题目[CI SKIP] [前端]把添加比赛和添加比赛问题分开了,就是把添加问题模块从添加比赛页面删除了 [前端]添加了后台比赛列表对问题的添加修改页面[CI SKIP] ... Conflicts: static/src/js/app/admin/problem/editProblem.js static/src/js/app/admin/problem/submissionList.js submission/views.py
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagEditor", "validator", "jqueryUI"],
|
||||
function ($, avalon, editor, uploader, bsAlert, csrfTokenHeader) {
|
||||
avalon.ready(function () {
|
||||
avalon.vmodels.addProblem = null;
|
||||
|
||||
$("#add-problem-form").validator()
|
||||
.on('submit', function (e) {
|
||||
if (!e.isDefaultPrevented()){
|
||||
@@ -63,6 +63,7 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bsAlert("题目添加成功!");
|
||||
location.hash = "problem/problem_list";
|
||||
}
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
@@ -92,41 +93,61 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
|
||||
|
||||
var hintEditor = editor("#hint");
|
||||
var problemDescription = editor("#problemDescription");
|
||||
|
||||
var vm = avalon.define({
|
||||
$id: "addProblem",
|
||||
title: "",
|
||||
description: "",
|
||||
timeLimit: 1000,
|
||||
memoryLimit: 256,
|
||||
samples: [{input: "", output: "", "visible": true}],
|
||||
hint: "",
|
||||
visible: true,
|
||||
difficulty: 0,
|
||||
tags: [],
|
||||
inputDescription: "",
|
||||
outputDescription: "",
|
||||
testCaseId: "",
|
||||
testCaseList: [],
|
||||
uploadSuccess: false,
|
||||
source: "",
|
||||
addSample: function () {
|
||||
vm.samples.push({input: "", output: "", "visible": true});
|
||||
},
|
||||
delSample: function (sample) {
|
||||
if (confirm("你确定要删除么?")) {
|
||||
vm.samples.remove(sample);
|
||||
if (avalon.vmodels.addProblem) {
|
||||
var vm = avalon.vmodels.addProblem;
|
||||
vm.title = "";
|
||||
vm.description = "";
|
||||
vm.timeLimit = 1000;
|
||||
vm.memoryLimit = 256;
|
||||
vm.samples = [{input: "", output: "", "visible": true}];
|
||||
vm.hint = "";
|
||||
vm.visible = true;
|
||||
vm.difficulty = 0;
|
||||
vm.tags = [];
|
||||
vm.inputDescription = "";
|
||||
vm.outputDescription = "";
|
||||
vm.testCaseId = "";
|
||||
vm.testCaseList = [];
|
||||
vm.uploadSuccess = false;
|
||||
vm.source = "";
|
||||
hintEditor.setValue("");
|
||||
problemDescription.setValue("");
|
||||
}
|
||||
else
|
||||
var vm = avalon.define({
|
||||
$id: "addProblem",
|
||||
title: "",
|
||||
description: "",
|
||||
timeLimit: 1000,
|
||||
memoryLimit: 256,
|
||||
samples: [{input: "", output: "", "visible": true}],
|
||||
hint: "",
|
||||
visible: true,
|
||||
difficulty: 0,
|
||||
tags: [],
|
||||
inputDescription: "",
|
||||
outputDescription: "",
|
||||
testCaseId: "",
|
||||
testCaseList: [],
|
||||
uploadSuccess: false,
|
||||
source: "",
|
||||
addSample: function () {
|
||||
vm.samples.push({input: "", output: "", "visible": true});
|
||||
},
|
||||
delSample: function (sample) {
|
||||
if (confirm("你确定要删除么?")) {
|
||||
vm.samples.remove(sample);
|
||||
}
|
||||
},
|
||||
toggleSample: function (sample) {
|
||||
sample.visible = !sample.visible;
|
||||
},
|
||||
getBtnContent: function (item) {
|
||||
if (item.visible)
|
||||
return "折叠";
|
||||
return "展开";
|
||||
}
|
||||
},
|
||||
toggleSample: function (sample) {
|
||||
sample.visible = !sample.visible;
|
||||
},
|
||||
getBtnContent: function (item) {
|
||||
if (item.visible)
|
||||
return "折叠";
|
||||
return "展开";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var tagAutoCompleteList = [];
|
||||
|
||||
@@ -3,8 +3,6 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
|
||||
|
||||
avalon.ready(function () {
|
||||
|
||||
|
||||
|
||||
$("#edit-problem-form").validator()
|
||||
.on('submit', function (e) {
|
||||
if (!e.isDefaultPrevented()){
|
||||
@@ -66,6 +64,7 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bsAlert("题目编辑成功!");
|
||||
vm.showProblemListPage();
|
||||
}
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
@@ -76,49 +75,60 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if(avalon.vmodels.editProblem){
|
||||
var vm = avalon.vmodels.editProblem;
|
||||
}
|
||||
else {
|
||||
var vm = avalon.define({
|
||||
$id: "editProblem",
|
||||
title: "",
|
||||
description: "",
|
||||
timeLimit: -1,
|
||||
memoryLimit: -1,
|
||||
samples: [],
|
||||
hint: "",
|
||||
visible: true,
|
||||
difficulty: 0,
|
||||
inputDescription: "",
|
||||
outputDescription: "",
|
||||
testCaseIdd: "",
|
||||
uploadSuccess: false,
|
||||
source: "",
|
||||
testCaseList: [],
|
||||
addSample: function () {
|
||||
vm.samples.push({input: "", output: "", "visible": true});
|
||||
},
|
||||
delSample: function (sample) {
|
||||
if (confirm("你确定要删除么?")) {
|
||||
vm.samples.remove(sample);
|
||||
}
|
||||
},
|
||||
toggleSample: function (sample) {
|
||||
sample.visible = !sample.visible;
|
||||
},
|
||||
getBtnContent: function (item) {
|
||||
if (item.visible)
|
||||
return "折叠";
|
||||
return "展开";
|
||||
},
|
||||
showProblemListPage: function () {
|
||||
vm.$fire("up!showProblemListPage");
|
||||
if (avalon.vmodels.editProblem) {
|
||||
var vm = avalon.vmodels.editProblem;
|
||||
title: "",
|
||||
description= "";
|
||||
timeLimit= -1;
|
||||
memoryLimit= -1;
|
||||
samples= [];
|
||||
hint= "";
|
||||
visible= true;
|
||||
difficulty= 0;
|
||||
inputDescription= "";
|
||||
outputDescription= "";
|
||||
testCaseIdd= "";
|
||||
uploadSuccess= false;
|
||||
source= "";
|
||||
testCaseList= [];
|
||||
}
|
||||
else
|
||||
var vm = avalon.define({
|
||||
$id: "editProblem",
|
||||
title: "",
|
||||
description: "",
|
||||
timeLimit: -1,
|
||||
memoryLimit: -1,
|
||||
samples: [],
|
||||
hint: "",
|
||||
visible: true,
|
||||
difficulty: 0,
|
||||
inputDescription: "",
|
||||
outputDescription: "",
|
||||
testCaseIdd: "",
|
||||
uploadSuccess: false,
|
||||
source: "",
|
||||
testCaseList: [],
|
||||
addSample: function () {
|
||||
vm.samples.push({input: "", output: "", "visible": true});
|
||||
},
|
||||
delSample: function (sample) {
|
||||
if (confirm("你确定要删除么?")) {
|
||||
vm.samples.remove(sample);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
toggleSample: function (sample) {
|
||||
sample.visible = !sample.visible;
|
||||
},
|
||||
getBtnContent: function (item) {
|
||||
if (item.visible)
|
||||
return "折叠";
|
||||
return "展开";
|
||||
},
|
||||
showProblemListPage: function(){
|
||||
vm.$fire("up!showProblemListPage");
|
||||
}
|
||||
});
|
||||
var hintEditor = editor("#hint");
|
||||
var descriptionEditor = editor("#problemDescription");
|
||||
var testCaseUploader = uploader("#testCaseFile", "/api/admin/test_case_upload/", function (file, response) {
|
||||
@@ -148,7 +158,6 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
|
||||
}
|
||||
else {
|
||||
var problem = data.data;
|
||||
console.log(problem);
|
||||
vm.title = problem.title;
|
||||
vm.description = problem.description;
|
||||
vm.timeLimit = problem.time_limit;
|
||||
@@ -204,4 +213,4 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
|
||||
});
|
||||
avalon.scan();
|
||||
|
||||
});
|
||||
});
|
||||
@@ -41,10 +41,8 @@ require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfT
|
||||
vm.$fire("up!showProblemSubmissionPage", problemId);
|
||||
}
|
||||
});
|
||||
|
||||
getPageData(1);
|
||||
}
|
||||
|
||||
getPageData(1);
|
||||
function getPageData(page) {
|
||||
var url = "/api/admin/problem/?paging=true&page=" + page + "&page_size=10";
|
||||
if (vm.keyword != "")
|
||||
|
||||
@@ -40,6 +40,12 @@ require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfT
|
||||
},
|
||||
getPage: function (page_index) {
|
||||
getPageData(page_index);
|
||||
},
|
||||
showSubmissionDetailPage: function (submissionId) {
|
||||
|
||||
},
|
||||
showProblemListPage: function(){
|
||||
vm.$fire("up!showProblemListPage");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -66,9 +72,7 @@ require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfT
|
||||
});
|
||||
}
|
||||
|
||||
avalon.scan();
|
||||
|
||||
|
||||
});
|
||||
|
||||
avalon.scan();
|
||||
});
|
||||
Reference in New Issue
Block a user