|
|
@ -52,7 +52,7 @@ |
|
|
|
<el-button type="primary" |
|
|
|
<el-button type="primary" |
|
|
|
class="submit btn h-[40px]" |
|
|
|
class="submit btn h-[40px]" |
|
|
|
:loading="submiting" |
|
|
|
:loading="submiting" |
|
|
|
@click="submit" |
|
|
|
@click="confirmSubmit" |
|
|
|
:disabled="isSubmit || !projectList.length">提交</el-button> |
|
|
|
:disabled="isSubmit || !projectList.length">提交</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -373,14 +373,28 @@ const reloadCount = () => { |
|
|
|
}; |
|
|
|
}; |
|
|
|
// 计时器(考核是倒计时,练习是计时) |
|
|
|
// 计时器(考核是倒计时,练习是计时) |
|
|
|
const counter = (counterTime: number) => { |
|
|
|
const counter = (counterTime: number) => { |
|
|
|
const leave1 = counterTime % (24 * 3600); // 计算天数后剩余的毫秒数 |
|
|
|
if (counterTime <= 0) { |
|
|
|
const leave2 = leave1 % 3600; // 计算小时数后剩余的毫秒数 |
|
|
|
if (per.value) { |
|
|
|
const leave3 = leave2 % 60; // 计算分钟数后剩余的毫秒数 |
|
|
|
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))); |
|
|
|
day.value = timeFormat(Math.floor(counterTime / (24 * 3600))); |
|
|
|
hour.value = timeFormat(Math.floor(leave1 / 3600)); |
|
|
|
hour.value = timeFormat(Math.floor(leave1 / 3600)); |
|
|
|
minutes.value = timeFormat(Math.floor(leave2 / 60)); |
|
|
|
minutes.value = timeFormat(Math.floor(leave2 / 60)); |
|
|
|
seconds.value = timeFormat(Math.round(leave3)); |
|
|
|
seconds.value = timeFormat(Math.round(leave3)); |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
// 启动倒计时 |
|
|
|
// 启动倒计时 |
|
|
|
const startCount = () => { |
|
|
|
const startCount = () => { |
|
|
@ -430,13 +444,13 @@ const getCompetitionStatus = async () => { |
|
|
|
const now = await getNow(); |
|
|
|
const now = await getNow(); |
|
|
|
// 如果已经结束 |
|
|
|
// 如果已经结束 |
|
|
|
if (now >= endTime) { |
|
|
|
if (now >= endTime) { |
|
|
|
|
|
|
|
submit(); |
|
|
|
ElMessageBox.alert(`竞赛时间已到,系统已自动交卷`, '提示', { |
|
|
|
ElMessageBox.alert(`竞赛时间已到,系统已自动交卷`, '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
confirmButtonText: '确定', |
|
|
|
callback: (action: Action) => { |
|
|
|
callback: (action: Action) => { |
|
|
|
logout(); |
|
|
|
logout(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
submit(); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 没结束,则显示倒计时 |
|
|
|
// 没结束,则显示倒计时 |
|
|
|
countVal.value = (endTime - now) / 1000; |
|
|
|
countVal.value = (endTime - now) / 1000; |
|
|
@ -458,10 +472,6 @@ const delCache = async () => { |
|
|
|
const setNewProject = (reloadPage?: number) => { |
|
|
|
const setNewProject = (reloadPage?: number) => { |
|
|
|
Cookies.set('sand-projectId', param.projectId); |
|
|
|
Cookies.set('sand-projectId', param.projectId); |
|
|
|
getProDetail(); |
|
|
|
getProDetail(); |
|
|
|
setSubmit(false); |
|
|
|
|
|
|
|
countVal.value = 0; |
|
|
|
|
|
|
|
grade.value = '00'; |
|
|
|
|
|
|
|
pannelTab.value = 'first'; |
|
|
|
|
|
|
|
reload(); |
|
|
|
reload(); |
|
|
|
getEntryTime(); |
|
|
|
getEntryTime(); |
|
|
|
|
|
|
|
|
|
|
@ -536,86 +546,87 @@ const reload = async (fromReload?: number) => { |
|
|
|
await delCache(); // 点了重新开始才需要删除缓存,切换了项目不需要删除缓存 |
|
|
|
await delCache(); // 点了重新开始才需要删除缓存,切换了项目不需要删除缓存 |
|
|
|
Cookies.remove('sand-level'); |
|
|
|
Cookies.remove('sand-level'); |
|
|
|
} |
|
|
|
} |
|
|
|
reloadCount(); |
|
|
|
if (!per.value) { |
|
|
|
grade.value = '00'; |
|
|
|
reloadCount(); |
|
|
|
setSubmit(false); |
|
|
|
startCount(); |
|
|
|
startCount(); |
|
|
|
grade.value = '00'; |
|
|
|
router.push('/'); |
|
|
|
pannelTab.value = 'first'; |
|
|
|
|
|
|
|
setSubmit(false); |
|
|
|
|
|
|
|
router.push('/'); |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
// 提交 |
|
|
|
// 提交 |
|
|
|
const submit = async () => { |
|
|
|
const submit = async () => { |
|
|
|
if (isSubmit.value) return false; |
|
|
|
submiting.value = true; |
|
|
|
const checkpointId = Cookies.get('sand-level') ?? ''; |
|
|
|
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('此操作将视为结束考试,是否继续?', '提示', { |
|
|
|
ElMessageBox.confirm('此操作将视为结束考试,是否继续?', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning', |
|
|
|
type: 'warning', |
|
|
|
closeOnClickModal: false, |
|
|
|
closeOnClickModal: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(async () => { |
|
|
|
.then(submit) |
|
|
|
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(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch(() => { |
|
|
|
.catch(() => { |
|
|
|
submiting.value = false; |
|
|
|
submiting.value = false; |
|
|
|
}); |
|
|
|
}); |
|
|
@ -638,6 +649,7 @@ const getProDetail = async () => { |
|
|
|
projectName: project.projectName, |
|
|
|
projectName: project.projectName, |
|
|
|
}, |
|
|
|
}, |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
// Cookies.set('sand-projectName', project.projectName); |
|
|
|
} |
|
|
|
} |
|
|
|
curReq.value = pointsList.map((e) => e.judgmentId); // 实验要求默认全部展开,通过judgmentId来选中item |
|
|
|
curReq.value = pointsList.map((e) => e.judgmentId); // 实验要求默认全部展开,通过judgmentId来选中item |
|
|
|
points.value = pointsList; |
|
|
|
points.value = pointsList; |
|
|
@ -685,9 +697,9 @@ const getMessage = (msg) => { |
|
|
|
console.log(JSON.parse(msg.data)); |
|
|
|
console.log(JSON.parse(msg.data)); |
|
|
|
const { content } = JSON.parse(msg.data); |
|
|
|
const { content } = JSON.parse(msg.data); |
|
|
|
// 1赛事、2创业、3考核、4模型。-号拼接携带id |
|
|
|
// 1赛事、2创业、3考核、4模型。-号拼接携带id |
|
|
|
if (content == 1) { |
|
|
|
if (content == 1 && per.value === 2) { |
|
|
|
getCompetitionStatus(); |
|
|
|
getCompetitionStatus(); |
|
|
|
} else if (content.includes('3-')) { |
|
|
|
} else if (content.includes('3-') && per.value === 1) { |
|
|
|
// 考核:3-考核id |
|
|
|
// 考核:3-考核id |
|
|
|
getAssStatus(); |
|
|
|
getAssStatus(); |
|
|
|
} |
|
|
|
} |
|
|
@ -728,7 +740,13 @@ const init = async () => { |
|
|
|
param.cid && getList(); |
|
|
|
param.cid && getList(); |
|
|
|
handleCache(); |
|
|
|
handleCache(); |
|
|
|
} |
|
|
|
} |
|
|
|
Cookies.set('sand-loaded', 1); |
|
|
|
|
|
|
|
|
|
|
|
if (!Cookies.get('sand-loaded')) { |
|
|
|
|
|
|
|
Cookies.set('sand-loaded', 1); // 初次加载的标识 |
|
|
|
|
|
|
|
} else if (per.value) { |
|
|
|
|
|
|
|
// 考核/竞赛不查询项目列表,直接查询项目详情 |
|
|
|
|
|
|
|
getProDetail(); |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
onMounted(init); |
|
|
|
onMounted(init); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|