From c3d43d0ab4d47fd2eb7d68219187ce5a9b5f38ae Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Sat, 24 Aug 2019 14:03:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/exercise/ExerciseNew.js | 21 ++++++++++++++++--- .../courses/exercise/new/JudgeEditor.js | 12 ++--------- .../courses/exercise/new/NullEditor.js | 12 ++--------- .../courses/exercise/new/SingleEditor.js | 12 ++--------- 4 files changed, 24 insertions(+), 33 deletions(-) diff --git a/public/react/src/modules/courses/exercise/ExerciseNew.js b/public/react/src/modules/courses/exercise/ExerciseNew.js index 9e5fff36b..cbde30a5e 100644 --- a/public/react/src/modules/courses/exercise/ExerciseNew.js +++ b/public/react/src/modules/courses/exercise/ExerciseNew.js @@ -49,6 +49,20 @@ class ExerciceNew extends Component{ } } + // 已发布试卷编辑保存的确认弹框 + changeScore = (question_id,answerArray) =>{ + this.props.confirm({ + content:'修改了标准答案', + subContent:"是否重新计算学生答题的成绩?", + onOk:()=>{ + this.sureChangeScore(question_id,answerArray) + }, + onCancel:()=>{ + this.addSuccess(); + } + }) + } + // 已发布试卷修改答案确认修改分数 sureChangeScore = (question_id,answerArray) =>{ let url=`/exercise_questions/${question_id}/update_scores.json` @@ -398,6 +412,7 @@ class ExerciceNew extends Component{ addSuccess: this.addSuccess, addQuestion: this.addQuestion, onEditorCancel: this.onEditorCancel, + changeScore:this.changeScore, editQestion: this.editQestion, onSortDown: this.onSortDown, onSortUp: this.onSortUp, @@ -523,7 +538,7 @@ class ExerciceNew extends Component{ { exercise_questions.map((item, index) => { if (item.question_type == 0 || item.question_type == 1) { if (item.isNew) { - return + return } else { return + return } else { return } } else if (item.question_type == 3) { if (item.isNew) { - return + return } else { return } diff --git a/public/react/src/modules/courses/exercise/new/JudgeEditor.js b/public/react/src/modules/courses/exercise/new/JudgeEditor.js index 16ccad54a..41bc5bac4 100644 --- a/public/react/src/modules/courses/exercise/new/JudgeEditor.js +++ b/public/react/src/modules/courses/exercise/new/JudgeEditor.js @@ -97,16 +97,8 @@ class SingleEditor extends Component{ if (response.data.status == 0) { this.props.addSuccess() }else if(response.data.status == 3){ - this.props.confirm({ - content:'修改了标准答案', - subContent:"是否重新计算学生答题的成绩?", - onOk:()=>{ - this.props.sureChangeScore(question_id,answerArray) - }, - onCancel:()=>{ - this.props.addSuccess(); - } - }) + // 已发布试卷编辑保存 + this.props.changeScore(question_id,answerArray); } }) .catch(function (error) { diff --git a/public/react/src/modules/courses/exercise/new/NullEditor.js b/public/react/src/modules/courses/exercise/new/NullEditor.js index f3c736196..85a8aa336 100644 --- a/public/react/src/modules/courses/exercise/new/NullEditor.js +++ b/public/react/src/modules/courses/exercise/new/NullEditor.js @@ -137,16 +137,8 @@ class NullEditor extends Component{ if (response.data.status == 0) { this.props.addSuccess() }else if(response.data.status == 3){ - this.props.confirm({ - content:'修改了标准答案', - subContent:"是否重新计算学生答题的成绩?", - onOk:()=>{ - this.props.sureChangeScore(question_id,answerArray) - }, - onCancel:()=>{ - this.props.addSuccess(); - } - }) + // 已发布试卷编辑保存 + this.props.changeScore(question_id,answerArray); } }) .catch(function (error) { diff --git a/public/react/src/modules/courses/exercise/new/SingleEditor.js b/public/react/src/modules/courses/exercise/new/SingleEditor.js index 8053f4f21..50e594a59 100644 --- a/public/react/src/modules/courses/exercise/new/SingleEditor.js +++ b/public/react/src/modules/courses/exercise/new/SingleEditor.js @@ -135,16 +135,8 @@ class SingleEditor extends Component{ if (response.data.status == 0) { this.props.addSuccess() }else if(response.data.status == 3){ - this.props.confirm({ - content:'修改了标准答案', - subContent:"是否重新计算学生答题的成绩?", - onOk:()=>{ - this.props.sureChangeScore(question_id,answerArray) - }, - onCancel:()=>{ - this.props.addSuccess(); - } - }) + // 已发布试卷编辑保存 + this.props.changeScore(question_id,answerArray); } }) .catch(function (error) {