|
|
|
@ -52,7 +52,7 @@ |
|
|
|
|
<el-button type="primary" |
|
|
|
|
class="submit btn h-[40px]" |
|
|
|
|
:loading="submiting" |
|
|
|
|
@click="submit" |
|
|
|
|
@click="confirmSubmit" |
|
|
|
|
:disabled="isSubmit || !projectList.length">提交</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
@ -373,14 +373,28 @@ const reloadCount = () => { |
|
|
|
|
}; |
|
|
|
|
// 计时器(考核是倒计时,练习是计时) |
|
|
|
|
const counter = (counterTime: number) => { |
|
|
|
|
const leave1 = counterTime % (24 * 3600); // 计算天数后剩余的毫秒数 |
|
|
|
|
const leave2 = leave1 % 3600; // 计算小时数后剩余的毫秒数 |
|
|
|
|
const leave3 = leave2 % 60; // 计算分钟数后剩余的毫秒数 |
|
|
|
|
if (counterTime <= 0) { |
|
|
|
|
if (per.value) { |
|
|
|
|
clearInterval(counterTimer.value); |
|
|
|
|
// 考核/竞赛的倒计时结束后自动提交 |
|
|
|
|
submit(); |
|
|
|
|
ElMessageBox.alert(`${per.value === 1 ? '考核' : '竞赛'}时间已到,系统已自动交卷`, '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
callback: (action: Action) => { |
|
|
|
|
logout(); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
const leave1 = counterTime % (24 * 3600); // 计算天数后剩余的毫秒数 |
|
|
|
|
const leave2 = leave1 % 3600; // 计算小时数后剩余的毫秒数 |
|
|
|
|
const leave3 = leave2 % 60; // 计算分钟数后剩余的毫秒数 |
|
|
|
|
|
|
|
|
|
day.value = timeFormat(Math.floor(counterTime / (24 * 3600))); |
|
|
|
|
hour.value = timeFormat(Math.floor(leave1 / 3600)); |
|
|
|
|
minutes.value = timeFormat(Math.floor(leave2 / 60)); |
|
|
|
|
seconds.value = timeFormat(Math.round(leave3)); |
|
|
|
|
day.value = timeFormat(Math.floor(counterTime / (24 * 3600))); |
|
|
|
|
hour.value = timeFormat(Math.floor(leave1 / 3600)); |
|
|
|
|
minutes.value = timeFormat(Math.floor(leave2 / 60)); |
|
|
|
|
seconds.value = timeFormat(Math.round(leave3)); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
// 启动倒计时 |
|
|
|
|
const startCount = () => { |
|
|
|
@ -430,13 +444,13 @@ const getCompetitionStatus = async () => { |
|
|
|
|
const now = await getNow(); |
|
|
|
|
// 如果已经结束 |
|
|
|
|
if (now >= endTime) { |
|
|
|
|
submit(); |
|
|
|
|
ElMessageBox.alert(`竞赛时间已到,系统已自动交卷`, '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
callback: (action: Action) => { |
|
|
|
|
logout(); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
submit(); |
|
|
|
|
} else { |
|
|
|
|
// 没结束,则显示倒计时 |
|
|
|
|
countVal.value = (endTime - now) / 1000; |
|
|
|
@ -458,10 +472,6 @@ const delCache = async () => { |
|
|
|
|
const setNewProject = (reloadPage?: number) => { |
|
|
|
|
Cookies.set('sand-projectId', param.projectId); |
|
|
|
|
getProDetail(); |
|
|
|
|
setSubmit(false); |
|
|
|
|
countVal.value = 0; |
|
|
|
|
grade.value = '00'; |
|
|
|
|
pannelTab.value = 'first'; |
|
|
|
|
reload(); |
|
|
|
|
getEntryTime(); |
|
|
|
|
|
|
|
|
@ -536,86 +546,87 @@ const reload = async (fromReload?: number) => { |
|
|
|
|
await delCache(); // 点了重新开始才需要删除缓存,切换了项目不需要删除缓存 |
|
|
|
|
Cookies.remove('sand-level'); |
|
|
|
|
} |
|
|
|
|
reloadCount(); |
|
|
|
|
grade.value = '00'; |
|
|
|
|
setSubmit(false); |
|
|
|
|
startCount(); |
|
|
|
|
router.push('/'); |
|
|
|
|
if (!per.value) { |
|
|
|
|
reloadCount(); |
|
|
|
|
startCount(); |
|
|
|
|
grade.value = '00'; |
|
|
|
|
pannelTab.value = 'first'; |
|
|
|
|
setSubmit(false); |
|
|
|
|
router.push('/'); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
// 提交 |
|
|
|
|
const submit = async () => { |
|
|
|
|
if (isSubmit.value) return false; |
|
|
|
|
submiting.value = true; |
|
|
|
|
const checkpointId = Cookies.get('sand-level') ?? ''; |
|
|
|
|
if (!checkpointId) return ElMessage.error('请选择关卡'); |
|
|
|
|
const date = new Date(); |
|
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.value.getTime()) / 60000); // 计算实验用时(分钟),向上取整 |
|
|
|
|
const submitTime = dayjs(date).format('YYYY-MM-DD HH:mm:ss'); |
|
|
|
|
reloadCount(); |
|
|
|
|
const { retMap } = await submitOpe({ |
|
|
|
|
classId: param.classId ? param.classId : '', |
|
|
|
|
className: param.className ? param.className : '', |
|
|
|
|
curriculumId: param.cid, |
|
|
|
|
startTime: dayjs(entryTime.value).format('YYYY-MM-DD HH:mm:ss'), // 取页面进入的时间 |
|
|
|
|
endTime: per.value ? param.stopTime : submitTime, // 结束时间(考核:直接从职站取考核的结束时间;练习:取提交时间) |
|
|
|
|
submitTime, // 提交时间,即当前时间(这3个时间都是传完整的日期时间格式) |
|
|
|
|
timeSum, |
|
|
|
|
checkpointId, |
|
|
|
|
projectId: param.projectId, |
|
|
|
|
projectName: projectList.value.find((e) => e.projectId == param.projectId)?.projectName, |
|
|
|
|
lcId: curReq.value, |
|
|
|
|
systemId: curSystemId.value, |
|
|
|
|
purpose: pd.value.experimentTarget, // 实验目的 |
|
|
|
|
assessmentId: param.assessmentId, |
|
|
|
|
competitionId: param.competitionId, |
|
|
|
|
stageId: param.stageId, |
|
|
|
|
teamId: param.teamId, |
|
|
|
|
mallId: param.mallId, |
|
|
|
|
}); |
|
|
|
|
setSubmit(true); |
|
|
|
|
|
|
|
|
|
let score = 0; |
|
|
|
|
// 给判分列表添加分数和运行结果 |
|
|
|
|
taskList.value.map((e) => { |
|
|
|
|
const item = retMap?.scoreInfo.find((n) => n.lcId === e.judgmentId); |
|
|
|
|
try { |
|
|
|
|
if (item) { |
|
|
|
|
e.examScore = item.questionScore; |
|
|
|
|
e.finishedResult = item.calculate; // 1:正确,2:错误 |
|
|
|
|
score += item.questionScore; // 计算总分 |
|
|
|
|
} else { |
|
|
|
|
e.examScore = 0; |
|
|
|
|
} |
|
|
|
|
} catch (e) {} |
|
|
|
|
}); |
|
|
|
|
grade.value = score < 10 ? '0' + score : score; |
|
|
|
|
reportId.value = retMap.reportId; |
|
|
|
|
Cookies.set('sand-reportId', retMap.reportId); |
|
|
|
|
Cookies.set('sand-score', grade.value); |
|
|
|
|
localStorage.setItem('sand-taskList', JSON.stringify(taskList.value)); |
|
|
|
|
delCache(); |
|
|
|
|
submiting.value = false; |
|
|
|
|
|
|
|
|
|
// 非练习 |
|
|
|
|
per.value && |
|
|
|
|
ElMessageBox.alert(`提交成功${param.resultAnnouncementTime != 0 ? ',成绩将在' + param.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
callback: (action: Action) => { |
|
|
|
|
logout(); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
// 提交前的询问框 |
|
|
|
|
const confirmSubmit = () => { |
|
|
|
|
if (isSubmit.value) return false; |
|
|
|
|
if (!Cookies.get('sand-level')) return ElMessage.error('请选择关卡'); |
|
|
|
|
ElMessageBox.confirm('此操作将视为结束考试,是否继续?', '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
closeOnClickModal: false, |
|
|
|
|
}) |
|
|
|
|
.then(async () => { |
|
|
|
|
submiting.value = true; |
|
|
|
|
const date = new Date(); |
|
|
|
|
const timeSum = Math.ceil((date.getTime() - entryTime.value.getTime()) / 60000); // 计算实验用时(分钟),向上取整 |
|
|
|
|
const submitTime = dayjs(date).format('YYYY-MM-DD HH:mm:ss'); |
|
|
|
|
reloadCount(); |
|
|
|
|
const { retMap } = await submitOpe({ |
|
|
|
|
classId: param.classId ? param.classId : '', |
|
|
|
|
className: param.className ? param.className : '', |
|
|
|
|
curriculumId: param.cid, |
|
|
|
|
startTime: dayjs(entryTime.value).format('YYYY-MM-DD HH:mm:ss'), // 取页面进入的时间 |
|
|
|
|
endTime: per.value ? param.stopTime : submitTime, // 结束时间(考核:直接从职站取考核的结束时间;练习:取提交时间) |
|
|
|
|
submitTime, // 提交时间,即当前时间(这3个时间都是传完整的日期时间格式) |
|
|
|
|
timeSum, |
|
|
|
|
checkpointId, |
|
|
|
|
projectId: param.projectId, |
|
|
|
|
projectName: projectList.value.find((e) => e.projectId == param.projectId)?.projectName, |
|
|
|
|
lcId: curReq.value, |
|
|
|
|
systemId: curSystemId.value, |
|
|
|
|
purpose: pd.value.experimentTarget, // 实验目的 |
|
|
|
|
assessmentId: param.assessmentId, |
|
|
|
|
competitionId: param.competitionId, |
|
|
|
|
stageId: param.stageId, |
|
|
|
|
teamId: param.teamId, |
|
|
|
|
mallId: param.mallId, |
|
|
|
|
}); |
|
|
|
|
setSubmit(true); |
|
|
|
|
|
|
|
|
|
let score = 0; |
|
|
|
|
// 给判分列表添加分数和运行结果 |
|
|
|
|
taskList.value.map((e) => { |
|
|
|
|
const item = retMap?.scoreInfo.find((n) => n.lcId === e.judgmentId); |
|
|
|
|
try { |
|
|
|
|
if (item) { |
|
|
|
|
e.examScore = item.questionScore; |
|
|
|
|
e.finishedResult = item.calculate; // 1:正确,2:错误 |
|
|
|
|
score += item.questionScore; // 计算总分 |
|
|
|
|
} else { |
|
|
|
|
e.examScore = 0; |
|
|
|
|
} |
|
|
|
|
} catch (e) {} |
|
|
|
|
}); |
|
|
|
|
grade.value = score < 10 ? '0' + score : score; |
|
|
|
|
reportId.value = retMap.reportId; |
|
|
|
|
Cookies.set('sand-reportId', retMap.reportId); |
|
|
|
|
Cookies.set('sand-score', grade.value); |
|
|
|
|
localStorage.setItem('sand-taskList', JSON.stringify(taskList.value)); |
|
|
|
|
delCache(); |
|
|
|
|
submiting.value = false; |
|
|
|
|
|
|
|
|
|
// 非练习 |
|
|
|
|
per.value && |
|
|
|
|
ElMessageBox.alert( |
|
|
|
|
`提交成功${param.resultsDetails == 0 && param.resultAnnouncementTime != 0 ? ',成绩将在' + param.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, |
|
|
|
|
'提示', |
|
|
|
|
{ |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
callback: (action: Action) => { |
|
|
|
|
logout(); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
}) |
|
|
|
|
.then(submit) |
|
|
|
|
.catch(() => { |
|
|
|
|
submiting.value = false; |
|
|
|
|
}); |
|
|
|
@ -638,6 +649,7 @@ const getProDetail = async () => { |
|
|
|
|
projectName: project.projectName, |
|
|
|
|
}, |
|
|
|
|
]; |
|
|
|
|
// Cookies.set('sand-projectName', project.projectName); |
|
|
|
|
} |
|
|
|
|
curReq.value = pointsList.map((e) => e.judgmentId); // 实验要求默认全部展开,通过judgmentId来选中item |
|
|
|
|
points.value = pointsList; |
|
|
|
@ -685,9 +697,9 @@ const getMessage = (msg) => { |
|
|
|
|
console.log(JSON.parse(msg.data)); |
|
|
|
|
const { content } = JSON.parse(msg.data); |
|
|
|
|
// 1赛事、2创业、3考核、4模型。-号拼接携带id |
|
|
|
|
if (content == 1) { |
|
|
|
|
if (content == 1 && per.value === 2) { |
|
|
|
|
getCompetitionStatus(); |
|
|
|
|
} else if (content.includes('3-')) { |
|
|
|
|
} else if (content.includes('3-') && per.value === 1) { |
|
|
|
|
// 考核:3-考核id |
|
|
|
|
getAssStatus(); |
|
|
|
|
} |
|
|
|
@ -728,7 +740,13 @@ const init = async () => { |
|
|
|
|
param.cid && getList(); |
|
|
|
|
handleCache(); |
|
|
|
|
} |
|
|
|
|
Cookies.set('sand-loaded', 1); |
|
|
|
|
|
|
|
|
|
if (!Cookies.get('sand-loaded')) { |
|
|
|
|
Cookies.set('sand-loaded', 1); // 初次加载的标识 |
|
|
|
|
} else if (per.value) { |
|
|
|
|
// 考核/竞赛不查询项目列表,直接查询项目详情 |
|
|
|
|
getProDetail(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
onMounted(init); |
|
|
|
|
</script> |
|
|
|
|