From 8b058a37857edd06fa91c873f51d04e9a11a014e Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Sun, 2 Aug 2015 09:47:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B7=B2=E7=BB=8F=E5=86=99?= =?UTF-8?q?=E5=A5=BD=E7=9A=84=20admin=20=E7=9A=84=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oj/settings.py | 4 +- oj/urls.py | 6 +- static/src/css/admin.css | 25 +++++ static/src/css/oj.css | 49 --------- static/src/js/app/admin.js | 5 +- static/src/js/config.js | 11 +- template/admin/add_contest.html | 183 ++++++++++++++++++++++++++++++++ template/admin/index.html | 4 + template/admin_base.html | 112 ++++++++++++++++++- template/contest/problems.html | 15 +++ template/oj_base.html | 8 +- template/utils/index.html | 37 +++++++ 12 files changed, 391 insertions(+), 68 deletions(-) create mode 100644 static/src/css/admin.css create mode 100644 template/admin/add_contest.html create mode 100644 template/admin/index.html create mode 100644 template/contest/problems.html create mode 100644 template/utils/index.html diff --git a/oj/settings.py b/oj/settings.py index 3fa0e0b..803e43a 100644 --- a/oj/settings.py +++ b/oj/settings.py @@ -31,8 +31,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'hzfp^8mbgapc&x%$#xv)0=t8s7_ilingw(q3!@h&2fty6v6fxz' - - ALLOWED_HOSTS = [] @@ -103,7 +101,7 @@ USE_TZ = True STATIC_URL = '/static/' -STATICFILES_DIRS = (os.path.join(BASE_DIR, "static/release/"),) +STATICFILES_DIRS = (os.path.join(BASE_DIR, "static/src/"),) TEMPLATE_DIRS = ( os.path.join(BASE_DIR, "template"), diff --git a/oj/urls.py b/oj/urls.py index a9438fa..7c7e30e 100644 --- a/oj/urls.py +++ b/oj/urls.py @@ -6,12 +6,14 @@ from django.views.generic import TemplateView from account.views import UserLoginAPIView urlpatterns = [ + url("^$", TemplateView.as_view(template_name="utils/index.html"), name="index_page"), url(r'^docs/', include('rest_framework_swagger.urls')), - - url(r'^admin/', include(admin.site.urls)), + url(r'^admin/$', TemplateView.as_view(template_name="admin/index.html"), name="admin_index_page"), 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"), + url(r'^admin/contest/$', TemplateView.as_view(template_name="admin/add_contest.html"), name="add_contest_page"), + ] diff --git a/static/src/css/admin.css b/static/src/css/admin.css new file mode 100644 index 0000000..75fc901 --- /dev/null +++ b/static/src/css/admin.css @@ -0,0 +1,25 @@ +@import url("bootstrap/bootstrap.min.css"); +@import url("bootstrap/todc-bootstrap.min.css"); +@import url("codeMirror/codemirror.css"); +@import url("simditor/simditor.css"); +@import url("webuploader/webuploader.css"); +@import url("datetime_picker/bootstrap-datetimepicker.css"); +html, body { + height: 100%; +} + +img { + max-width: 100%; + height: auto; +} + +.footer { + padding-top: 30px; + padding-bottom: 30px; + float: bottom; + bottom: 0; +} + +label { + font-size: 16px; +} \ No newline at end of file diff --git a/static/src/css/oj.css b/static/src/css/oj.css index c83a8cc..4cbaf03 100644 --- a/static/src/css/oj.css +++ b/static/src/css/oj.css @@ -29,8 +29,6 @@ label { padding-top: 15px; } - - #loading { display: none; } @@ -40,53 +38,6 @@ label { height: 300px; } -.glyphicon-refresh-animate { - -animation: spin .9s infinite linear; - -webkit-animation: spin2 .9s infinite linear; -} - -@-webkit-keyframes spin2 { - from { - -webkit-transform: rotate(0deg); - } - to { - -webkit-transform: rotate(360deg); - } -} - -@keyframes spin { - from { - transform: scale(1) rotate(0deg); - } - to { - transform: scale(1) rotate(360deg); - } -} - -.callout { - padding: 5px; - margin: 20px 0; - border: 1px solid #eee; - border-left-width: 5px; - border-radius: 3px; -} - -.callout-danger { - border-left-color: #dd4b39; -} - -.callout-info { - border-left-color: #d0e3f0; -} - -.callout-warning { - border-left-color: #f1e7bc; -} - -.callout p { - font-size: 16px;; -} - .problem-section { padding-top: 5px; padding-bottom: 5px; diff --git a/static/src/js/app/admin.js b/static/src/js/app/admin.js index e57b2c2..bc13d9d 100644 --- a/static/src/js/app/admin.js +++ b/static/src/js/app/admin.js @@ -1,5 +1,5 @@ -define(["jquery", "avalon", "editor", "uploader", "datetime_picker", - "validation", "dropdown" +require(["jquery", "avalon", "editor", "uploader", "datetimepicker", + "validation" ], function ($, avalon, editor, uploader) { $("#add-contest-form") @@ -102,7 +102,6 @@ define(["jquery", "avalon", "editor", "uploader", "datetime_picker", text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } - var editor1 = editor("#editor"); var vm = avalon.define({ diff --git a/static/src/js/config.js b/static/src/js/config.js index d0eb372..487d4ba 100644 --- a/static/src/js/config.js +++ b/static/src/js/config.js @@ -16,7 +16,6 @@ var require = { "bs_alert": "utils/bs_alert", submit_code: "app/problem/submit_code", - //formValidation 不要在代码中单独使用,而是使用和修改utils/validation base: "lib/formValidation/base", helper: "lib/formValidation/helper", @@ -39,10 +38,16 @@ var require = { code_mirror_clang: "lib/codeMirror/language/clike", //bootstrap - bootstrap: "lib/bootstrap/bootstrap" + bootstrap: "lib/bootstrap/bootstrap", + + // + "_datetimepicker": "lib/datetime_picker/bootstrap-datetimepicker", + "datetimepicker": "lib/datetime_picker/bootstrap-datetimepicker.zh-CN" }, shim: { - "bootstrap": {"deps": ['jquery']} + "bootstrap": {"deps": ['jquery']}, + "_datetimepicker": {"deps": ["jquery"]}, + "datetimepicker": {"deps": ["_datetimepicker"]} } }; \ No newline at end of file diff --git a/template/admin/add_contest.html b/template/admin/add_contest.html new file mode 100644 index 0000000..47bc2d3 --- /dev/null +++ b/template/admin/add_contest.html @@ -0,0 +1,183 @@ +{% extends "admin_base.html" %} +{% block body %} + {% verbatim %} +
+ + +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ +
+
+ +
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+
+ OI + ACM +
+
+
+
+ 开放排名 +
+
+ +
+ + 添加 +
+
+
+
+ +
+
+ +
+ +
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ + + + 添加 + + +
+
+
+ 样例{{$index + 1}} + + + {{ sample.toggle_string }} + + + 删除 + + +
+
+
+ + +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+
选择文件
+ +
+
+
+
+
+
+ +
+
+
+ {% endverbatim %} +{% endblock %} \ No newline at end of file diff --git a/template/admin/index.html b/template/admin/index.html new file mode 100644 index 0000000..df51a66 --- /dev/null +++ b/template/admin/index.html @@ -0,0 +1,4 @@ +{% extends "admin_base.html" %} +{% block body %} +Hello world +{% endblock %} \ No newline at end of file diff --git a/template/admin_base.html b/template/admin_base.html index 71ce692..2f404d8 100644 --- a/template/admin_base.html +++ b/template/admin_base.html @@ -1,10 +1,116 @@ - - - + + + + + + + 在线评测系统 - 后台管理 + + + {% block css_block %}{% endblock %} + + + + + + + + + + + + + + + +
+
+ +
+ +
+ + + + {% block body %}{% endblock %} + +
+
+ + + + + + + + + \ No newline at end of file diff --git a/template/contest/problems.html b/template/contest/problems.html new file mode 100644 index 0000000..88dd9d2 --- /dev/null +++ b/template/contest/problems.html @@ -0,0 +1,15 @@ +{% extends "oj_base.html" %} +{% block body %} +
+ +

第一次比赛

+ +

开始时间: 2015-6-8 19:00 结束时间: 2015-9-1 12:00

+ +
+{% endblock %} \ No newline at end of file diff --git a/template/oj_base.html b/template/oj_base.html index 66e760b..d90c1ef 100644 --- a/template/oj_base.html +++ b/template/oj_base.html @@ -26,7 +26,6 @@