diff --git a/static/src/css/admin.css b/static/src/css/admin.css index c8daf65..b9fc4cb 100644 --- a/static/src/css/admin.css +++ b/static/src/css/admin.css @@ -5,6 +5,7 @@ @import url("simditor/simditor.css"); @import url("webuploader/webuploader.css"); @import url("datetime_picker/bootstrap-datetimepicker.css"); +@import url("tagEditor/jquery.tag-editor.css"); #loading-gif{ width: 40px; diff --git a/static/src/js/app/admin/problem/add_problem.js b/static/src/js/app/admin/problem/add_problem.js index 8213ad5..8de48cd 100644 --- a/static/src/js/app/admin/problem/add_problem.js +++ b/static/src/js/app/admin/problem/add_problem.js @@ -64,18 +64,15 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito }) .on("success.form.fv", function (e) { e.preventDefault(); - if (vm.test_case_id == '') - { + if (vm.test_case_id == '') { bs_alert("你还没有上传测试数据!"); return; } - if (vm.description == '') - { + if (vm.description == '') { bs_alert("题目描述不能为空!"); return; } - if (vm.hint == '') - { + if (vm.hint == '') { bs_alert("提示不能为空!"); return; } @@ -88,33 +85,30 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito test_case_id: vm.test_case_id, hint: vm.hint, source: vm.source, - tags: [], + tags: $("#tags").tagEditor("getTags")[0].tags, difficulty: vm.difficulty }; - if (vm.samples.length == 0) - { + if (vm.samples.length == 0) { bs_alert("请至少添加一组样例!"); return; } - var tags = $("#tags").tagEditor("getTags")[0].tags; - if (tags.length == 0) - { + + if (tags.length == 0) { bs_alert("请至少添加一个标签,这将有利于用户发现你的题目!"); return; } - for (key in vm.samples.length) { - ajaxData.samples.push({input: vm.samples[key].input, output: vm.samples[key].output}); + + 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}); } - for (key in tags) { - ajaxData.tags.push(tags[key].tag); - } - console.log(ajaxData); + $.ajax({ beforeSend: csrfHeader, url: "/api/admin/problem/", dataType: "json", - data:ajaxData, + data: JSON.stringify(ajaxData), method: "post", + contentType: "application/json", success: function (data) { if (!data.code) { bs_alert("successful!"); @@ -188,8 +182,8 @@ require(["jquery", "avalon", "editor", "uploader", "bs_alert", "csrf", "tagEdito if (!data.code) { tagList = data.data; completeList = []; - for (key in tagList) { - completeList.push(tagList[key].name); + for (var i = 0; i < tagList.length; i++) { + completeList.push(tagList[i].name); } $("#tags").tagEditor({ autocomplete: { diff --git a/template/admin/problem/add_problem.html b/template/admin/problem/add_problem.html index d039302..0b952c9 100644 --- a/template/admin/problem/add_problem.html +++ b/template/admin/problem/add_problem.html @@ -1,103 +1,113 @@
-
-
- - -
-
- - -
-
- - - 请填写题目描述 -
-
- - -
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
- -
-

- - 添加 +
+ + +
-
-
- -
-
-
- - -
+
+ + + 请填写题目描述 +
+ + +
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+

+ + 添加 + +
+
+ +
+
+
+ +
-
-
- - -
+
+
+
+ +
-

-
- 请将所有测试用例打包在一个文件中上传,所有文件要在压缩包的根目录,且输入输出文件名要以从1开始连续数字标识要对应例如:
- 1.in 1.out 2.in 2.out
- - - -
编号输入文件名输出文件名
{{$index}}{{el.input}}{{el.output}}
-
-
-
-
选择文件
-
+
+

+
+ 请将所有测试用例打包在一个文件中上传,所有文件要在压缩包的根目录,且输入输出文件名要以从1开始连续数字标识要对应例如:
+ 1.in 1.out 2.in 2.out +
+ + + + + + + + + + + +
编号输入文件名输出文件名
{{$index + 1}}{{ el.input }}{{ el.output }}
+
+
+
+
选择文件
+
+ + +
+
+ + +
+
- - \ No newline at end of file + \ No newline at end of file diff --git a/template/oj/problem/problem.html b/template/oj/problem/problem.html index a4dde86..5a7a3b6 100644 --- a/template/oj/problem/problem.html +++ b/template/oj/problem/problem.html @@ -7,16 +7,15 @@ 题目
  • 我的提交
  • -

    Battle Over Cities - Hard Version

    +

    {{ problem.title }}

    -

    发布时间: 2015-07-05 CPU: 1000ms 内存: 256M

    +

    发布时间: {{ problem.create_time }} CPU: {{ problem.time_limit }}ms 内存: {{ problem.memory_limit }}M

    -

    n的阶乘定义为n!=1*2*3*……*n 如3!=6 - n!通常最后会有很多0,如5!=120 最后有一个0,现在统计n!去除末尾的0后,最后k位是多少

    +

    {{ problem.description|safe }}

    @@ -28,47 +27,37 @@

    第一行包括两个数n,k

    + {% for item in samples %}
    -
    -1 2 3 4 5 6 7
    -1 2 3 4 5 6 7
    +
    +{{ item.input }}
    -1 2 3 4 5 6 7
    -
    -
    - -
    -1 2 3 4 5 6 7
    -1 2 3 4 5 6 7
    - -
    -
    - - -
    -1 2 3 4 5 6 7
    +{{ item.output }}
    + {% endfor %}
    - + {% if problem.hind %}
    -

    画一下图

    +

    {{ problem.hint|safe }}

    + {% endif %}

    - Success - Info + {% for tag in problem.tags.all %} + {{ tag.name }} + {% endfor %}