diff --git a/src/api/indexExam.js b/src/api/indexExam.js index 9f3bdbeb..8ecca77d 100644 --- a/src/api/indexExam.js +++ b/src/api/indexExam.js @@ -22,4 +22,6 @@ export const queryExaminationAloneExtendList = (obj) => http.post('/examination/ // 对接三方考试任务保存接口-三方 export const examinationTaskSave = (obj) => http.post('/examination/examinationTaskSave', obj); //编辑考试信息 -export const updateExamination = (obj) => http.post('/examination/updateExamination', obj); \ No newline at end of file +export const updateExamination = (obj) => http.post('/examination/updateExamination', obj); +//编辑外部考试信息 +export const updateExternalExam = (obj) => http.post('/external/exam/updateExternalExam', obj); diff --git a/src/components/drawers/AddTest.vue b/src/components/drawers/AddTest.vue index cbde5a74..3a0a1803 100644 --- a/src/components/drawers/AddTest.vue +++ b/src/components/drawers/AddTest.vue @@ -17,21 +17,44 @@
- - +
+ + + +
+
+ + + +
+
@@ -366,6 +389,8 @@ import {message} from "ant-design-vue"; import { createExamination, queryExaminationDetailById, + updateExamination, + updateExternalExam } from "@/api/indexExam"; // updateExamination, import STest from "./SelectTest.vue"; @@ -496,6 +521,12 @@ export default { scoringModel: 2, questionArrangement: 4, }; + + state.test1 = { + externalName: '', + source: '', + externalExplain: null + } }; const closeDrawer = () => { @@ -522,7 +553,7 @@ export default { console.log("props", props); if (props.addtestVisible && props.EditTestId && props.EditTestId >0) { // 该页面显示同时 edit为true 时,发送查询请求, - // queryTest(); + queryTest(); } if (bool) { state.test.showAnswers = 1; @@ -541,22 +572,36 @@ export default { const queryTest = () => { queryExaminationDetailById({examinationId: props.EditTestId}) .then((res) => { - state.test = res.data.data; - state.test.showAnswers = Number(state.test.showAnswers); - state.test.showAnalysis = Number(state.test.showAnalysis); - state.test.scoringModel = Number(state.test.scoringModel); - state.test.questionArrangement = Number( - state.test.questionArrangement - ); - state.test.chooseTime = [ - dayjs(res.data.data.examinationStartTime, "YYYY-MM-DD HH:mm"), - dayjs(res.data.data.examinationEndTime, "YYYY-MM-DD HH:mm"), - ]; - state.paperName = state.test.examinationTestName; - // state.paperId=dayjs - state.paperId = state.test.examinationTestId; + console.log(res) + // 判断获取的考试 + if(res.data.data.examType==2){ + state.isOuter = 2; + // 外部考试 + state.test1 = { + externalName: res.data.data.examinationName, + source: res.data.data.source, + externalExplain: res.data.data.examinationExplain + } + }else{ + // 系统考试 + state.isOuter = 1; + state.test = res.data.data; + state.test.showAnswers = Number(state.test.showAnswers); + state.test.showAnalysis = Number(state.test.showAnalysis); + state.test.scoringModel = Number(state.test.scoringModel); + state.test.questionArrangement = Number( + state.test.questionArrangement + ); + state.test.chooseTime = [ + dayjs(res.data.data.examinationStartTime, "YYYY-MM-DD HH:mm"), + dayjs(res.data.data.examinationEndTime, "YYYY-MM-DD HH:mm"), + ]; + state.paperName = state.test.examinationTestName; + // state.paperId=dayjs + state.paperId = state.test.examinationTestId; - console.log("querytest", state.test); + console.log("querytest", state.test); + } }) .catch(() => { //message.error(`查询失败`); @@ -630,18 +675,18 @@ export default { - // if (props.EditTestId > 0) { - // // 编辑任务 - // updateExamination(state.test) - // .then(async (res) => { - // await updateTask(res); - // // closeDrawer(); - // }) - // .catch(() => { - // message.destroy(); - // message.error(`编辑失败`); - // }); - // } else { + if (props.EditTestId > 0) { + // 编辑任务 + updateExamination(state.test) + .then(async (res) => { + await updateTask(res); + // closeDrawer(); + }) + .catch(() => { + message.destroy(); + message.error(`编辑失败`); + }); + } else { // 创建任务 createExamination(state.test) .then(async (res) => { @@ -652,7 +697,7 @@ export default { message.destroy(); message.error(`创建失败`); }); - // } + } }else{ // 创建外部考试 console.log('我是点了外部考试') @@ -687,14 +732,34 @@ export default { } } - // 新建外部考试 - CreateExternalExam(state.test1).then( async res=>{ - console.log('新建外部考试返回的参数',res) - // 添加更新到任务 - await updateTask1(res); - }).catch(err=>{ - console.log(err) - }) + + if (props.EditTestId > 0) { + console.log('我要开始编辑外部考试任务了 啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊') + let obj = { + examinationId:props.EditTestId, + examinationName:state.test1.externalName, + examinationExplain:state.test1.externalExplain, + source:state.test1.source + } + updateExternalExam(obj) + .then(async (res) => { + await updateTask1(res); + // closeDrawer(); + }) + .catch(() => { + message.destroy(); + message.error(`编辑失败`); + }); + }else{ + // 新建外部考试 + CreateExternalExam(state.test1).then( async res=>{ + console.log('新建外部考试返回的参数',res) + // 添加更新到任务 + await updateTask1(res); + }).catch(err=>{ + console.log(err) + }) + } } }; // 系统考试 diff --git a/src/views/learningpath/LevelAddDetail.vue b/src/views/learningpath/LevelAddDetail.vue index fdf0686d..03cf16c0 100644 --- a/src/views/learningpath/LevelAddDetail.vue +++ b/src/views/learningpath/LevelAddDetail.vue @@ -545,7 +545,7 @@ ">
- 编辑 - - 删除 diff --git a/src/views/projectcenter/TaskAdd.vue b/src/views/projectcenter/TaskAdd.vue index a8543b6f..1444fbd3 100644 --- a/src/views/projectcenter/TaskAdd.vue +++ b/src/views/projectcenter/TaskAdd.vue @@ -507,7 +507,7 @@ ">
- 编辑 - - 删除