From 8e717662d6bcc4a502439d675673cffae1a7bbfa Mon Sep 17 00:00:00 2001 From: "jialong.yu" Date: Tue, 21 Dec 2021 23:20:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TestPanel.vue | 11 ++++++----- src/components/codemirror.vue | 8 ++++---- src/views/Home.vue | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue index 8de7e21..dc40a60 100644 --- a/src/components/TestPanel.vue +++ b/src/components/TestPanel.vue @@ -376,11 +376,12 @@ export default { // 提交询问 confirmSubmit() { const pointList = this.$parent.workbench - // if(!pointList.find(e => e.codeId)) return this.$message.error('请先完成实验') - this.$confirm("此操作将视为结束考试, 是否继续?", "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", + let msg = '此操作将视为结束考试,是否继续?' + if(pointList.find(e => !e.codeId && e.code)) msg = '有代码没有运行,该代码将不得分,确定提交?' + this.$confirm(msg, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', center: true }).then(() => { this.submit() diff --git a/src/components/codemirror.vue b/src/components/codemirror.vue index bb4f4d8..000b606 100644 --- a/src/components/codemirror.vue +++ b/src/components/codemirror.vue @@ -91,7 +91,7 @@ import util from '@/util' import config from '@/config' const CANCEL_TOKEN = axios.CancelToken // 用于input中中断请求 export default { - props: ['workbench1', 'code', 'codeId', 'projectId'], + props: ['judgmentId', 'code', 'codeId', 'projectId'], data() { return { token: util.getCookie('admin-token'), @@ -192,7 +192,7 @@ export default { axios.post(config.host + this.api.runPythonCode, { code: this.sourceCode, - bcId: this.workbench1, + bcId: this.judgmentId, cid: this.courseId, projectId: this.projectId }, { @@ -238,7 +238,7 @@ export default { } else { const inputTextReg = this.inputTextReg const inputFuncReg = /input\(['|"]/g - const bcId = this.workbench1 + const bcId = this.judgmentId const cid = this.courseId const projectId = this.projectId // 该正则是验证代码里是否有input,如果有,就要另外做处理,而不是直接传给后端执行 @@ -342,7 +342,7 @@ export default { getTips() { this.tipsVisible = true this.$get(this.api.queryBcJudgmentByBcId, { - bcId: this.workbench1 + bcId: this.judgmentId }).then(res => { this.answer = res.experimentCode }).catch(err => {}) diff --git a/src/views/Home.vue b/src/views/Home.vue index d210e5a..55dda36 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -26,7 +26,7 @@ :key="codeKey" :projectId.sync="projectId" :code.sync="item.code" - :workbench1="item.judgmentId" + :judgmentId="item.judgmentId" :codeId.sync="item.codeId" :answer.sync="item.answer" @cache="leavePage"