|
|
|
@ -240,10 +240,7 @@ export default { |
|
|
|
|
// 如果已经结束 |
|
|
|
|
if (now >= endTime) { |
|
|
|
|
this.loading = false |
|
|
|
|
this.$alert('竞赛时间已到,系统已自动交卷', '提示', { |
|
|
|
|
confirmButtonText: '确定' |
|
|
|
|
}) |
|
|
|
|
this.submit(1) |
|
|
|
|
this.submit(1, 1) |
|
|
|
|
} else { // 没结束,则显示倒计时 |
|
|
|
|
this.countVal = (endTime - now) / 1000 |
|
|
|
|
load && this.getPaper(now) |
|
|
|
@ -390,11 +387,7 @@ export default { |
|
|
|
|
if (counterTime <= 0) { |
|
|
|
|
if (this.per) { // 竞赛/考核 |
|
|
|
|
clearInterval(this.counterTimer) |
|
|
|
|
this.$alert(`${this.per == 2 ? '竞赛' : '考核'}时间已到,系统已自动交卷`, '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
type: 'warning' |
|
|
|
|
}) |
|
|
|
|
this.submit(1) |
|
|
|
|
this.submit(1, 1) |
|
|
|
|
} else { |
|
|
|
|
this.handleCounter(counterTime, 1) |
|
|
|
|
} |
|
|
|
@ -620,7 +613,7 @@ export default { |
|
|
|
|
} catch (e) { } |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
async submit (isSubmit) { |
|
|
|
|
async submit (isSubmit, autoSubmit) { |
|
|
|
|
if (isSubmit && this.submiting) return false |
|
|
|
|
try { |
|
|
|
|
if (isSubmit) this.submiting = true |
|
|
|
@ -663,13 +656,11 @@ export default { |
|
|
|
|
paperId: curStage.paperId, |
|
|
|
|
examSubmitJudgeList: ques, |
|
|
|
|
} |
|
|
|
|
// if (isSubmit) { |
|
|
|
|
const now = isSubmit ? await Util.getNow() : new Date() |
|
|
|
|
const submitTime = Util.formatDate('yyyy-MM-dd hh:mm:ss', now) |
|
|
|
|
data.endTime = this.per ? curStage.endTime : submitTime |
|
|
|
|
data.submitTime = submitTime |
|
|
|
|
data.timeSum = Math.ceil((now - entryTime) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// 缓存跟提交接口的参数一样 |
|
|
|
|
await this.$post(this.api[isSubmit ? 'submitTheExamPaper' : 'examPaperRecordCache'], data) |
|
|
|
@ -679,20 +670,32 @@ export default { |
|
|
|
|
clearInterval(this.counterTimer) |
|
|
|
|
this.submiting = false |
|
|
|
|
this.submited = true |
|
|
|
|
// 如果是竞赛,并且勾选了公布成绩详情的选项,则弹框提示 |
|
|
|
|
if (this.id) { |
|
|
|
|
const time = curStage.resultAnnouncementTime |
|
|
|
|
const msg = |
|
|
|
|
time === 0 ? '提交成功!成绩将在比赛结束后公布,请前往参赛信息模块查看' : time > 0 ? `提交成功!成绩将在比赛结束后${time}小时公布,请前往参赛信息模块查看` : '提交成功'; |
|
|
|
|
this.$alert(msg, '提示', { |
|
|
|
|
|
|
|
|
|
// 如果是时间到了自动提交,则提交完不弹框,直接关闭页面 |
|
|
|
|
if (autoSubmit) { |
|
|
|
|
this.$alert(`${this.per == 2 ? '竞赛' : '考核'}时间已到,系统已自动交卷`, '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
type: 'success', |
|
|
|
|
callback: () => { |
|
|
|
|
type: 'warning', |
|
|
|
|
callback: _ => { |
|
|
|
|
this.close() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.$message.success('提交成功!') |
|
|
|
|
// 如果是竞赛,并且勾选了公布成绩详情的选项,则弹框提示 |
|
|
|
|
if (this.id) { |
|
|
|
|
const time = curStage.resultAnnouncementTime |
|
|
|
|
const msg = |
|
|
|
|
time === 0 ? '提交成功!成绩将在比赛结束后公布,请前往参赛信息模块查看' : time > 0 ? `提交成功!成绩将在比赛结束后${time}小时公布,请前往参赛信息模块查看` : '提交成功'; |
|
|
|
|
this.$alert(msg, '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
type: 'success', |
|
|
|
|
callback: () => { |
|
|
|
|
this.close() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.$message.success('提交成功!') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} catch (e) { |
|
|
|
|