禁用比赛看到除自己的提交外其它提交的时间、空间、长度

This commit is contained in:
Himit_ZH 2021-09-16 22:55:33 +08:00
parent 2c99dd72ea
commit 6c4ffdfad4
3 changed files with 23 additions and 4 deletions

View File

@ -414,10 +414,22 @@ public class ContestController {
IPage<JudgeVo> commonJudgeList = judgeService.getContestJudgeList(limit, currentPage, displayId, searchCid,
searchStatus, searchUsername, uid, beforeContestSubmit, rule, contest.getStartTime(), sealRankTime, userRolesVo.getUid());
if (commonJudgeList.getTotal() == 0) { // 未查询到一条数据
return CommonResult.successResponse(null, "暂无数据");
} else {
// 比赛还是进行阶段同时不是超级管理员与比赛管理员需要将除自己之外的提交的时间空间长度隐藏
if (contest.getStatus().intValue() == Constants.Contest.STATUS_RUNNING.getCode()
&& !isRoot && !userRolesVo.getUid().equals(contest.getUid())) {
commonJudgeList.getRecords().forEach(judgeVo -> {
if (!judgeVo.getUid().equals(userRolesVo.getUid())) {
judgeVo.setTime(null);
judgeVo.setMemory(null);
judgeVo.setLength(null);
}
});
}
return CommonResult.successResponse(commonJudgeList, "获取成功");
}
}

View File

@ -348,9 +348,15 @@ public class JudgeController {
result.put("submission", new Judge().setStatus(Constants.Judge.STATUS_SUBMITTED_UNKNOWN_RESULT.getStatus()));
return CommonResult.successResponse(result, "获取提交数据成功!");
}
// 不是本人的话不能查看代码
if(!userRolesVo.getUid().equals(judge.getUid())) {
// 不是本人的话不能查看代码时间空间长度
if (!userRolesVo.getUid().equals(judge.getUid())) {
judge.setCode(null);
// 如果还在比赛时间不是本人不能查看时间空间长度
if (contest.getStatus().intValue() == Constants.Contest.STATUS_RUNNING.getCode()) {
judge.setTime(null);
judge.setMemory(null);
judge.setLength(null);
}
}
}
} else {
@ -457,6 +463,7 @@ public class JudgeController {
IPage<JudgeVo> commonJudgeList = judgeService.getCommonJudgeList(limit, currentPage, searchPid,
searchStatus, searchUsername, uid);
if (commonJudgeList.getTotal() == 0) { // 未查询到一条数据
return CommonResult.successResponse(null, "暂无数据");
} else {

View File

@ -215,7 +215,7 @@
</vxe-table-column>
<vxe-table-column field="time" :title="$t('m.Time')" min-width="96">
<template v-slot="{ row }">
<span>{{ submissionTimeFormat(row.time) }}</span>
<span v-if="!contestID">{{ submissionTimeFormat(row.time) }}</span>
</template>
</vxe-table-column>
<vxe-table-column