试卷编辑

dev_hs
caicai8 6 years ago
parent 58b4005fbe
commit c3d43d0ab4

@ -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) =>{ sureChangeScore = (question_id,answerArray) =>{
let url=`/exercise_questions/${question_id}/update_scores.json` let url=`/exercise_questions/${question_id}/update_scores.json`
@ -398,6 +412,7 @@ class ExerciceNew extends Component{
addSuccess: this.addSuccess, addSuccess: this.addSuccess,
addQuestion: this.addQuestion, addQuestion: this.addQuestion,
onEditorCancel: this.onEditorCancel, onEditorCancel: this.onEditorCancel,
changeScore:this.changeScore,
editQestion: this.editQestion, editQestion: this.editQestion,
onSortDown: this.onSortDown, onSortDown: this.onSortDown,
onSortUp: this.onSortUp, onSortUp: this.onSortUp,
@ -523,7 +538,7 @@ class ExerciceNew extends Component{
{ exercise_questions.map((item, index) => { { exercise_questions.map((item, index) => {
if (item.question_type == 0 || item.question_type == 1) { if (item.question_type == 0 || item.question_type == 1) {
if (item.isNew) { 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 { } else {
return <SingleDisplay {...this.props} {...item} index={index} {...commonHandler} return <SingleDisplay {...this.props} {...item} index={index} {...commonHandler}
displayCount={exercise_questions.length} displayCount={exercise_questions.length}
@ -531,13 +546,13 @@ class ExerciceNew extends Component{
} }
} else if (item.question_type == 2) { } else if (item.question_type == 2) {
if (item.isNew) { 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 { } else {
return <JudgeDisplay {...this.props} {...item} index={index} {...commonHandler} ></JudgeDisplay> return <JudgeDisplay {...this.props} {...item} index={index} {...commonHandler} ></JudgeDisplay>
} }
} else if (item.question_type == 3) { } else if (item.question_type == 3) {
if (item.isNew) { 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 { } else {
return <NullDisplay {...this.props} {...item} index={index} {...commonHandler} ></NullDisplay> return <NullDisplay {...this.props} {...item} index={index} {...commonHandler} ></NullDisplay>
} }

@ -97,16 +97,8 @@ class SingleEditor extends Component{
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.addSuccess() this.props.addSuccess()
}else if(response.data.status == 3){ }else if(response.data.status == 3){
this.props.confirm({ // 已发布试卷编辑保存
content:'修改了标准答案', this.props.changeScore(question_id,answerArray);
subContent:"是否重新计算学生答题的成绩?",
onOk:()=>{
this.props.sureChangeScore(question_id,answerArray)
},
onCancel:()=>{
this.props.addSuccess();
}
})
} }
}) })
.catch(function (error) { .catch(function (error) {

@ -137,16 +137,8 @@ class NullEditor extends Component{
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.addSuccess() this.props.addSuccess()
}else if(response.data.status == 3){ }else if(response.data.status == 3){
this.props.confirm({ // 已发布试卷编辑保存
content:'修改了标准答案', this.props.changeScore(question_id,answerArray);
subContent:"是否重新计算学生答题的成绩?",
onOk:()=>{
this.props.sureChangeScore(question_id,answerArray)
},
onCancel:()=>{
this.props.addSuccess();
}
})
} }
}) })
.catch(function (error) { .catch(function (error) {

@ -135,16 +135,8 @@ class SingleEditor extends Component{
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.addSuccess() this.props.addSuccess()
}else if(response.data.status == 3){ }else if(response.data.status == 3){
this.props.confirm({ // 已发布试卷编辑保存
content:'修改了标准答案', this.props.changeScore(question_id,answerArray);
subContent:"是否重新计算学生答题的成绩?",
onOk:()=>{
this.props.sureChangeScore(question_id,answerArray)
},
onCancel:()=>{
this.props.addSuccess();
}
})
} }
}) })
.catch(function (error) { .catch(function (error) {

Loading…
Cancel
Save