fix js format
This commit is contained in:
@@ -2,7 +2,8 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
|
|||||||
function ($, avalon, editor, uploader, bsAlert, csrfTokenHeader) {
|
function ($, avalon, editor, uploader, bsAlert, csrfTokenHeader) {
|
||||||
|
|
||||||
avalon.ready(function () {
|
avalon.ready(function () {
|
||||||
avalon.vmodels.editProblem = null;
|
|
||||||
|
|
||||||
|
|
||||||
$("#edit-problem-form").validator()
|
$("#edit-problem-form").validator()
|
||||||
.on('submit', function (e) {
|
.on('submit', function (e) {
|
||||||
@@ -76,42 +77,48 @@ require(["jquery", "avalon", "editor", "uploader", "bsAlert", "csrfToken", "tagE
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var vm = avalon.define({
|
if(avalon.vmodels.editProblem){
|
||||||
$id: "editProblem",
|
var vm = avalon.vmodels.editProblem;
|
||||||
title: "",
|
}
|
||||||
description: "",
|
else {
|
||||||
timeLimit: -1,
|
var vm = avalon.define({
|
||||||
memoryLimit: -1,
|
$id: "editProblem",
|
||||||
samples: [],
|
title: "",
|
||||||
hint: "",
|
description: "",
|
||||||
visible: true,
|
timeLimit: -1,
|
||||||
difficulty: 0,
|
memoryLimit: -1,
|
||||||
inputDescription: "",
|
samples: [],
|
||||||
outputDescription: "",
|
hint: "",
|
||||||
testCaseIdd: "",
|
visible: true,
|
||||||
uploadSuccess: false,
|
difficulty: 0,
|
||||||
source: "",
|
inputDescription: "",
|
||||||
testCaseList: [],
|
outputDescription: "",
|
||||||
addSample: function () {
|
testCaseIdd: "",
|
||||||
vm.samples.push({input: "", output: "", "visible": true});
|
uploadSuccess: false,
|
||||||
},
|
source: "",
|
||||||
delSample: function (sample) {
|
testCaseList: [],
|
||||||
if (confirm("你确定要删除么?")) {
|
addSample: function () {
|
||||||
vm.samples.remove(sample);
|
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");
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
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 hintEditor = editor("#hint");
|
||||||
var descriptionEditor = editor("#problemDescription");
|
var descriptionEditor = editor("#problemDescription");
|
||||||
var testCaseUploader = uploader("#testCaseFile", "/api/admin/test_case_upload/", function (file, response) {
|
var testCaseUploader = uploader("#testCaseFile", "/api/admin/test_case_upload/", function (file, response) {
|
||||||
|
|||||||
Reference in New Issue
Block a user