Browse Source

feat: 提交比赛界面修改,增加序号链接。

pull/16/head
zjz1993 5 years ago
parent
commit
d3f371330d
  1. 4
      libs/submissions_process.js
  2. 3
      modules/contest.js
  3. 2
      views/submissions.ejs
  4. 4
      views/submissions_item.ejs

4
libs/submissions_process.js

@ -77,7 +77,7 @@ const processOverallResult = (source, config) => {
} }
return { return {
compile: source.compile, compile: source.compile,
judge: config.showDetailResult ? (source.judge && { judge: {
subtasks: source.judge.subtasks && source.judge.subtasks.map(st => ({ subtasks: source.judge.subtasks && source.judge.subtasks.map(st => ({
score: st.score, score: st.score,
cases: st.cases.map(cs => ({ cases: st.cases.map(cs => ({
@ -97,7 +97,7 @@ const processOverallResult = (source, config) => {
} }
})) }))
})) }))
}) : null }
}; };
} }

3
modules/contest.js

@ -457,7 +457,8 @@ app.get('/contest/submission/:id', async (req, res) => {
const problems_id = await contest.getProblems(); const problems_id = await contest.getProblems();
judge.problem_id = problems_id.indexOf(judge.problem_id) + 1; judge.problem_id = problems_id.indexOf(judge.problem_id) + 1;
judge.problem.title = syzoj.utils.removeTitleTag(judge.problem.title); judge.problem.title = syzoj.utils.removeTitleTag(judge.problem.title);
displayConfig.showUsage = true;
displayConfig.showDetailResult=true;
if (judge.problem.type !== 'submit-answer') { if (judge.problem.type !== 'submit-answer') {
judge.codeLength = Buffer.from(judge.code).length; judge.codeLength = Buffer.from(judge.code).length;
judge.code = await syzoj.utils.highlight(judge.code, syzoj.languages[judge.language].highlight); judge.code = await syzoj.utils.highlight(judge.code, syzoj.languages[judge.language].highlight);

2
views/submissions.ejs

@ -15,7 +15,7 @@
<% if (displayConfig.showOthers) { %> <% if (displayConfig.showOthers) { %>
<p>您可以看到其他人的提交。 <p>您可以看到其他人的提交。
<% } else { %> <% } else { %>
<p>您只能看到自己的提交。</p> <p>您只能看到自己的提交。 <a style="float:right" href="<%= syzoj.utils.makeUrl(['contest', contest.id]) %>">返回本次比赛</a></p>
<% } %> <% } %>
</div> </div>
<% } %> <% } %>

4
views/submissions_item.ejs

@ -72,11 +72,7 @@
<script id="submissionItemTemplate" type="text/x-template"> <script id="submissionItemTemplate" type="text/x-template">
<tr> <tr>
<td><i class="icon" :class="data.info.is_share ? 'smile outline success': 'meh outline'" style="font-size: 1.5em"></i></td> <td><i class="icon" :class="data.info.is_share ? 'smile outline success': 'meh outline'" style="font-size: 1.5em"></i></td>
<% if (active === 'submissions') { %>
<td><a :href="submissionLink"><b>#{{ data.info.submissionId }}</b></a></td> <td><a :href="submissionLink"><b>#{{ data.info.submissionId }}</b></a></td>
<% } else { %>
<td><b>#{{ data.info.submissionId }}</b></td>
<% } %>
<td ref="problemLabel"><a ref="problemLabelTextFit" <td ref="problemLabel"><a ref="problemLabelTextFit"
style="width: 230px; height: 22px; display: block; margin: 0 auto; line-height: 22px;" style="width: 230px; height: 22px; display: block; margin: 0 auto; line-height: 22px;"
:href="problemLink"><b>#{{ config.inContest ? alpha(data.info.problemId) : :href="problemLink"><b>#{{ config.inContest ? alpha(data.info.problemId) :

Loading…
Cancel
Save