From 80157dac413b7c06f0b3ed7f014c1424d434d83b Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Wed, 24 Jul 2019 18:18:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8=E6=B5=8B=E8=AF=84=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=87=8C=E5=8A=A0=E5=85=A5=E6=98=AF=E5=90=A6=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E7=9A=84=E5=88=97=E5=92=8C=E7=AD=9B=E9=80=89=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/submissions_process.js | 29 ++++++++------- modules/submission.js | 5 +++ views/submissions.ejs | 72 +++++++++++++++++++++++++------------ views/submissions_item.ejs | 1 + 4 files changed, 72 insertions(+), 35 deletions(-) diff --git a/libs/submissions_process.js b/libs/submissions_process.js index e3d56c3..6203d1e 100644 --- a/libs/submissions_process.js +++ b/libs/submissions_process.js @@ -1,19 +1,22 @@ const {getCachedJudgeState} = require('./judger'); const _ = require('lodash'); -const getSubmissionInfo = (s, displayConfig) => ({ - submissionId: s.id, - taskId: s.task_id, - user: s.user.username, - userId: s.user_id, - problemName: s.problem.title, - problemId: s.problem_id, - language: displayConfig.showCode ? ((s.language != null && s.language !== '') ? syzoj.languages[s.language].show : null) : null, - codeSize: displayConfig.showCode ? s.code_length : null, - submitTime: syzoj.utils.formatDate(s.submit_time), - isPractice: s.is_practice, - c_id: s.c_id -}); +const getSubmissionInfo = (s, displayConfig) => { + return { + submissionId: s.id, + taskId: s.task_id, + user: s.user.username, + userId: s.user_id, + problemName: s.problem.title, + problemId: s.problem_id, + language: displayConfig.showCode ? ((s.language != null && s.language !== '') ? syzoj.languages[s.language].show : null) : null, + codeSize: displayConfig.showCode ? s.code_length : null, + submitTime: syzoj.utils.formatDate(s.submit_time), + isPractice: s.is_practice, + c_id: s.c_id, + is_share: s.is_share || false + } +}; const getRoughResult = (x, displayConfig, roughOnly) => { let max = 0; diff --git a/modules/submission.js b/modules/submission.js index 9cab27a..f916f5c 100644 --- a/modules/submission.js +++ b/modules/submission.js @@ -84,6 +84,11 @@ app.get('/submissions', async (req, res) => { query.andWhere('status = :status', { status: req.query.status }); isFiltered = true; } + + if (req.query.isshare) { + query.andWhere('is_share = :status', { status: req.query.isshare }); + } + if (!inContest && (!curUser || !await curUser.hasPrivilege('manage_problem'))) { if (req.query.problem_id) { diff --git a/views/submissions.ejs b/views/submissions.ejs index e58d22f..08fc7aa 100644 --- a/views/submissions.ejs +++ b/views/submissions.ejs @@ -1,6 +1,15 @@ <% this.title = '提交记录' %> <% include header %> <% include util %> +
<% if (displayConfig.inContest) { %> @@ -17,10 +26,10 @@
- +
<% if (displayConfig.showOthers) { %> - +
<% } %> <% if (displayConfig.showScore) { %> @@ -29,7 +38,7 @@
<% } %> - +
<% if (displayConfig.showResult) { %> - +
<% } %> - - <% if (user && displayConfig.showOthers) { %> - - - 我的提交 - - - <% } %> + +
+ +
+
+
+ + <% if (user && displayConfig.showOthers) { %> + + + 我的提交 + + + <% } %>
+ @@ -133,11 +158,14 @@ $(function () { $('#select_language').dropdown(); $('#select_status').dropdown(); + $('#select_share').dropdown(); }); const itemList = <%- serializejs(items) %>; const socketUrl = "/rough"; const displayConfig = <%- serializejs(displayConfig) %>; +console.log(itemList); + const vueApp = new Vue({ el: '#vueAppFuckSafari', data: { diff --git a/views/submissions_item.ejs b/views/submissions_item.ejs index 4ed15a0..5c8c2fe 100644 --- a/views/submissions_item.ejs +++ b/views/submissions_item.ejs @@ -66,6 +66,7 @@
是否已经分享 编号 题目 状态