完善提交页面、提交列表和对应的后台逻辑
This commit is contained in:
7
template/oj/problem/_problem_header.html
Normal file
7
template/oj/problem/_problem_header.html
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
<h2 class="text-center">{{ problem.title }}</h2>
|
||||
|
||||
<p class="text-muted text-center">发布时间 : {{ problem.create_time }}
|
||||
时间限制 : {{ problem.time_limit }}ms
|
||||
内存限制 : {{ problem.memory_limit }}M
|
||||
</p>
|
||||
57
template/oj/problem/my_submission.html
Normal file
57
template/oj/problem/my_submission.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{% extends 'oj_base.html' %}
|
||||
{% block css_block %}
|
||||
<style>
|
||||
.CodeMirror{
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
{% load submission %}
|
||||
<div class="container main">
|
||||
<ul class="nav nav-tabs nav-tabs-google">
|
||||
<li role="presentation">
|
||||
<a href="/problem/{{ problem.id }}/">题目</a></li>
|
||||
<li role="presentation" class="active"><a href="/problem/{{ problem.id }}/my_submissions/">我的提交</a></li>
|
||||
</ul>
|
||||
{% include "oj/problem/_problem_header.html" %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h4>运行结果 : <span class="text-{{ submission.result|translate_result_class }}">
|
||||
{{ submission.result|translate_result }}
|
||||
</span>
|
||||
</h4>
|
||||
{% ifequal submission.result 0 %}
|
||||
<p>时间 : {{ submission.accepted_answer_info.time }}ms 语言 :
|
||||
{{ submission.language|translate_language }}
|
||||
</p>
|
||||
{% endifequal %}
|
||||
{% ifequal submission.result 4 %}
|
||||
<p>{{ submission.info }}</p>
|
||||
{% endifequal %}
|
||||
<p>提交时间 : {{ submission.create_time }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="code-field">
|
||||
<textarea id="code-editor">{{ submission.code }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% block js_block %}
|
||||
<script>
|
||||
require(["jquery", "code_mirror"], function ($, code_mirror) {
|
||||
{% ifequal submission.language 1 %}
|
||||
var language = "text/x-csrc";
|
||||
{% else %}
|
||||
{% ifequal submission.language 2 %}
|
||||
var language = "text/x-c++src";
|
||||
{% else %}
|
||||
var language = "text/x-java";
|
||||
{% endifequal %}
|
||||
{% endifequal %}
|
||||
var code_editor = code_mirror($("#code-editor")[0], language);
|
||||
code_editor.setOption("readOnly", true);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -3,62 +3,48 @@
|
||||
{% block body %}
|
||||
|
||||
{% load submission %}
|
||||
<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>
|
||||
<div class="container main">
|
||||
<ul class="nav nav-tabs nav-tabs-google">
|
||||
<li role="presentation">
|
||||
<a href="/problem/{{ problem.id }}/">题目</a></li>
|
||||
<li role="presentation" class="active">
|
||||
<a href="/problem/{{ problem.id }}/my_submissions/">我的提交</a></li>
|
||||
</ul>
|
||||
<h2 class="text-center">{{ problem.title }}</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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in submissions %}
|
||||
{% ifequal item.result 0 %}
|
||||
<tr class="success">
|
||||
{% else %}
|
||||
{% ifequal item.result 8 %}
|
||||
<tr class="info">
|
||||
<p class="text-muted text-center">发布时间: {{ problem.create_time }}
|
||||
时间限制: {{ problem.time_limit }}ms
|
||||
内存限制: {{ problem.memory_limit }}M</p>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr class="" success>
|
||||
<th>#</th>
|
||||
<th>提交时间</th>
|
||||
<th>结果</th>
|
||||
<th>运行时间</th>
|
||||
<th>语言</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in submissions %}
|
||||
<tr class="{{ item.result|translate_result_class }}">
|
||||
<th scope="row"><a href="/my_submission/{{ item|translate_id }}/">{{ forloop.counter }}</a></th>
|
||||
<td>{{ item.create_time }}</td>
|
||||
<td>{{ item.result|translate_result }}</td>
|
||||
<td>
|
||||
{% if item.accepted_answer_info.time %}
|
||||
{{ item.accepted_answer_info.time }}ms
|
||||
{% else %}
|
||||
<tr class="danger">
|
||||
{% endifequal %}
|
||||
--
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ item.language|translate_language }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
{% endifequal %}
|
||||
<th scope="row"><a href="/my_solution/{{ item|translate_id }}/">{{ forloop.counter }}</a></th>
|
||||
<td>{{ item.create_time }}</td>
|
||||
<td>{{ item.result|translate_result }}</td>
|
||||
<td>
|
||||
{% if item.accepted_answer_info.time %}
|
||||
{{ item.accepted_answer_info.time }}ms
|
||||
{% else %}
|
||||
--
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% ifequal item.language 1 %}
|
||||
C
|
||||
{% else %}
|
||||
{% ifequal item.language 2 %}
|
||||
C++
|
||||
{% else %}
|
||||
Java
|
||||
{% endifequal %}
|
||||
{% endifequal %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -5,12 +5,9 @@
|
||||
<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>
|
||||
<li role="presentation"><a href="/problem/{{ problem.id }}/my_submissions/">我的提交</a></li>
|
||||
</ul>
|
||||
<h2 class="text-center">{{ problem.title }}</h2>
|
||||
|
||||
<p class="text-muted text-center">发布时间: {{ problem.create_time }} CPU: {{ problem.time_limit }}ms
|
||||
内存: {{ problem.memory_limit }}M</p>
|
||||
{% include "oj/problem/_problem_header.html" %}
|
||||
|
||||
<div>
|
||||
<div class="problem-section">
|
||||
@@ -93,7 +90,7 @@
|
||||
|
||||
<div id="result">
|
||||
</div>
|
||||
<hr>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user