增加题目页面和我的提交页面的代码

This commit is contained in:
virusdefender
2015-08-10 20:19:22 +08:00
parent 441b7383bc
commit 502b4944f1
5 changed files with 199 additions and 68 deletions

View File

@@ -42,4 +42,6 @@ urlpatterns = [
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/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"),
]

View File

@@ -44,8 +44,20 @@ class ProblemTagAdminAPIView(APIView):
def problem_page(request, problem_id):
# todo
return render(request, "oj/problem/problem.html")
# try:
# 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):

View 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 &lt;stdio.h&gt;
int main()
{
printf(&quot;Hello world&quot;);
return 0;
}</textarea>
</div>
</div>
{% endblock %}

View 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 %}

View File

@@ -1,93 +1,126 @@
{% extends 'oj_base.html' %}
{% block body %}
<div class="container main">
<ul class="nav nav-tabs nav-tabs-google">
<li role="presentation" class="active">
<a href="problem.html">题目</a></li>
<li role="presentation"><a href="my_solutions_list.html">我的提交</a></li>
</ul>
<h2 class="text-center">Battle Over Cities - Hard Version</h2>
<div class="container main">
<ul class="nav nav-tabs nav-tabs-google">
<li role="presentation" class="active">
<a href="problem.html">题目</a></li>
<li role="presentation"><a href="/problem/1/my_solutions/">我的提交</a></li>
</ul>
<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 class="problem-section">
<label class="problem-label">描述</label>
<div>
<div class="problem-section">
<label class="problem-label">描述</label>
<p class="problem-detail"> n的阶乘定义为n!=1*2*3*……*n 如3!=6
n!通常最后会有很多0如5!=120 最后有一个0现在统计n!去除末尾的0后最后k位是多少</p>
</div>
<div class="problem-section">
<label class="problem-label">输入</label>
<p class="problem-detail"> n的阶乘定义为n!=1*2*3*……*n 如3!=6
n!通常最后会有很多0如5!=120 最后有一个0现在统计n!去除末尾的0后最后k位是多少</p>
</div>
<div class="problem-section">
<label class="problem-label">输入</label>
<p class="problem-detail">第一行包括两个数n,k</p>
</div>
<div class="problem-section">
<label class="problem-label">输出</label>
<p class="problem-detail">第一行包括两个数n,k</p>
</div>
<div class="problem-section">
<label class="problem-label">输出</label>
<p class="problem-detail">第一行包括两个数n,k</p>
</div>
<div class="problem-section">
<label class="problem-label">样例输入</label>
<p class="problem-detail">第一行包括两个数n,k</p>
</div>
<div class="problem-section">
<label class="problem-label">样例输入1</label>
<pre title="双击可以复制哦~">
1 2 3 4 5 6 7
1 2 3 4 5 6 7</pre>
</div>
<div class="problem-section">
</div>
<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>
<label>选择语言</label>
<div>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" value="c" checked> c (gcc 4.8)
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" value="cpp"> c++ (g++ 4.3)
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" value="java"> Java (jre 1.7)
</label>
</div>
</div>
<div id="code-field">
<label class="problem-label">提交代码</label>
<textarea id="code-editor"></textarea>
</div>
<hr>
<div id="submit-code">
<button type="button" class="btn btn-primary" id="submit-code-button">
提交代码
</button>
<img src="/static/img/loading.gif" id="loading-gif">
<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>
<hr>
<div class="result">
<div class="alert alert-success" role="alert" id="a" style="opacity: 0">
<div class="alert-link">
Accepted!&nbsp;&nbsp;时间:378ms 内存: 35m&nbsp;&nbsp;
<a href="#">查看详情</a>
</div>
<div class="problem-section">
<label class="problem-label">样例输出2</label>
<pre>
1 2 3 4 5 6 7</pre>
</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>
<label>选择语言</label>
<div>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" value="c" checked> c (gcc 4.8)
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" value="cpp"> c++ (g++ 4.3)
</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" value="java"> Java (jre 1.7)
</label>
</div>
</div>
<div class="alert alert-danger" role="alert">
<div class="alert-link">Wrong Answer!</div>
<div id="code-field">
<label class="problem-label">提交代码</label>
<textarea id="code-editor"></textarea>
</div>
<div class="alert alert-danger" role="alert">
<div class="alert-link">Compile Error!</div>
<hr>
<div id="submit-code">
<button type="button" class="btn btn-primary" id="submit-code-button">
提交代码
</button>
<img src="/static/img/loading.gif" id="loading-gif">
</div>
<div class="alert alert-warning" role="alert">
<div class="alert-link">Error Format!</div>
<hr>
<div class="result">
<div class="alert alert-success" role="alert" id="a" style="opacity: 0">
<div class="alert-link">
Accepted!&nbsp;&nbsp;时间:378ms 内存: 35m&nbsp;&nbsp;
<a href="#">查看详情</a>
</div>
</div>
<div class="alert alert-danger" role="alert">
<div class="alert-link">Wrong Answer!</div>
</div>
<div class="alert alert-danger" role="alert">
<div class="alert-link">Compile Error!</div>
</div>
<div class="alert alert-warning" role="alert">
<div class="alert-link">Error Format!</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% 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 %}