diff --git a/problem/tests.py b/problem/tests.py index 7ce503c..b66a494 100644 --- a/problem/tests.py +++ b/problem/tests.py @@ -1,3 +1,6 @@ +# coding=utf-8 from django.test import TestCase -# Create your tests here. + +class ProblemPageTest(TestCase): + pass diff --git a/problem/views.py b/problem/views.py index 91ea44a..7509a3c 100644 --- a/problem/views.py +++ b/problem/views.py @@ -1,3 +1,7 @@ +# coding=utf-8 from django.shortcuts import render -# Create your views here. + +def problem_page(request, problem_id): + # todo + return render(request, "problem/problem.html") diff --git a/qduoj/urls.py b/qduoj/urls.py index 22f98b2..59baceb 100644 --- a/qduoj/urls.py +++ b/qduoj/urls.py @@ -16,5 +16,6 @@ urlpatterns = [ url(r'^login/$', TemplateView.as_view(template_name="account/login.html"), name="user_login_page"), url(r'^api/login/$', UserLoginAPIView.as_view(), name="login_api"), url(r'^api/login/$', UserLoginAPIView.as_view(), name="user_login_api"), + url(r'^problem/(?P\d+)/$', "problem.views.problem_page", name="problem_page"), ] diff --git a/static/src/css/oj.css b/static/src/css/oj.css index 989299e..c83a8cc 100644 --- a/static/src/css/oj.css +++ b/static/src/css/oj.css @@ -1,5 +1,6 @@ @import url("bootstrap/bootstrap.min.css"); @import url("bootstrap/todc-bootstrap.min.css"); +@import url("codeMirror/codemirror.css"); html, body { height: 100%; } diff --git a/static/src/js/app/oj.js b/static/src/js/app/oj.js index 03c344b..49fcafc 100644 --- a/static/src/js/app/oj.js +++ b/static/src/js/app/oj.js @@ -1,3 +1,3 @@ -require(["bootstrap", "login"]); +require(["bootstrap", "login", "submit_code"]); diff --git a/static/src/js/app/problem/submit_code.js b/static/src/js/app/problem/submit_code.js new file mode 100644 index 0000000..287554c --- /dev/null +++ b/static/src/js/app/problem/submit_code.js @@ -0,0 +1,31 @@ +require(["jquery", "code_mirror"], function ($, code_mirror) { + var code_editor = code_mirror($("#code-editor")[0], "text/x-csrc"); + + $("#language-selector").change(function () { + var language = $("#language-selector").val(); + var language_types = {c: "text/x-csrc", cpp: "text/x-c++src", java: "text/x-java"}; + code_editor.setOption("mode", language_types[language]); + }); + + function show_loading() { + $("#submit-code-button").attr("disabled", "disabled"); + $("#loading-gif").show(); + } + + function hide_loading() { + $("#submit-code-button").removeAttr("disabled"); + $("#loading-gif").hide(); + } + + $("#submit-code-button").click(function () { + show_loading(); + setTimeout( + function () { + $("#a").animate({opacity: '1'}) + } + , + 3); + + }) + +}); diff --git a/static/src/js/app/submit/submit_code.js b/static/src/js/app/submit/submit_code.js deleted file mode 100644 index cd04be0..0000000 --- a/static/src/js/app/submit/submit_code.js +++ /dev/null @@ -1,32 +0,0 @@ -require(["../../config"], function (config) { - require(["jquery", "avalon", "code_mirror"], function ($, avalon, code_mirror) { - var code_editor = code_mirror($("#code-editor")[0], "text/x-csrc"); - - $("#language-selector").change(function () { - var language = $("#language-selector").val(); - var language_types = {c: "text/x-csrc", cpp: "text/x-c++src", java: "text/x-java"}; - code_editor.setOption("mode", language_types[language]); - }); - - function show_loading(){ - $("#submit-code-button").attr("disabled", "disabled"); - $("#loading-gif").show(); - } - - function hide_loading(){ - $("#submit-code-button").removeAttr("disabled"); - $("#loading-gif").hide(); - } - - $("#submit-code-button").click(function () { - show_loading(); - setTimeout( - function(){ - $("#a").animate({opacity:'1'})} - , - 3); - - }) - - }); -}); \ No newline at end of file diff --git a/static/src/js/build.js b/static/src/js/build.js index 533a891..c60dbd3 100644 --- a/static/src/js/build.js +++ b/static/src/js/build.js @@ -15,6 +15,7 @@ login: "app/account/login", oj: "app/oj", "bs_alert": "utils/bs_alert", + submit_code: "app/problem/submit_code", //formValidation 不要在代码中单独使用,而是使用和修改utils/validation base: "lib/formValidation/base", diff --git a/static/src/js/config.js b/static/src/js/config.js index a612ddd..d0eb372 100644 --- a/static/src/js/config.js +++ b/static/src/js/config.js @@ -14,6 +14,7 @@ var require = { login: "app/account/login", oj: "app/oj", "bs_alert": "utils/bs_alert", + submit_code: "app/problem/submit_code", //formValidation 不要在代码中单独使用,而是使用和修改utils/validation diff --git a/template/problem/problem.html b/template/problem/problem.html new file mode 100644 index 0000000..24f9488 --- /dev/null +++ b/template/problem/problem.html @@ -0,0 +1,90 @@ +{% extends 'oj_base.html' %} + +{% block body %} +
+ +

Battle Over Cities - Hard Version

+ +

cpu: 1000ms 内存: 256M

+ +
+
+ + +

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

+
+
+ + +

第一行包括两个数n,k

+
+
+ + +

第一行包括两个数n,k

+
+
+ +
+1 2 3 4 5 6 7
+1 2 3 4 5 6 7
+ +
+
+ + +
+1 2 3 4 5 6 7
+
+
+ +
+ + + +
+
+
+ + +
+
+
+ + + +
+
+
+ + + + +
+
+
+{% endblock %} \ No newline at end of file