From abda3236e3980b006b2b83b2c70b40b642ee8434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=86=99=E4=B8=9C?= <2195178163@qq.com> Date: Tue, 8 Nov 2022 13:45:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat=EF=BC=9A=E9=A1=B9=E7=9B=AE=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=97=E8=A1=A8=20=E8=80=83=E8=AF=95=E7=9A=84?= =?UTF-8?q?=E5=88=A0=E9=99=A4=EF=BC=8C=E7=BC=96=E8=BE=91=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/drawers/AddTest.vue | 129 +++++++++++++++++++++------- src/views/projectcenter/TaskAdd.vue | 20 ++++- 2 files changed, 114 insertions(+), 35 deletions(-) diff --git a/src/components/drawers/AddTest.vue b/src/components/drawers/AddTest.vue index ec7403a9..a534386a 100644 --- a/src/components/drawers/AddTest.vue +++ b/src/components/drawers/AddTest.vue @@ -8,7 +8,7 @@ >
-
{{examinationId ? "编辑" : "添加" }}考试
+
{{EditTestId ? "编辑" : "添加" }}考试
{ console.log(values); - updateTest(props.examinationId) + updateTest(); }; const handleFinishFailed = errors => { @@ -387,9 +411,18 @@ export default { resetForm(); formState.choosedTime = ''; ctx.emit("update:addtestVisible", false); + ctx.emit("update:edit", false); }; - const queryTest = (data) => { - queryExaminationDetailById(data).then((res) => { + const afterVisibleChange = (bool) => { + console.log(props.edit); + if (props.addtestVisible && props.edit) { // 该页面显示同时 edit为true 时,发送查询请求, + queryTest() + } + console.log("formState", bool); + }; + const queryTest = () => { + console.log(props.EditTestId); + queryExaminationDetailById({examinationId:props.EditTestId}).then((res) => { formState.examinationName = res.data.data.examinationName; formState.workRequirement = res.data.data.workRequirement; formState.examinationDuration = res.data.data.examinationDuration; @@ -408,7 +441,23 @@ export default { message.error(`查询失败`) }) } - const updateTest = (id) => { + const updateTest = () => { + + // 如果是关卡页面进入 --------------------------------- + if (props.isLevel) { + //. + } else { // 从任务界面进入 + if(props.edit) { // 编辑任务 + myUpdateExamination() + }else { // 创建任务 + myCreateExamination() + } + } + + + } + + const myUpdateExamination = () => { let obj = { "createTime": "", "createUser": 0, @@ -416,7 +465,7 @@ export default { "examinationEndTime": dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"), "examinationExplain": formState.examinationExplain, "examinationFlag": "", - "examinationId": id || 0, + "examinationId": props.EditTestId, "examinationLimit": formState.examinationLimit, "examinationName": formState.examinationName, "examinationPaperId": 0, @@ -431,48 +480,66 @@ export default { "updateTime": "", "updateUser": 0 } - if(id) { - updateExamination(obj).then((res)=>{ + updateExamination(obj).then((res)=>{ console.log(res); + myProjectEditTask(res.data.data.examinationId) }).catch(()=>{ message.error(`编辑失败`) }) - } else { - createExamination(obj).then(()=>{ + + } + const myCreateExamination = () => { + let obj = { + "createTime": "", + "createUser": 0, + "examinationDuration": formState.examinationDuration, + "examinationEndTime": dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"), + "examinationExplain": formState.examinationExplain, + "examinationFlag": "", + "examinationId": 0, + "examinationLimit": formState.examinationLimit, + "examinationName": formState.examinationName, + "examinationPaperId": 0, + "examinationPaperName": formState.choosedTest, + "examinationStartTime": dayjs(formState.choosedTime[0]).format("YYYY-MM-DD"), + "examinationTag": "", + "passLine": formState.passLine, + "questionArrangement": formState.questionArrangement, + "scoringModel": formState.scoringModel, + "showAnalysis": formState.showAnalysis, + "showAnswers": formState.showAnswers, + "updateTime": "", + "updateUser": 0 + } + createExamination(obj).then((res)=>{ + myProjectEditTask(res.data.data.examinationId) }).catch((err)=>{ message.error(`添加失败${err}`) }) - } - - + } + const myProjectEditTask = (testId) => { let editObj = { - "courseId": 0, - "duration": 0, + "courseId": testId, + "duration": 50, "flag": true, - "name": "", - "projectId": 0, - "projectTaskId": props.examinationId || '', - "stageId": 0, + "name": formState.examinationName, + "projectId": props.projectId, + "projectTaskId": props.projectTaskId || null, + "stageId": props.chooseStageId, "type": 5 } // 新增编辑或新增项目 ProjectEditTask(editObj).then(res => { console.log(` 编辑项目成功的打印 ${res}`); - message.success(`${props.examinationId? '编辑' : '新增'}阶段任务成功`) + message.success(`${props.EditTestId? '编辑' : '新增'}阶段任务成功`) + ctx.emit("changeData", false); closeDrawer(); }).catch(err => { - message.error(`${props.examinationId? '编辑' : '新增'}阶段任务失败`) + message.error(`${props.EditTestId? '编辑' : '新增'}阶段任务失败`) console.log(` 编辑项目失败的打印 ${err}`); }) - - } - const afterVisibleChange = (bool) => { - console.log("formState", bool); - if(props.addtestVisible && props.examinationId){ - queryTest({examinationId: props.examinationId}) - } - }; + const cloradio1 = (value) => { if (value != "") { formState.showAnswers = ""; diff --git a/src/views/projectcenter/TaskAdd.vue b/src/views/projectcenter/TaskAdd.vue index 8315f1ee..ad6cc7c0 100644 --- a/src/views/projectcenter/TaskAdd.vue +++ b/src/views/projectcenter/TaskAdd.vue @@ -162,7 +162,16 @@
- +
@@ -863,6 +872,7 @@ export default { EditLiveId: null, //要编辑的直播的id editDiscussId:null,//要编辑的讨论的id EditWorkId:null, // 要编辑的作业id + EditTestId: null,// 要编辑的考试id EditEvalId:null, projectTaskId:null, // 要编辑的具体任务id projectNameList: [ @@ -1295,7 +1305,7 @@ export default { // 删除考试 const deleteTest = () => { let obj = { - examinationId: 0, + examinationId: state.deleteID, }; deleteExaminationById(obj) .then((res) => { @@ -1688,7 +1698,9 @@ export default { state.projectTaskId = eleId; state.addhomeworkvisible = true; }; - const showDrawerAddTest = () => { + const showDrawerAddTest = (id,eleId) => { + state.EditTestId = id + state.projectTaskId = eleId; state.addtestvisible = true; }; const showDrawerAddLive = () => { @@ -1842,7 +1854,7 @@ export default { }else if (type == "作业") { showDrawerAddHomework(id,eleId); }else if (type == "考试") { - showDrawerAddTest(id); + showDrawerAddTest(id,eleId); } } return { From 305cfb98308c8eb246fbdc0947f4b54e1a8f2d04 Mon Sep 17 00:00:00 2001 From: dongwug Date: Tue, 8 Nov 2022 14:22:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=E5=88=9B=E5=BB=BA=E9=A2=98=E5=B9=B2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/drawers/AddVote.vue | 7 +++- src/components/drawers/CreVote.vue | 51 ++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/components/drawers/AddVote.vue b/src/components/drawers/AddVote.vue index 99acd182..cf784131 100644 --- a/src/components/drawers/AddVote.vue +++ b/src/components/drawers/AddVote.vue @@ -176,6 +176,8 @@ export default { basevote: "", endTimes: "", startTimes: "", + ascriptionId:"", + voteStemId:"", }); const closeDrawer = () => { ctx.emit("update:addvoteVisible", false); @@ -189,8 +191,11 @@ export default { }; const changeVData = (data) => { console.log('111', data); - state.creVote = data + state.creVote = data.creVote + state.ascriptionId = data.ascriptionId + state.voteStemId = data.voteStemId console.log('222',state.creVote); + console.log('333',state.ascriptionId); } const delBox = () => { state.creVote = false; diff --git a/src/components/drawers/CreVote.vue b/src/components/drawers/CreVote.vue index e16c49f2..f8f1cc35 100644 --- a/src/components/drawers/CreVote.vue +++ b/src/components/drawers/CreVote.vue @@ -167,27 +167,46 @@ export default { // return message.info("请输入选项"); // } console.log(state.questions[0].inputV); - let obj = { - createTime: "", - createUser: 0, - optionDto: [ - { - optionId: 0, - optionName: "", - optionPictureAddress: "", - }, - ], - stemName: "", - updateTime: "", - updateUser: 0, - voteStemId: 0, - }; + let obj = [ + { + ascriptionId: 0, + createTime: "", + createUser: 0, + optionDetailList: [ + { + createTime: "", + createUser: 0, + optionId: 0, + optionName: "", + optionOrderNum: "", + optionPictureAddress: "", + stem: "", + updateTime: "", + updateUser: 0, + voteStemId: 0, + }, + ], + orderNumber: "", + updateTime: "", + updateUser: 0, + voteStemFlag: "", + voteStemId: 0, + voteStemName: "", + }, + ]; api .createOptionMessage(obj) .then((res) => { console.log("创建成功", res); + console.log('res.data.data[0].ascriptionId',res.data.data[0].ascriptionId); + console.log('res.data.data[0].voteStemId',res.data.data[0].voteStemId); message.success("创建成功"); - ctx.emit("getData", state.creVote); + let stemData = { + creVote: state.creVote, + ascriptionId: res.data.data[0].ascriptionId, + voteStemId:res.data.data[0].voteStemId + }; + ctx.emit("getData", stemData); closeDrawer(); }) .catch((err) => {