大更新,完善补充前端页面,修正判题等待超时时间,修补一系列bug
This commit is contained in:
parent
59214d61b9
commit
86777c86f2
|
@ -65,6 +65,7 @@ Password: 开启SMTP服务后生成的随机授权码
|
|||
| 2021-05-22 | 更新docker-compose一键部署,修正部分bug | Himit_ZH |
|
||||
| 2021-05-24 | 判题调度乐观锁改为悲观锁 | Himit_ZH |
|
||||
| 2021-05-28 | 增加导入导出题目,增加用户页面的最近登录,开发正式结束,进入维护摸鱼 | Himit_ZH |
|
||||
| 2021-06-02 | 大更新,完善补充前端页面,修正判题等待超时时间,修补一系列bug | Himit_ZH |
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public class RestTemplateConfig {
|
|||
@Bean
|
||||
public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setReadTimeout(30000);//单位为ms
|
||||
factory.setReadTimeout(100000);//单位为ms
|
||||
factory.setConnectTimeout(10000);//单位为ms
|
||||
return factory;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package top.hcode.hoj.controller.admin;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
@ -25,6 +26,7 @@ import top.hcode.hoj.utils.Constants;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.validation.Valid;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -108,6 +110,7 @@ public class AdminProblemController {
|
|||
problem的id为其他表的外键的表中的对应数据都会被一起删除!
|
||||
*/
|
||||
if (result) { // 删除成功
|
||||
FileUtil.del(Constants.File.TESTCASE_BASE_FOLDER.getPath() + File.separator + "problem_" + pid);
|
||||
return CommonResult.successResponse(null, "删除成功!");
|
||||
} else {
|
||||
return CommonResult.errorResponse("删除失败!", CommonResult.STATUS_FAIL);
|
||||
|
|
|
@ -388,7 +388,7 @@ public class FileController {
|
|||
.sheet("rank")
|
||||
.doWrite(fileService.changeACMContestRankToExcelRowList(acmContestRankVoList, contestProblemDisplayIDList));
|
||||
} else {
|
||||
List<ContestRecord> oiContestRecord = contestRecordService.getOIContestRecord(cid, isOpenSealRank, contest.getSealRankTime(), contest.getStartTime(), contest.getEndTime());
|
||||
List<ContestRecord> oiContestRecord = contestRecordService.getOIContestRecord(cid, contest.getAuthor(), isOpenSealRank, contest.getSealRankTime(), contest.getStartTime(), contest.getEndTime());
|
||||
Assert.notEmpty(oiContestRecord, "比赛暂无排行榜记录!");
|
||||
List<OIContestRankVo> oiContestRankVoList = contestRecordService.calcOIRank(oiContestRecord);
|
||||
EasyExcel.write(response.getOutputStream())
|
||||
|
|
|
@ -413,6 +413,8 @@ public class ContestController {
|
|||
// 如果已经开启了封榜模式
|
||||
.between(isOpenSealRank, "submit_time", contest.getStartTime(), contest.getSealRankTime())
|
||||
.between(!isOpenSealRank, "submit_time", contest.getStartTime(), contest.getEndTime())
|
||||
.ne("uid", "1")
|
||||
.ne("username", contest.getAuthor())
|
||||
.orderByAsc("time");
|
||||
|
||||
List<ContestRecord> contestRecordList = contestRecordService.list(wrapper);
|
||||
|
@ -422,7 +424,7 @@ public class ContestController {
|
|||
|
||||
} else { //OI比赛:以最后一次提交得分作为该题得分
|
||||
|
||||
resultList = contestRecordService.getContestOIRank(cid, isOpenSealRank, contest.getSealRankTime(), contest.getStartTime(),
|
||||
resultList = contestRecordService.getContestOIRank(cid, contest.getAuthor(), isOpenSealRank, contest.getSealRankTime(), contest.getStartTime(),
|
||||
contest.getEndTime(), currentPage, limit);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,19 +79,19 @@ public class ProblemController {
|
|||
if (limit == null || limit < 1) limit = 10;
|
||||
|
||||
// 关键词查询不为空
|
||||
Long pid = null;
|
||||
// Long pid = null;
|
||||
if (!StringUtils.isEmpty(keyword)) {
|
||||
keyword = keyword.trim();
|
||||
Pattern pattern = Pattern.compile("[0-9]*");
|
||||
Matcher isNum = pattern.matcher(keyword);
|
||||
if (isNum.matches()) { // 利用正则表达式判断keyword是否为纯数字
|
||||
pid = Long.valueOf(keyword);
|
||||
}
|
||||
// if (isNum.matches()) { // 利用正则表达式判断keyword是否为纯数字
|
||||
// pid = Long.valueOf(keyword);
|
||||
// }
|
||||
}
|
||||
if (oj!=null && !Constants.RemoteOJ.isRemoteOJ(oj)) {
|
||||
oj = "Mine";
|
||||
}
|
||||
Page<ProblemVo> problemList = problemService.getProblemList(limit, currentPage, pid, keyword,
|
||||
Page<ProblemVo> problemList = problemService.getProblemList(limit, currentPage, null, keyword,
|
||||
difficulty, tagId, oj);
|
||||
if (problemList.getTotal() == 0) { // 未查询到一条数据
|
||||
return CommonResult.successResponse(problemList, "暂无数据");
|
||||
|
|
|
@ -23,7 +23,8 @@ import java.util.List;
|
|||
public interface ContestRecordMapper extends BaseMapper<ContestRecord> {
|
||||
List<ContestRecord> getACInfo(IPage iPage, @Param("status") Integer status, @Param("cid") Long cid);
|
||||
|
||||
List<ContestRecord> getOIContestRecord(@Param("cid") Long cid, @Param("isOpenSealRank") Boolean isOpenSealRank,
|
||||
List<ContestRecord> getOIContestRecord(@Param("cid") Long cid, @Param("contestAuthor") String contestAuthor,
|
||||
@Param("isOpenSealRank") Boolean isOpenSealRank,
|
||||
@Param("sealTime") Date sealTime, @Param("startTime") Date startTime,
|
||||
@Param("endTime") Date endTime);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,10 @@
|
|||
SELECT cr.* FROM
|
||||
(SELECT uid,pid,cpid,MAX(time) AS time FROM contest_record
|
||||
<where>
|
||||
cid=#{cid} AND status IS NOT NULL
|
||||
cid=#{cid} AND status IS NOT NULL AND uid!='1'
|
||||
<if test="contestAuthor!=null">
|
||||
AND username!=#{contestAuthor}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="isOpenSealRank">
|
||||
AND submit_time BETWEEN #{startTime} AND #{sealTime}
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="top.hcode.hoj.dao.JudgeMapper">
|
||||
<select id="getCommonJudgeList" resultType="top.hcode.hoj.pojo.vo.JudgeVo" useCache="false">
|
||||
select j.uid,j.submit_id,j.submit_time,j.uid,j.username,j.uid,j.pid,j.display_pid,j.status,j.share,
|
||||
j.time,j.memory,j.length,j.language,j.cid,j.cpid,j.judger
|
||||
from judge j
|
||||
select j.uid,j.submit_id,j.submit_time,j.uid,j.username,j.uid,j.pid,j.status,j.share,
|
||||
j.time,j.memory,j.length,j.language,j.cid,j.cpid,j.judger,p.problem_id as display_pid,p.title
|
||||
from judge j,problem p
|
||||
<where>
|
||||
j.cid = 0 AND j.cpid = 0
|
||||
p.id = j.pid AND j.cid = 0 AND j.cpid = 0
|
||||
<if test="searchPid!=null">
|
||||
AND j.display_pid like concat('%',#{searchPid},'%')
|
||||
AND p.problem_id like concat('%',#{searchPid},'%')
|
||||
</if>
|
||||
<if test="username!='' and username!=null">
|
||||
AND j.username like concat('%',#{username},'%')
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
|
||||
<select id="getContestJudgeList" resultType="top.hcode.hoj.pojo.vo.JudgeVo" useCache="false">
|
||||
select j.uid,j.submit_id,j.submit_time,j.uid,j.username,j.uid,cp.display_id,
|
||||
select j.uid,j.submit_id,j.submit_time,j.uid,j.username,j.uid,cp.display_id,cp.display_title as title,
|
||||
j.status,j.share,j.time,j.memory,j.length,j.language,j.cid,j.cpid,j.judger
|
||||
from judge j,contest_problem cp
|
||||
<where>
|
||||
|
|
|
@ -16,6 +16,7 @@ import top.hcode.hoj.service.impl.RemoteJudgeAccountServiceImpl;
|
|||
import top.hcode.hoj.utils.Constants;
|
||||
|
||||
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -84,7 +85,7 @@ public class Dispatcher {
|
|||
}
|
||||
}
|
||||
|
||||
if (count.get() == 30) { // 30次失败则判为提交失败
|
||||
if (count.get() == 90) { // 90次失败则判为提交失败
|
||||
if (isRemote) { // 远程判题需要将账号归为可用
|
||||
UpdateWrapper<RemoteJudgeAccount> remoteJudgeAccountUpdateWrapper = new UpdateWrapper<>();
|
||||
remoteJudgeAccountUpdateWrapper
|
||||
|
@ -98,7 +99,7 @@ public class Dispatcher {
|
|||
}
|
||||
}
|
||||
};
|
||||
scheduler.scheduleAtFixedRate(getResultTask, 0, 1, TimeUnit.SECONDS);
|
||||
scheduler.scheduleAtFixedRate(getResultTask, 0, 2, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,7 +131,6 @@ public class Dispatcher {
|
|||
} else {
|
||||
if (result.getStatus().intValue() != CommonResult.STATUS_SUCCESS) { // 如果是结果码不是200 说明调用有错误
|
||||
// 判为系统错误
|
||||
System.out.println("进来了");
|
||||
judge.setStatus(Constants.Judge.STATUS_SYSTEM_ERROR.getStatus())
|
||||
.setErrorMessage(result.getMsg());
|
||||
judgeService.updateById(judge);
|
||||
|
|
|
@ -33,6 +33,9 @@ public class JudgeVo {
|
|||
@ApiModelProperty(value = "题目展示id")
|
||||
private String displayPid;
|
||||
|
||||
@ApiModelProperty(value = "题目标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "比赛display_id")
|
||||
private String displayId;
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ public interface ContestRecordService extends IService<ContestRecord> {
|
|||
|
||||
IPage<ACMContestRankVo> getContestACMRank(List<ContestRecord> contestRecordList, int currentPage, int limit);
|
||||
|
||||
IPage<OIContestRankVo> getContestOIRank(Long cid, Boolean isOpenSealRank, Date sealTime, Date startTime, Date endTime, int currentPage, int limit);
|
||||
IPage<OIContestRankVo> getContestOIRank(Long cid, String contestAuthor, Boolean isOpenSealRank, Date sealTime, Date startTime, Date endTime, int currentPage, int limit);
|
||||
|
||||
List<ContestRecord> getOIContestRecord(Long cid, Boolean isOpenSealRank, Date sealTime, Date startTime, Date endTime);
|
||||
List<ContestRecord> getOIContestRecord(Long cid, String contestAuthor, Boolean isOpenSealRank, Date sealTime, Date startTime, Date endTime);
|
||||
|
||||
}
|
||||
|
|
|
@ -64,10 +64,10 @@ public class ContestRecordServiceImpl extends ServiceImpl<ContestRecordMapper, C
|
|||
|
||||
|
||||
@Override
|
||||
public IPage<OIContestRankVo> getContestOIRank(Long cid, Boolean isOpenSealRank, Date sealTime, Date startTime, Date endTime, int currentPage, int limit) {
|
||||
public IPage<OIContestRankVo> getContestOIRank(Long cid, String contestAuthor, Boolean isOpenSealRank, Date sealTime, Date startTime, Date endTime, int currentPage, int limit) {
|
||||
|
||||
// 获取每个用户每道题最近一次提交
|
||||
List<ContestRecord> oiContestRecord = contestRecordMapper.getOIContestRecord(cid, isOpenSealRank, sealTime, startTime, endTime);
|
||||
List<ContestRecord> oiContestRecord = contestRecordMapper.getOIContestRecord(cid, contestAuthor, isOpenSealRank, sealTime, startTime, endTime);
|
||||
|
||||
// 计算排名
|
||||
List<OIContestRankVo> orderResultList = calcOIRank(oiContestRecord);
|
||||
|
@ -92,8 +92,8 @@ public class ContestRecordServiceImpl extends ServiceImpl<ContestRecordMapper, C
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ContestRecord> getOIContestRecord(Long cid, Boolean isOpenSealRank, Date sealTime, Date startTime, Date endTime) {
|
||||
return contestRecordMapper.getOIContestRecord(cid, isOpenSealRank, sealTime, startTime, endTime);
|
||||
public List<ContestRecord> getOIContestRecord(Long cid, String contestAuthor, Boolean isOpenSealRank, Date sealTime, Date startTime, Date endTime) {
|
||||
return contestRecordMapper.getOIContestRecord(cid, contestAuthor, isOpenSealRank, sealTime, startTime, endTime);
|
||||
}
|
||||
|
||||
public List<ACMContestRankVo> calcACMRank(List<ContestRecord> contestRecordList) {
|
||||
|
@ -180,7 +180,7 @@ public class ContestRecordServiceImpl extends ServiceImpl<ContestRecordMapper, C
|
|||
oiContestRankVo = new OIContestRankVo();
|
||||
oiContestRankVo.setRealname(contestRecord.getRealname())
|
||||
.setUid(contestRecord.getUid())
|
||||
.setRealname(contestRecord.getRealname())
|
||||
.setUsername(contestRecord.getUsername())
|
||||
.setTotalScore(0);
|
||||
|
||||
|
||||
|
|
|
@ -454,7 +454,7 @@ public class ProblemServiceImpl extends ServiceImpl<ProblemMapper, Problem> impl
|
|||
jsonObject.set("outputName", problemCase.getOutput());
|
||||
// 读取输出文件
|
||||
FileReader readFile = new FileReader(testCasesDir + "/" + problemCase.getOutput(), CharsetUtil.UTF_8);
|
||||
String output = readFile.readString();
|
||||
String output = readFile.readString().replaceAll("\r\n","\n");
|
||||
|
||||
// spj是根据特判程序输出判断结果,所以无需初始化测试数据
|
||||
if (!isSpj) {
|
||||
|
@ -505,7 +505,7 @@ public class ProblemServiceImpl extends ServiceImpl<ProblemMapper, Problem> impl
|
|||
String outputName = (index + 1) + ".out";
|
||||
jsonObject.set("outputName", outputName);
|
||||
// 生成对应文件
|
||||
String outputData = problemCaseList.get(index).getOutput();
|
||||
String outputData = problemCaseList.get(index).getOutput().replaceAll("\r\n","\n");
|
||||
FileWriter outFile = new FileWriter(testCasesDir + "/" + outputName, CharsetUtil.UTF_8);
|
||||
outFile.write(outputData);
|
||||
|
||||
|
@ -625,6 +625,8 @@ public class ProblemServiceImpl extends ServiceImpl<ProblemMapper, Problem> impl
|
|||
problem.setCaseVersion(null)
|
||||
.setGmtCreate(null)
|
||||
.setId(null)
|
||||
.setAuth(1)
|
||||
.setAuthor(null)
|
||||
.setGmtModified(null);
|
||||
HashMap<String, Object> problemMap = new HashMap<>();
|
||||
BeanUtil.beanToMap(problem, problemMap, false, true);
|
||||
|
@ -658,7 +660,7 @@ public class ProblemServiceImpl extends ServiceImpl<ProblemMapper, Problem> impl
|
|||
return importProblemVo;
|
||||
}
|
||||
|
||||
// 去除所有的空格换行等空白符
|
||||
// 去除末尾的空白符
|
||||
public static String rtrim(String value) {
|
||||
if (value == null) return null;
|
||||
return value.replaceAll("\\s+$", "");
|
||||
|
|
|
@ -68,7 +68,7 @@ public class JudgeController {
|
|||
|
||||
HashMap<String, Object> res = new HashMap<>();
|
||||
|
||||
res.put("version", "1.2.0");
|
||||
res.put("version", "1.3.0");
|
||||
res.put("currentTime", new Date());
|
||||
res.put("judgeServerName", name);
|
||||
res.put("cpu", Runtime.getRuntime().availableProcessors());
|
||||
|
|
|
@ -80,8 +80,8 @@ public class JudgeRun {
|
|||
List<FutureTask<JSONObject>> futureTasks = new ArrayList<>();
|
||||
JSONArray testcaseList = (JSONArray) testCasesInfo.get("testCases");
|
||||
Boolean isSpj = testCasesInfo.getBool("isSpj");
|
||||
// 默认给1.5倍题目限制时间用来测评
|
||||
Double time = maxTime * 1.5;
|
||||
// 默认给1.1倍题目限制时间用来测评
|
||||
Double time = maxTime * 1.1;
|
||||
final Long testTime = time.longValue();
|
||||
|
||||
// 用户输出的文件夹
|
||||
|
@ -105,7 +105,7 @@ public class JudgeRun {
|
|||
testCaseId,
|
||||
runDir,
|
||||
testCaseInputPath,
|
||||
testTime,// 默认给1.5倍题目限制时间用来测评
|
||||
testTime,// 默认给1.1倍题目限制时间用来测评
|
||||
maxMemory,
|
||||
maxOutputSize,
|
||||
getUserOutput,
|
||||
|
@ -125,7 +125,7 @@ public class JudgeRun {
|
|||
runDir,
|
||||
testCaseInputPath,
|
||||
testCaseOutputPath,
|
||||
testTime,// 默认给1.5倍题目限制时间用来测评
|
||||
testTime,// 默认给1.1倍题目限制时间用来测评
|
||||
maxMemory,
|
||||
maxOutputSize,
|
||||
runConfig.getExeName(),
|
||||
|
@ -390,7 +390,7 @@ public class JudgeRun {
|
|||
}
|
||||
}
|
||||
|
||||
// 去除所有的空格换行等空白符
|
||||
// 去除末尾空白符
|
||||
public static String rtrim(String value) {
|
||||
if (value == null) return null;
|
||||
return value.replaceAll("\\s+$", "");
|
||||
|
|
|
@ -129,7 +129,7 @@ public class ProblemTestCaseUtils {
|
|||
}
|
||||
}
|
||||
|
||||
// 去除所有的空格换行等空白符
|
||||
// 去除末尾的空白符
|
||||
public static String rtrim(String value) {
|
||||
if (value == null) return null;
|
||||
return value.replaceAll("\\s+$", "");
|
||||
|
|
|
@ -4,7 +4,6 @@ package top.hcode.hoj.service.impl;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -13,7 +12,6 @@ import top.hcode.hoj.common.exception.SystemError;
|
|||
import top.hcode.hoj.dao.JudgeMapper;
|
||||
import top.hcode.hoj.judge.*;
|
||||
import top.hcode.hoj.judge.Compiler;
|
||||
import top.hcode.hoj.pojo.entity.Contest;
|
||||
import top.hcode.hoj.pojo.entity.Judge;
|
||||
import top.hcode.hoj.pojo.entity.Problem;
|
||||
import top.hcode.hoj.pojo.entity.UserAcproblem;
|
||||
|
@ -114,4 +112,5 @@ public class JudgeServiceImpl extends ServiceImpl<JudgeMapper, Judge> implements
|
|||
contestRecordService.UpdateContestRecord(uid, score, status, submitId, cid);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -369,15 +369,19 @@ export default {
|
|||
},
|
||||
handleRoute(route) {
|
||||
//电脑端导航栏路由跳转事件
|
||||
if (route) {
|
||||
if (route && route.split('/')[1] != 'admin') {
|
||||
this.$router.push(route);
|
||||
} else {
|
||||
window.open('/admin/');
|
||||
}
|
||||
},
|
||||
handleCommand(route) {
|
||||
// 移动端导航栏路由跳转事件
|
||||
this.openusermenu = false;
|
||||
if (route) {
|
||||
if (route && route.split('/')[1] != 'admin') {
|
||||
this.$router.push(route);
|
||||
} else {
|
||||
window.open('/admin/');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -180,7 +180,7 @@ export default {
|
|||
endTime: '',
|
||||
duration: 0,
|
||||
type: 0,
|
||||
password: '',
|
||||
pwd: '',
|
||||
sealRank: true,
|
||||
sealRankTime: '', //封榜时间
|
||||
auth: 0,
|
||||
|
@ -254,6 +254,31 @@ export default {
|
|||
},
|
||||
|
||||
saveContest() {
|
||||
if (!this.contest.title) {
|
||||
myMessage.error('比赛的标题不能为空!');
|
||||
return;
|
||||
}
|
||||
if (!this.contest.description) {
|
||||
myMessage.error('比赛的描述不能为空!');
|
||||
return;
|
||||
}
|
||||
if (!this.contest.startTime) {
|
||||
myMessage.error('比赛的开始时间不能为空!');
|
||||
return;
|
||||
}
|
||||
if (!this.contest.endTime) {
|
||||
myMessage.error('比赛的结束时间不能为空!');
|
||||
return;
|
||||
}
|
||||
if (!this.contest.duration || this.contest.duration <= 0) {
|
||||
myMessage.error('比赛的时长不能小于或等于0!');
|
||||
return;
|
||||
}
|
||||
if (this.contest.auth != 0 && !this.contest.pwd) {
|
||||
myMessage.error('当前的比赛模式密码不能为空!');
|
||||
return;
|
||||
}
|
||||
|
||||
let funcName =
|
||||
this.$route.name === 'admin-edit-contest'
|
||||
? 'admin_editContest'
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<el-row :gutter="20" v-if="contestID">
|
||||
<el-col :md="12" :xs="24">
|
||||
<el-form-item label="Display Title">
|
||||
<el-form-item label="Display Title" required>
|
||||
<el-input
|
||||
placeholder="Enter the display title of problem in contest"
|
||||
v-model="contestProblem.displayTitle"
|
||||
|
@ -44,7 +44,7 @@
|
|||
</el-col>
|
||||
|
||||
<el-col :md="12" :xs="24">
|
||||
<el-form-item label="Display ID">
|
||||
<el-form-item label="Display ID" required>
|
||||
<el-input
|
||||
placeholder="Enter the display ID of problem in contest"
|
||||
v-model="contestProblem.displayId"
|
||||
|
@ -996,6 +996,22 @@ export default {
|
|||
},
|
||||
|
||||
submit() {
|
||||
if (!this.problem.problemId) {
|
||||
myMessage.error('题目的展示ID不能为空!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.contestID) {
|
||||
if (!this.contestProblem.displayId) {
|
||||
myMessage.error('比赛题目的展示ID不能为空!');
|
||||
return;
|
||||
}
|
||||
if (!this.contestProblem.displayTitle) {
|
||||
myMessage.error('比赛题目的展示标题不能为空!');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.problem.examples.length) {
|
||||
myMessage.error('题面测试数据是不能为空!至少输入一项!');
|
||||
return;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
height="460px"
|
||||
:interval="interval"
|
||||
v-model="index"
|
||||
@change="changeContest"
|
||||
>
|
||||
<el-carousel-item v-for="(contest, index) in contests" :key="index">
|
||||
<div class="contest-info">
|
||||
|
@ -278,6 +279,9 @@ export default {
|
|||
}
|
||||
);
|
||||
},
|
||||
changeContest(newIndex) {
|
||||
this.index = newIndex;
|
||||
},
|
||||
goContest() {
|
||||
this.$router.push({
|
||||
name: 'ContestDetails',
|
||||
|
|
|
@ -88,7 +88,63 @@
|
|||
</vxe-table-column>
|
||||
</vxe-table>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="testCaseResult">
|
||||
<el-card style="margin-top: 13px;" shadow="hover">
|
||||
<div slot="header">
|
||||
<span class="panel-title home-title">测试点详情</span>
|
||||
</div>
|
||||
<el-row :gutter="10">
|
||||
<el-col
|
||||
:xs="24"
|
||||
:sm="8"
|
||||
:md="6"
|
||||
:lg="3"
|
||||
v-for="(item, index) in testCaseResult"
|
||||
:key="index"
|
||||
>
|
||||
<div
|
||||
class="test-detail-item"
|
||||
:style="getTestCaseResultColor(item.status)"
|
||||
v-if="item.status == JUDGE_STATUS_RESERVE.ac"
|
||||
>
|
||||
<span>Test #{{ index + 1 }}:</span>
|
||||
<h2>{{ JUDGE_STATUS[item.status]['short'] }}</h2>
|
||||
<div style="text-align:center;">
|
||||
{{ item.time }}ms/{{ item.memory }}KB
|
||||
</div>
|
||||
<div class="test-run-static">
|
||||
<span v-if="item.score != null">
|
||||
{{ item.score }}分 <i class="el-icon-success"></i>
|
||||
</span>
|
||||
<span v-else>
|
||||
<i class="el-icon-success"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="test-detail-item"
|
||||
:style="getTestCaseResultColor(item.status)"
|
||||
v-else
|
||||
>
|
||||
<span>Test #{{ index + 1 }}: </span>
|
||||
<h2>{{ JUDGE_STATUS[item.status]['short'] }}</h2>
|
||||
<div style="text-align:center;">
|
||||
{{ item.time }}ms/{{ item.memory }}KB
|
||||
</div>
|
||||
<div class="test-run-static">
|
||||
<span v-if="item.score != null">
|
||||
{{ item.score }}分 <i class="el-icon-error"></i>
|
||||
</span>
|
||||
<span v-else>
|
||||
<i class="el-icon-error"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="24" style="margin-top: 13px;">
|
||||
<Highlight
|
||||
:code="submission.code"
|
||||
|
@ -128,53 +184,6 @@
|
|||
</template>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" v-if="testCaseResult">
|
||||
<el-card style="margin-top: 20px;">
|
||||
<div slot="header">
|
||||
<span class="panel-title home-title">测试点详情</span>
|
||||
</div>
|
||||
<el-row :gutter="10">
|
||||
<el-col
|
||||
:xs="24"
|
||||
:md="12"
|
||||
:lg="6"
|
||||
v-for="(item, index) in testCaseResult"
|
||||
:key="index"
|
||||
>
|
||||
<div
|
||||
class="test-detail-item"
|
||||
:style="getTestCaseResultColor(item.status)"
|
||||
v-if="item.status == JUDGE_STATUS_RESERVE.ac"
|
||||
>
|
||||
<span>Test #{{ index + 1 }}:</span
|
||||
><span>{{ item.time }}ms/{{ item.memory }}KB</span>
|
||||
<span class="test-run-static" v-if="item.score != null">
|
||||
{{ item.score }}分 <i class="el-icon-success"></i>
|
||||
</span>
|
||||
<span class="test-run-static" v-else>
|
||||
<i class="el-icon-success"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="test-detail-item"
|
||||
:style="getTestCaseResultColor(item.status)"
|
||||
v-else
|
||||
>
|
||||
<span>Test #{{ index + 1 }}:</span
|
||||
><span>{{ item.time }}ms/{{ item.memory }}KB</span>
|
||||
<span class="test-run-static" v-if="item.score != null">
|
||||
{{ item.score }}分 <i class="el-icon-error"></i>
|
||||
</span>
|
||||
<span class="test-run-static" v-else>
|
||||
<i class="el-icon-error"></i>
|
||||
</span>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
|
@ -404,10 +413,14 @@ export default {
|
|||
.el-row--flex {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.el-col {
|
||||
padding-left: 5px !important;
|
||||
padding-right: 5px !important;
|
||||
}
|
||||
|
||||
.test-detail-item {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
padding: 5px;
|
||||
font-size: 14px;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
|
@ -417,11 +430,17 @@ export default {
|
|||
color: #ff431e;
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
.test-detail-item h2 {
|
||||
font-weight: bolder;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 0;
|
||||
}
|
||||
.test-detail-item > span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.test-run-static {
|
||||
float: right;
|
||||
text-align: center;
|
||||
}
|
||||
.test-detail-item.done {
|
||||
border-color: #25bb9b;
|
||||
|
|
|
@ -104,19 +104,19 @@
|
|||
title="Run ID"
|
||||
min-width="100"
|
||||
></vxe-table-column>
|
||||
<vxe-table-column field="pid" title="Problem ID" min-width="100">
|
||||
<vxe-table-column field="pid" title="Problem" min-width="150">
|
||||
<template v-slot="{ row }">
|
||||
<span
|
||||
v-if="contestID"
|
||||
@click="getProblemUri(row.displayId, true)"
|
||||
style="color: rgb(87, 163, 243)"
|
||||
>{{ row.displayId }}
|
||||
>{{ row.displayId + ' ' + row.title }}
|
||||
</span>
|
||||
<span
|
||||
v-else
|
||||
@click="getProblemUri(row.displayPid, false)"
|
||||
style="color: rgb(87, 163, 243)"
|
||||
>{{ row.displayPid }}
|
||||
>{{ row.displayPid + ' ' + row.title }}
|
||||
</span>
|
||||
</template>
|
||||
</vxe-table-column>
|
||||
|
@ -448,10 +448,10 @@ export default {
|
|||
delete this.needCheckSubmitIds[key];
|
||||
}
|
||||
}
|
||||
// 当前提交列表的提交都判题结束或者检查结果60s(2s*30)还没判题结束,为了避免无用请求加重服务器负担,直接停止检查的请求。
|
||||
// 当前提交列表的提交都判题结束或者检查结果180s(2s*90)还没判题结束,为了避免无用请求加重服务器负担,直接停止检查的请求。
|
||||
if (
|
||||
Object.keys(this.needCheckSubmitIds).length == 0 ||
|
||||
this.checkStatusNum == 30
|
||||
this.checkStatusNum == 90
|
||||
) {
|
||||
clearTimeout(this.refreshStatus);
|
||||
this.autoCheckOpen = false;
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue