From 5448660f5fb317d23cf16e9c4ec92206972c9874 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Wed, 8 Jun 2022 18:29:27 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 2 ++ src/components/TestPanel.vue | 37 +++++++++++++++++++++++++++++++++++- src/config/index.js | 2 +- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index dbb6d95..7e2667e 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -5,6 +5,8 @@ export default { runPythonCode: 'python/python/runPythonCode', queryBcJudgmentByBcId: 'judgment/bcJudgmentPoint/queryBcJudgmentByBcId', queryTestProject: 'occupationlab/projectManage/getProjectBySystemId', + editExperimentalData: 'occupationlab/experimentalReport/editExperimentalData', + queryBcJudgmentPointByBcId: 'judgment/bcJudgmentPoint/queryBcJudgmentPointByBcId', saveCache: 'python/python/saveCache', getLastCache: 'python/python/getLastCache', delCache: 'python/python/delCache', diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue index 4eddae5..a3a840c 100644 --- a/src/components/TestPanel.vue +++ b/src/components/TestPanel.vue @@ -274,7 +274,6 @@ export default { const classId = this.classId // 匹配到该考核,并且已经提交过(有reportId则说明有实验记录),并且classId跟当前用户的classId相同,就提示提交了考核然后返回上一页 if (list.find(e => e.assessmentId == assessmentId && e.reportId && e.classId == classId)) { - console.log(33) done = true this.isSubmit = true newmain.$emit('isSubmit', this.isSubmit) @@ -511,8 +510,44 @@ export default { score += e.score // 计算总分 }) this.grade = util.handleZero(score) // 前置加0 + this.editReport(res.reportId) }).catch(err => {}) }, + // 编辑实验报告 + editReport(reportId) { + const data = [] + const ans = [] + const promises = [] + this.taskList.map(e => { + promises.push(new Promise((resolve, reject) => { + data.push({ + judgmentId: e.judgmentId, + judgmentName: e.name, + answer: e.code, + score: e.examScore, + }) + // 获取参考答案 + this.$get(this.api.queryBcJudgmentPointByBcId, { + bcId: e.judgmentId + }).then(({ judgmentPoint }) => { + ans.push(judgmentPoint) + resolve() + }).catch(err => { + reject() + }) + })) + }) + Promise.all(promises).then(_ => { + data.map(e => { + const item = ans.find(n => n.bcId === e.judgmentId) + e.referenceAnswer = item.experimentCode + }) + this.$post(this.api.editExperimentalData, { + reportId, + data: JSON.stringify(data) + }).then(res => {}).catch(err => {}) + }) + }, // 实验面板显示隐藏 togglePannel() { this.pannelVisible = !this.pannelVisible diff --git a/src/config/index.js b/src/config/index.js index 96467b3..a107f32 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -5,7 +5,7 @@ const isBeta = process.env.NODE_ENV === 'development' || location.host.includes( let host = location.origin + ':9000/' // 39.108.250.202 | 192.168.31.151 -if (process.env.NODE_ENV === 'development') host = 'http://39.108.250.202:9000/' +if (process.env.NODE_ENV === 'development') host = 'http://192.168.31.151:9000/' const systemId = util.getCookie('systemId') /** * python8个系统的id和名称