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 <SingleEditor {...this.props} {...item} index={index} {...commonHandler} sureChangeScore={this.sureChangeScore}></SingleEditor> + return <SingleEditor {...this.props} {...item} index={index} {...commonHandler}></SingleEditor> } else { return <SingleDisplay {...this.props} {...item} index={index} {...commonHandler} displayCount={exercise_questions.length} @@ -531,13 +546,13 @@ class ExerciceNew extends Component{ } } else if (item.question_type == 2) { if (item.isNew) { - return <JudgeEditor {...this.props} {...item} index={index} {...commonHandler} sureChangeScore={this.sureChangeScore}></JudgeEditor> + return <JudgeEditor {...this.props} {...item} index={index} {...commonHandler}></JudgeEditor> } else { return <JudgeDisplay {...this.props} {...item} index={index} {...commonHandler} ></JudgeDisplay> } } else if (item.question_type == 3) { if (item.isNew) { - return <NullEditor {...this.props} {...item} index={index} {...commonHandler} sureChangeScore={this.sureChangeScore}></NullEditor> + return <NullEditor {...this.props} {...item} index={index} {...commonHandler}></NullEditor> } else { return <NullDisplay {...this.props} {...item} index={index} {...commonHandler} ></NullDisplay> } 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) {