|
|
|
@ -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,6 +373,19 @@ const reloadCount = () => { |
|
|
|
|
}; |
|
|
|
|
// 计时器(考核是倒计时,练习是计时) |
|
|
|
|
const counter = (counterTime: number) => { |
|
|
|
|
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; // 计算分钟数后剩余的毫秒数 |
|
|
|
@ -381,6 +394,7 @@ const counter = (counterTime: number) => { |
|
|
|
|
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,25 +546,19 @@ const reload = async (fromReload?: number) => { |
|
|
|
|
await delCache(); // 点了重新开始才需要删除缓存,切换了项目不需要删除缓存 |
|
|
|
|
Cookies.remove('sand-level'); |
|
|
|
|
} |
|
|
|
|
if (!per.value) { |
|
|
|
|
reloadCount(); |
|
|
|
|
startCount(); |
|
|
|
|
grade.value = '00'; |
|
|
|
|
pannelTab.value = 'first'; |
|
|
|
|
setSubmit(false); |
|
|
|
|
startCount(); |
|
|
|
|
router.push('/'); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
// 提交 |
|
|
|
|
const submit = async () => { |
|
|
|
|
if (isSubmit.value) return false; |
|
|
|
|
const checkpointId = Cookies.get('sand-level') ?? ''; |
|
|
|
|
if (!checkpointId) return ElMessage.error('请选择关卡'); |
|
|
|
|
ElMessageBox.confirm('此操作将视为结束考试,是否继续?', '提示', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
closeOnClickModal: false, |
|
|
|
|
}) |
|
|
|
|
.then(async () => { |
|
|
|
|
submiting.value = true; |
|
|
|
|
const checkpointId = Cookies.get('sand-level') ?? ''; |
|
|
|
|
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'); |
|
|
|
@ -605,17 +609,24 @@ const submit = async () => { |
|
|
|
|
|
|
|
|
|
// 非练习 |
|
|
|
|
per.value && |
|
|
|
|
ElMessageBox.alert( |
|
|
|
|
`提交成功${param.resultsDetails == 0 && param.resultAnnouncementTime != 0 ? ',成绩将在' + param.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, |
|
|
|
|
'提示', |
|
|
|
|
{ |
|
|
|
|
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(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> |
|
|
|
|