mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-11-04 14:49:58 +08:00
Accept Merge Request #93 : (hohoTT-dev -> dev)
Merge Request: 替换掉商业版的 formvalidation,修改admin中js与html中的问题 Created By: @hohoTT Accepted By: @virusdefender URL: https://coding.net/u/virusdefender/p/qduoj/git/merge/93?tab=files
This commit is contained in:
commit
c33efce63c
@ -1,4 +1,4 @@
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "formValidation"],
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "validator"],
|
||||
function ($, avalon, csrfTokenHeader, bsAlert, editor) {
|
||||
|
||||
|
||||
@ -122,26 +122,15 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "formValidation"]
|
||||
}
|
||||
|
||||
//新建公告表单验证与数据提交
|
||||
$("#announcement-form")
|
||||
.formValidation({
|
||||
framework: "bootstrap",
|
||||
fields: {
|
||||
title: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写公告标题"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
).on('success.form.fv', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
$('form').validator().on('submit', function (e) {
|
||||
if (!e.isDefaultPrevented()) {
|
||||
var title = $("#title").val();
|
||||
var content = createAnnouncementEditor.getValue();
|
||||
if (content == "") {
|
||||
bsAlert("请填写公告内容");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
beforeSend: csrfTokenHeader,
|
||||
@ -156,11 +145,13 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "editor", "formValidation"]
|
||||
createAnnouncementEditor.setValue("");
|
||||
getPageData(1);
|
||||
} else {
|
||||
bs_alert(data.data);
|
||||
bsAlert(data.data);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
return false;
|
||||
}
|
||||
})
|
||||
});
|
||||
avalon.scan();
|
||||
});
|
||||
@ -1,4 +1,4 @@
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert", "formValidation"], function ($, avalon, csrfTokenHeader, bsAlert) {
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfTokenHeader, bsAlert) {
|
||||
|
||||
|
||||
avalon.ready(function () {
|
||||
@ -71,4 +71,4 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "formValidation"], function
|
||||
|
||||
avalon.scan();
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert", "formValidation"], function ($, avalon, csrfTokenHeader, bsAlert) {
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert", "validator"], function ($, avalon, csrfTokenHeader, bsAlert) {
|
||||
|
||||
|
||||
// avalon:定义模式 group_list
|
||||
@ -93,58 +93,33 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "formValidation"], function
|
||||
}
|
||||
});
|
||||
|
||||
$("#edit_group_form")
|
||||
.formValidation({
|
||||
framework: "bootstrap",
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写小组名"
|
||||
},
|
||||
stringLength: {
|
||||
max: 20,
|
||||
message: '小组名长度必须在20位之内'
|
||||
$('form').validator().on('submit', function (e) {
|
||||
if (!e.isDefaultPrevented()) {
|
||||
|
||||
var group_id = avalon.vmodels.admin.groupId;
|
||||
var name = vm.name;
|
||||
var description = vm.description;
|
||||
var join_group_setting = vm.checkedSetting;
|
||||
|
||||
$.ajax({
|
||||
beforeSend: csrfTokenHeader,
|
||||
url: "/api/admin/group/",
|
||||
method: "put",
|
||||
data: {group_id: group_id, name: name, description: description,
|
||||
join_group_setting: join_group_setting},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bsAlert("修改成功");
|
||||
}
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
}
|
||||
}
|
||||
},
|
||||
description: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写描述"
|
||||
},
|
||||
stringLength: {
|
||||
max: 300,
|
||||
message: '描述长度必须在300位之内'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
).on('success.form.fv', function (e) {
|
||||
e.preventDefault();
|
||||
var data = {
|
||||
group_id: avalon.vmodels.admin.groupId,
|
||||
name: vm.name,
|
||||
description: vm.description,
|
||||
join_group_setting: vm.checkedSetting
|
||||
};
|
||||
$.ajax({
|
||||
beforeSend: csrfTokenHeader,
|
||||
url: "/api/admin/group/",
|
||||
method: "put",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bsAlert("修改成功");
|
||||
}
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,135 +1,76 @@
|
||||
require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagEditor", "formValidation", "jqueryUI"],
|
||||
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")
|
||||
.formValidation({
|
||||
framework: "bootstrap",
|
||||
fields: {
|
||||
title: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写题目名称"
|
||||
},
|
||||
stringLength: {
|
||||
min: 1,
|
||||
max: 30,
|
||||
message: "名称不能超过30个字"
|
||||
}
|
||||
}
|
||||
},
|
||||
timeLimit: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请输入时间限制"
|
||||
},
|
||||
integer: {
|
||||
message: "请输入一个合法的数字"
|
||||
},
|
||||
between: {
|
||||
inclusive: true,
|
||||
min: 1,
|
||||
max: 5000,
|
||||
message: "只能在1-5000之间"
|
||||
}
|
||||
}
|
||||
},
|
||||
memoryLimit: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请输入内存限制"
|
||||
},
|
||||
integer: {
|
||||
message: "请输入一个合法的数字"
|
||||
}
|
||||
}
|
||||
},
|
||||
difficulty: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请输入难度"
|
||||
},
|
||||
integer: {
|
||||
message: "难度用一个整数表示"
|
||||
}
|
||||
}
|
||||
},
|
||||
input_description: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写输入描述"
|
||||
}
|
||||
}
|
||||
},
|
||||
output_description: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写输出描述"
|
||||
}
|
||||
$("#add-problem-form").validator()
|
||||
.on('submit', function (e) {
|
||||
if (!e.isDefaultPrevented()){
|
||||
if (vm.testCaseId == "") {
|
||||
bsAlert("你还没有上传测试数据!");
|
||||
return false;
|
||||
}
|
||||
if (vm.description == "") {
|
||||
bsAlert("题目描述不能为空!");
|
||||
return false;
|
||||
}
|
||||
if (vm.timeLimit < 1000 || vm.timeLimit > 5000) {
|
||||
bsAlert("保证时间限制是一个1000-5000的合法整数");
|
||||
return false;
|
||||
}
|
||||
if (vm.samples.length == 0) {
|
||||
bsAlert("请至少添加一组样例!");
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < vm.samples.length; i++) {
|
||||
if (vm.samples[i].input == "" || vm.samples[i].output == "") {
|
||||
bsAlert("样例输入与样例输出不能为空!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.on("success.form.fv", function (e) {
|
||||
e.preventDefault();
|
||||
if (vm.testCaseId == "") {
|
||||
bsAlert("你还没有上传测试数据!");
|
||||
return;
|
||||
}
|
||||
if (vm.description == "") {
|
||||
bsAlert("题目描述不能为空!");
|
||||
return;
|
||||
}
|
||||
if (vm.samples.length == 0) {
|
||||
bsAlert("请至少添加一组样例!");
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < vm.samples.length; i++) {
|
||||
if (vm.samples[i].input == "" || vm.samples[i].output == "") {
|
||||
bsAlert("样例输入与样例输出不能为空!");
|
||||
return;
|
||||
var tags = $("#tags").tagEditor("getTags")[0].tags;
|
||||
if (tags.length == 0) {
|
||||
bsAlert("请至少添加一个标签,这将有利于用户发现你的题目!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (tags.length == 0) {
|
||||
bsAlert("请至少添加一个标签,这将有利于用户发现你的题目!");
|
||||
return;
|
||||
}
|
||||
var ajaxData = {
|
||||
title: vm.title,
|
||||
description: vm.description,
|
||||
time_limit: vm.timeLimit,
|
||||
memory_limit: vm.memoryLimit,
|
||||
samples: [],
|
||||
test_case_id: vm.testCaseId,
|
||||
hint: vm.hint,
|
||||
source: vm.source,
|
||||
tags: $("#tags").tagEditor("getTags")[0].tags,
|
||||
input_description: vm.inputDescription,
|
||||
output_description: vm.outputDescription,
|
||||
difficulty: vm.difficulty
|
||||
};
|
||||
var ajaxData = {
|
||||
id: avalon.vmodels.admin.problemId,
|
||||
title: vm.title,
|
||||
description: vm.description,
|
||||
time_limit: vm.timeLimit,
|
||||
memory_limit: vm.memoryLimit,
|
||||
samples: [],
|
||||
test_case_id: vm.testCaseId,
|
||||
hint: vm.hint,
|
||||
source: vm.source,
|
||||
visible: vm.visible,
|
||||
tags: tags,
|
||||
input_description: vm.inputDescription,
|
||||
output_description: vm.outputDescription,
|
||||
difficulty: vm.difficulty
|
||||
};
|
||||
|
||||
for (var i = 0; i < vm.samples.$model.length; i++) {
|
||||
ajaxData.samples.push({input: vm.samples.$model[i].input, output: vm.samples.$model[i].output});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
beforeSend: csrfTokenHeader,
|
||||
url: "/api/admin/problem/",
|
||||
dataType: "json",
|
||||
data: JSON.stringify(ajaxData),
|
||||
method: "post",
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bsAlert("题目添加成功!");
|
||||
}
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
}
|
||||
for (var i = 0; i < vm.samples.$model.length; i++) {
|
||||
ajaxData.samples.push({input: vm.samples.$model[i].input, output: vm.samples.$model[i].output});
|
||||
}
|
||||
|
||||
})
|
||||
$.ajax({
|
||||
beforeSend: csrfTokenHeader,
|
||||
url: "/api/admin/problem/",
|
||||
dataType: "json",
|
||||
data: JSON.stringify(ajaxData),
|
||||
method: "post",
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bsAlert("题目添加成功!");
|
||||
}
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var testCaseUploader = uploader("#testCaseFile", "/api/admin/test_case_upload/", function (file, response) {
|
||||
|
||||
@ -1,139 +1,79 @@
|
||||
require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagEditor", "formValidation", "jqueryUI"],
|
||||
require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagEditor", "validator", "jqueryUI"],
|
||||
function ($, avalon, editor, uploader, bsAlert, csrfTokenHeader) {
|
||||
|
||||
avalon.ready(function () {
|
||||
avalon.vmodels.editProblem = null;
|
||||
|
||||
$("#edit-problem-form")
|
||||
.formValidation({
|
||||
framework: "bootstrap",
|
||||
fields: {
|
||||
title: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写题目名称"
|
||||
},
|
||||
stringLength: {
|
||||
min: 1,
|
||||
max: 30,
|
||||
message: "名称不能超过30个字"
|
||||
}
|
||||
}
|
||||
},
|
||||
cpu: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请输入时间限制"
|
||||
},
|
||||
integer: {
|
||||
message: "请输入一个合法的数字"
|
||||
},
|
||||
between: {
|
||||
inclusive: true,
|
||||
min: 1,
|
||||
max: 5000,
|
||||
message: "只能在1-5000之间"
|
||||
}
|
||||
}
|
||||
},
|
||||
memory: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请输入内存限制"
|
||||
},
|
||||
integer: {
|
||||
message: "请输入一个合法的数字"
|
||||
}
|
||||
}
|
||||
},
|
||||
difficulty: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请输入难度"
|
||||
},
|
||||
integer: {
|
||||
message: "难度用一个整数表示"
|
||||
}
|
||||
}
|
||||
},
|
||||
input_description: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写输入描述"
|
||||
}
|
||||
}
|
||||
},
|
||||
output_description: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写输出描述"
|
||||
}
|
||||
$("#edit-problem-form").validator()
|
||||
.on('submit', function (e) {
|
||||
if (!e.isDefaultPrevented()){
|
||||
if (vm.testCaseId == "") {
|
||||
bsAlert("你还没有上传测试数据!");
|
||||
return false;
|
||||
}
|
||||
if (vm.description == "") {
|
||||
bsAlert("题目描述不能为空!");
|
||||
return false;
|
||||
}
|
||||
if (vm.timeLimit < 1000 || vm.timeLimit > 5000) {
|
||||
bsAlert("保证时间限制是一个1000-5000的合法整数");
|
||||
return false;
|
||||
}
|
||||
if (vm.samples.length == 0) {
|
||||
bsAlert("请至少添加一组样例!");
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < vm.samples.length; i++) {
|
||||
if (vm.samples[i].input == "" || vm.samples[i].output == "") {
|
||||
bsAlert("样例输入与样例输出不能为空!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.on("success.form.fv", function (e) {
|
||||
e.preventDefault();
|
||||
if (vm.testCaseId == "") {
|
||||
bsAlert("你还没有上传测试数据!");
|
||||
return;
|
||||
}
|
||||
if (vm.description == "") {
|
||||
bsAlert("题目描述不能为空!");
|
||||
return;
|
||||
}
|
||||
if (vm.samples.length == 0) {
|
||||
bsAlert("请至少添加一组样例!");
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < vm.samples.length; i++) {
|
||||
if (vm.samples[i].input == "" || vm.samples[i].output == "") {
|
||||
bsAlert("样例输入与样例输出不能为空!");
|
||||
return;
|
||||
var tags = $("#tags").tagEditor("getTags")[0].tags;
|
||||
if (tags.length == 0) {
|
||||
bsAlert("请至少添加一个标签,这将有利于用户发现你的题目!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (tags.length == 0) {
|
||||
bsAlert("请至少添加一个标签,这将有利于用户发现你的题目!");
|
||||
return;
|
||||
}
|
||||
var ajaxData = {
|
||||
id: avalon.vmodels.admin.problemId,
|
||||
title: vm.title,
|
||||
description: vm.description,
|
||||
time_limit: vm.timeLimit,
|
||||
memory_limit: vm.memoryLimit,
|
||||
samples: [],
|
||||
test_case_id: vm.testCaseId,
|
||||
hint: vm.hint,
|
||||
source: vm.source,
|
||||
visible: vm.visible,
|
||||
tags: $("#tags").tagEditor("getTags")[0].tags,
|
||||
input_description: vm.inputDescription,
|
||||
output_description: vm.outputDescription,
|
||||
difficulty: vm.difficulty
|
||||
};
|
||||
var ajaxData = {
|
||||
id: avalon.vmodels.admin.problemId,
|
||||
title: vm.title,
|
||||
description: vm.description,
|
||||
time_limit: vm.timeLimit,
|
||||
memory_limit: vm.memoryLimit,
|
||||
samples: [],
|
||||
test_case_id: vm.testCaseId,
|
||||
hint: vm.hint,
|
||||
source: vm.source,
|
||||
visible: vm.visible,
|
||||
tags: tags,
|
||||
input_description: vm.inputDescription,
|
||||
output_description: vm.outputDescription,
|
||||
difficulty: vm.difficulty
|
||||
};
|
||||
|
||||
for (var i = 0; i < vm.samples.$model.length; i++) {
|
||||
ajaxData.samples.push({input: vm.samples.$model[i].input, output: vm.samples.$model[i].output});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
beforeSend: csrfTokenHeader,
|
||||
url: "/api/admin/problem/",
|
||||
dataType: "json",
|
||||
data: JSON.stringify(ajaxData),
|
||||
method: "put",
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bsAlert("题目编辑成功!");
|
||||
}
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
}
|
||||
for (var i = 0; i < vm.samples.$model.length; i++) {
|
||||
ajaxData.samples.push({input: vm.samples.$model[i].input, output: vm.samples.$model[i].output});
|
||||
}
|
||||
|
||||
})
|
||||
$.ajax({
|
||||
beforeSend: csrfTokenHeader,
|
||||
url: "/api/admin/problem/",
|
||||
dataType: "json",
|
||||
data: JSON.stringify(ajaxData),
|
||||
method: "put",
|
||||
contentType: "application/json",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bsAlert("题目编辑成功!");
|
||||
}
|
||||
else {
|
||||
bsAlert(data.data);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var vm = avalon.define({
|
||||
@ -257,4 +197,4 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
|
||||
});
|
||||
avalon.scan();
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert", "formValidation"], function ($, avalon, csrfTokenHeader, bsAlert) {
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert"], function ($, avalon, csrfTokenHeader, bsAlert) {
|
||||
|
||||
avalon.ready(function () {
|
||||
if(avalon.vmodels.problemList){
|
||||
@ -71,4 +71,4 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "formValidation"], function
|
||||
|
||||
});
|
||||
avalon.scan();
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert", "formValidation"], function ($, avalon, csrfTokenHeader, bsAlert) {
|
||||
require(["jquery", "avalon", "csrfToken", "bsAlert", "validator"], function ($, avalon, csrfTokenHeader, bsAlert) {
|
||||
|
||||
|
||||
// avalon:定义模式 userList
|
||||
@ -87,77 +87,36 @@ require(["jquery", "avalon", "csrfToken", "bsAlert", "formValidation"], function
|
||||
});
|
||||
}
|
||||
|
||||
$("#edit_user-form")
|
||||
.formValidation({
|
||||
framework: "bootstrap",
|
||||
fields: {
|
||||
username: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写用户名"
|
||||
},
|
||||
stringLength: {
|
||||
min: 3,
|
||||
max: 30,
|
||||
message: '用户名长度必须在3到30位之间'
|
||||
$("#edit_user-form").validator()
|
||||
.on('submit', function (e) {
|
||||
if (!e.isDefaultPrevented()) {
|
||||
var data = {
|
||||
username: vm.username,
|
||||
real_name: vm.realName,
|
||||
email: vm.email,
|
||||
id: vm.id,
|
||||
admin_type: vm.adminType
|
||||
};
|
||||
if ($("#password").val() !== "")
|
||||
data.password = $("#password").val();
|
||||
$.ajax({
|
||||
beforeSend: csrfTokenHeader,
|
||||
url: "/api/admin/user/",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
method: "put",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bsAlert("编辑成功!");
|
||||
getPageData(1);
|
||||
$("#password").val("");
|
||||
} else {
|
||||
bsAlert(data.data);
|
||||
}
|
||||
}
|
||||
},
|
||||
real_name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写真实姓名"
|
||||
}
|
||||
}
|
||||
},
|
||||
email: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: "请填写电子邮箱邮箱地址"
|
||||
},
|
||||
emailAddress: {
|
||||
message: "请填写有效的邮箱地址"
|
||||
}
|
||||
}
|
||||
},
|
||||
password: {
|
||||
validators: {
|
||||
stringLength: {
|
||||
min: 6,
|
||||
max: 30,
|
||||
message: '密码长度必须在6到30位之间'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
).on('success.form.fv', function (e) {
|
||||
e.preventDefault();
|
||||
var data = {
|
||||
username: vm.username,
|
||||
real_name: vm.realName,
|
||||
email: vm.email,
|
||||
id: vm.id,
|
||||
admin_type: vm.adminType
|
||||
};
|
||||
if ($("#password").val() !== "")
|
||||
data.password = $("#password").val();
|
||||
$.ajax({
|
||||
beforeSend: csrfTokenHeader,
|
||||
url: "/api/admin/user/",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
method: "put",
|
||||
success: function (data) {
|
||||
if (!data.code) {
|
||||
bsAlert("提交成功!");
|
||||
getPageData(1);
|
||||
$("#password").val("");
|
||||
} else {
|
||||
bsAlert(data.data);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -53,11 +53,17 @@
|
||||
<h3>添加公告</h3>
|
||||
|
||||
<form id="announcement-form">
|
||||
<div class="form-group"><label>标题</label>
|
||||
<input name="title" type="text" class="form-control" id="title" placeholder="公告标题"></div>
|
||||
<div class="form-group">
|
||||
<label>标题</label>
|
||||
<input name="title" type="text" class="form-control" id="title" placeholder="公告标题"
|
||||
data-error="请填写公告标题(标题不得超过50字)" maxlength="50" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>内容</label>
|
||||
<textarea id="create-announcement-editor" placeholder="公告内容"></textarea>
|
||||
<textarea id="create-announcement-editor" placeholder="公告内容" maxlength="10000" required>
|
||||
</textarea>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
|
||||
@ -36,12 +36,17 @@
|
||||
<form id="edit_group_form">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group"><label>小组名</label>
|
||||
<input type="text" name="name" class="form-control" ms-duplex="name">
|
||||
<input type="text" name="name" class="form-control" ms-duplex="name"
|
||||
data-error="请填写小组名(名称不能超过20字)" maxlength="20" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group"><label>描述</label>
|
||||
<textarea rows="3" name="description" class="form-control" ms-duplex="description"></textarea>
|
||||
<textarea rows="3" name="description" class="form-control" ms-duplex="description"
|
||||
data-error="请填写描述" maxlength="300" required>
|
||||
</textarea>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
@ -58,4 +63,4 @@
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<script src="/static/js/app/admin/group/groupDetail.js"></script>
|
||||
<script src="/static/js/app/admin/group/groupDetail.js"></script>
|
||||
|
||||
@ -3,7 +3,9 @@
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label>题目标题</label>
|
||||
<input type="text" name="title" autofocus class="form-control" ms-duplex="title">
|
||||
<input type="text" name="title" autofocus class="form-control" ms-duplex="title"
|
||||
data-error="请填写题目名称(名称不能超过50个字)" maxlength="50" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
@ -15,21 +17,23 @@
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group"><label>时间限制(ms)</label>
|
||||
|
||||
<input type="number" name="timeLimit" class="form-control" ms-duplex="timeLimit">
|
||||
|
||||
<input type="number" name="timeLimit" class="form-control" ms-duplex="timeLimit"
|
||||
data-error="请输入时间限制(保证是一个1000-5000的合法整数)" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group"><label>内存限制(MB)</label>
|
||||
|
||||
|
||||
<input type="number" name="memoryLimit" class="form-control" ms-duplex="memoryLimit">
|
||||
<input type="number" name="memoryLimit" class="form-control" ms-duplex="memoryLimit"
|
||||
data-error="请输入内存限制(保证是一个合法整数)" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group"><label>难度</label>
|
||||
<input type="number" name="difficulty" class="form-control" ms-duplex="difficulty">
|
||||
<input type="number" name="difficulty" class="form-control" ms-duplex="difficulty"
|
||||
data-error="请输入难度(保证是一个合法整数)" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 form-group">
|
||||
@ -45,12 +49,18 @@
|
||||
<div class="col-md-12 form-group">
|
||||
<label>输入描述</label><br>
|
||||
<textarea class="form-control" rows="5" name="input_description"
|
||||
ms-duplex="inputDescription"></textarea>
|
||||
ms-duplex="inputDescription"data-error="请填写输入描述"
|
||||
maxlength="10000" required>
|
||||
</textarea>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="col-md-12 form-group">
|
||||
<label>输出描述</label><br>
|
||||
<textarea class="form-control" rows="5" name="output_description"
|
||||
ms-duplex="outputDescription"></textarea>
|
||||
ms-duplex="outputDescription"data-error="请填写输出描述"
|
||||
maxlength="10000" required>
|
||||
</textarea>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="col-md-12"><br>
|
||||
<label>样例</label>
|
||||
|
||||
@ -9,7 +9,9 @@
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label>题目标题</label>
|
||||
<input type="text" name="title" autofocus class="form-control" ms-duplex="title">
|
||||
<input type="text" name="title" autofocus class="form-control" ms-duplex="title"
|
||||
data-error="请填写题目名称(名称不能超过30个字)" maxlength="30" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
@ -21,17 +23,23 @@
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group"><label>时间限制(ms)</label>
|
||||
<input type="number" name="cpu" class="form-control" ms-duplex="timeLimit">
|
||||
<input type="number" name="timeLimit" class="form-control" ms-duplex="timeLimit"
|
||||
data-error="请输入时间限制(保证是一个1000-5000的合法整数)" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group"><label>内存限制(MB)</label>
|
||||
<input type="number" name="memory" class="form-control" ms-duplex="memoryLimit">
|
||||
<input type="number" name="memory" class="form-control" ms-duplex="memoryLimit"
|
||||
data-error="请输入内存限制(保证是一个合法整数)" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group"><label>难度</label>
|
||||
<input type="number" name="difficulty" class="form-control" ms-duplex="difficulty">
|
||||
<input type="number" name="difficulty" class="form-control" ms-duplex="difficulty"
|
||||
data-error="请输入难度(保证是一个合法整数)" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 form-group">
|
||||
@ -47,12 +55,18 @@
|
||||
<div class="col-md-12 form-group">
|
||||
<label>输入描述</label><br>
|
||||
<textarea class="form-control" rows="5" name="input_description"
|
||||
ms-duplex="inputDescription"></textarea>
|
||||
ms-duplex="inputDescription" data-error="请填写输入描述"
|
||||
maxlength="10000" required>
|
||||
</textarea>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="col-md-12 form-group">
|
||||
<label>输出描述</label><br>
|
||||
<textarea class="form-control" rows="5" name="output_escription"
|
||||
ms-duplex="outputDescription"></textarea>
|
||||
ms-duplex="outputDescription" data-error="请填写输出描述"
|
||||
maxlength="10000" required>
|
||||
</textarea>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="col-md-12"><br>
|
||||
<label>样例</label>
|
||||
@ -126,4 +140,4 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/app/admin/problem/edit_problem.js"></script>
|
||||
<script src="/static/js/app/admin/problem/edit_problem.js"></script>
|
||||
|
||||
@ -52,19 +52,26 @@
|
||||
<input name="id" type="number" class="form-control" readonly ms-duplex="id">
|
||||
</div>
|
||||
<div class="form-group col-md-4"><label>用户名</label>
|
||||
<input name="username" type="text" class="form-control" ms-duplex="username">
|
||||
<input name="username" type="text" class="form-control" ms-duplex="username"
|
||||
data-minlength="3" data-minlength-error="用户名不得少于3位" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="form-group col-md-4"><label>真实姓名</label>
|
||||
<input name="real_name" type="text" class="form-control" ms-duplex="realName">
|
||||
<input name="real_name" type="text" class="form-control" ms-duplex="realName"
|
||||
data-error="请填写真实姓名" maxlength="30" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4"><label>新密码(留空则保留原密码)</label>
|
||||
<input name="password" type="password" class="form-control" id="password" ms-duplex="password"
|
||||
placeholder="此项留空则保留原密码">
|
||||
placeholder="此项留空则保留原密码" data-minlength="6" data-minlength-error="密码不得少于6位">
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="form-group col-md-4"><label>电子邮箱</label>
|
||||
<input name="email" type="email" class="form-control" ms-duplex="email">
|
||||
<input name="email" type="email" class="form-control" ms-duplex="email"
|
||||
data-error="请填写邮箱地址(并保证是正确的邮箱格式)" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="form-group col-md-4"><label>用户类型</label>
|
||||
<select name="admin_type" class="form-control" ms-duplex="adminType">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user