增加题目页面和我的提交页面的代码
This commit is contained in:
@@ -42,4 +42,6 @@ urlpatterns = [
|
|||||||
url(r'^api/admin/problem/$', ProblemAdminAPIView.as_view(), name="problem_admin_api"),
|
url(r'^api/admin/problem/$', ProblemAdminAPIView.as_view(), name="problem_admin_api"),
|
||||||
url(r'^api/admin/test_case_upload/$', TestCaseUploadAPIView.as_view(), name="test_case_upload_api"),
|
url(r'^api/admin/test_case_upload/$', TestCaseUploadAPIView.as_view(), name="test_case_upload_api"),
|
||||||
url(r'^api/admin/tag/$', ProblemTagAdminAPIView.as_view(), name="problem_tag_admin_api"),
|
url(r'^api/admin/tag/$', ProblemTagAdminAPIView.as_view(), name="problem_tag_admin_api"),
|
||||||
|
url(r'^problem/(?P<problem_id>\d+)/my_solutions/', "problem.views.problem_my_solutions_list_page", name="problem_my_solutions_page"),
|
||||||
|
url(r'^my_solution/(?P<solution_id>\d+)/$', "problem.views.my_solution", name="my_solution_page"),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -44,8 +44,20 @@ class ProblemTagAdminAPIView(APIView):
|
|||||||
|
|
||||||
|
|
||||||
def problem_page(request, problem_id):
|
def problem_page(request, problem_id):
|
||||||
# todo
|
# try:
|
||||||
return render(request, "oj/problem/problem.html")
|
# problem = Problem.objects.get(id=problem_id)
|
||||||
|
# except Problem.DoesNotExist:
|
||||||
|
# return render(request, "utils/error.html", {"error": u"题目不存在"})
|
||||||
|
return render(request, "oj/problem/problem.html", {"problem": {}})
|
||||||
|
|
||||||
|
|
||||||
|
def problem_my_solutions_list_page(request, problem_id):
|
||||||
|
return render(request, "oj/problem/my_solutions_list.html")
|
||||||
|
|
||||||
|
|
||||||
|
def my_solution(request, solution_id):
|
||||||
|
return render(request, "oj/problem/my_solution.html")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProblemAdminAPIView(APIView):
|
class ProblemAdminAPIView(APIView):
|
||||||
|
|||||||
31
template/oj/problem/my_solution.html
Normal file
31
template/oj/problem/my_solution.html
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{% extends 'oj_base.html' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<div class="container main">
|
||||||
|
<ul class="nav nav-tabs nav-tabs-google">
|
||||||
|
<li role="presentation">
|
||||||
|
<a href="problem.html">题目</a></li>
|
||||||
|
<li role="presentation" class="active"><a href="my_solutions_list.html">我的提交</a></li>
|
||||||
|
<li role="presentation"><a href="#">讨论</a></li>
|
||||||
|
</ul>
|
||||||
|
<h2 class="text-center">Battle Over Cities - Hard Version</h2>
|
||||||
|
<p class="text-muted text-center">cpu: 1000ms 内存: 256M</p>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-body">
|
||||||
|
<h4>运行结果:<span class="text-success">Accepted</span></h4>
|
||||||
|
<p>cpu: 1000ms 内存: 256M 语言:python</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="code-field">
|
||||||
|
<textarea id="code-editor">
|
||||||
|
#include <stdio.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printf("Hello world");
|
||||||
|
return 0;
|
||||||
|
}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
53
template/oj/problem/my_solutions_list.html
Normal file
53
template/oj/problem/my_solutions_list.html
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{% extends 'oj_base.html' %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<div class="container main">
|
||||||
|
<ul class="nav nav-tabs nav-tabs-google">
|
||||||
|
<li role="presentation">
|
||||||
|
<a href="/problem/1/">题目</a></li>
|
||||||
|
<li role="presentation" class="active"><a href="my_solutions_list.html">我的提交</a></li>
|
||||||
|
</ul>
|
||||||
|
<h2 class="text-center">Battle Over Cities - Hard Version</h2>
|
||||||
|
<p class="text-muted text-center">cpu: 1000ms 内存: 256M</p>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr class=""success>
|
||||||
|
<th>#</th>
|
||||||
|
<th>提交时间</th>
|
||||||
|
<th>结果</th>
|
||||||
|
<th>运行时间</th>
|
||||||
|
<th>运行内存</th>
|
||||||
|
<th>语言</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="warning">
|
||||||
|
<th scope="row">1</th>
|
||||||
|
<td>1</td>
|
||||||
|
<td>Error Format</td>
|
||||||
|
<td>3</td>
|
||||||
|
<td>3</td>
|
||||||
|
<td>3</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="danger">
|
||||||
|
<th scope="row">2</th>
|
||||||
|
<td>Wrong</td>
|
||||||
|
<td>Wrong Answer</td>
|
||||||
|
<td>@fat</td>
|
||||||
|
<td>3</td>
|
||||||
|
<td>3</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="success">
|
||||||
|
<th scope="row">3</th>
|
||||||
|
<td>Larry</td>
|
||||||
|
<td>Accepted</td>
|
||||||
|
<td>@twitter</td>
|
||||||
|
<td>3</td>
|
||||||
|
<td>3</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -5,11 +5,11 @@
|
|||||||
<ul class="nav nav-tabs nav-tabs-google">
|
<ul class="nav nav-tabs nav-tabs-google">
|
||||||
<li role="presentation" class="active">
|
<li role="presentation" class="active">
|
||||||
<a href="problem.html">题目</a></li>
|
<a href="problem.html">题目</a></li>
|
||||||
<li role="presentation"><a href="my_solutions_list.html">我的提交</a></li>
|
<li role="presentation"><a href="/problem/1/my_solutions/">我的提交</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2 class="text-center">Battle Over Cities - Hard Version</h2>
|
<h2 class="text-center">Battle Over Cities - Hard Version</h2>
|
||||||
|
|
||||||
<p class="text-muted text-center">cpu: 1000ms 内存: 256M</p>
|
<p class="text-muted text-center">发布时间: 2015-07-05 CPU: 1000ms 内存: 256M</p>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class="problem-section">
|
<div class="problem-section">
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<p class="problem-detail">第一行包括两个数n,k</p>
|
<p class="problem-detail">第一行包括两个数n,k</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="problem-section">
|
<div class="problem-section">
|
||||||
<label class="problem-label">样例输入</label>
|
<label class="problem-label">样例输入1</label>
|
||||||
<pre title="双击可以复制哦~">
|
<pre title="双击可以复制哦~">
|
||||||
1 2 3 4 5 6 7
|
1 2 3 4 5 6 7
|
||||||
1 2 3 4 5 6 7</pre>
|
1 2 3 4 5 6 7</pre>
|
||||||
@@ -37,12 +37,44 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="problem-section">
|
<div class="problem-section">
|
||||||
|
|
||||||
<label class="problem-label">样例输出</label>
|
<label class="problem-label">样例输出1</label>
|
||||||
|
<pre>
|
||||||
|
1 2 3 4 5 6 7</pre>
|
||||||
|
</div>
|
||||||
|
<div class="problem-section">
|
||||||
|
<label class="problem-label">样例输入2</label>
|
||||||
|
<pre title="双击可以复制哦~">
|
||||||
|
1 2 3 4 5 6 7
|
||||||
|
1 2 3 4 5 6 7</pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="problem-section">
|
||||||
|
|
||||||
|
<label class="problem-label">样例输出2</label>
|
||||||
<pre>
|
<pre>
|
||||||
1 2 3 4 5 6 7</pre>
|
1 2 3 4 5 6 7</pre>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<button type="button" id="show-more-btn" class="btn btn-info btn-sm">查看隐藏信息</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="problem-section hide">
|
||||||
|
<label class="problem-label">提示</label>
|
||||||
|
|
||||||
|
<p class="problem-detail">画一下图</p>
|
||||||
|
</div>
|
||||||
|
<div class="problem-section hide">
|
||||||
|
<label class="problem-label">标签</label>
|
||||||
|
|
||||||
|
<p class="problem-detail">
|
||||||
|
<span class="label label-success">Success</span>
|
||||||
|
<span class="label label-info">Info</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>选择语言</label>
|
<label>选择语言</label>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="radio-inline">
|
<label class="radio-inline">
|
||||||
<input type="radio" name="inlineRadioOptions" value="c" checked> c (gcc 4.8)
|
<input type="radio" name="inlineRadioOptions" value="c" checked> c (gcc 4.8)
|
||||||
@@ -55,6 +87,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="code-field">
|
<div id="code-field">
|
||||||
<label class="problem-label">提交代码</label>
|
<label class="problem-label">提交代码</label>
|
||||||
<textarea id="code-editor"></textarea>
|
<textarea id="code-editor"></textarea>
|
||||||
@@ -89,5 +122,5 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block js_block %}
|
{% block js_block %}
|
||||||
<script src="/static/js/app/oj/problem/submit_code.js"></script>
|
<script src="/static/js/app/oj/problem/problem.js"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user