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和名称