Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_hs
cxt 5 years ago
commit 2e79967318

@ -32,7 +32,7 @@ module ExercisesHelper
ques_score = 0.0
end
else
ques_score = answers_content.select(:score).pluck(:score).sum
ques_score = answers_content.score_reviewed.select(:score).pluck(:score).sum
end
if ques_score >= q.question_score #满分作答为正确

@ -106,11 +106,11 @@ export function CNotificationHOC(options = {}) {
confirm = (object) => {
const { title, content, onOk, onCancel, okText } = object;
const { title, content,subContent, onOk, onCancel, okText } = object;
this.onCancel = onCancel
this.onOk = onOk
this.okText = okText || ''
this.setState({ title, content, dialogOpen: true })
this.setState({ title, content , subContent , dialogOpen: true })
}
onDialogOkBtnClick = () => {
this.onOk && this.onOk();
@ -141,17 +141,17 @@ export function CNotificationHOC(options = {}) {
this.onOk = null
}
render() {
const { snackbarOpen, snackbarText, snackbarHorizontal, snackbarVertical, dialogOpen, content ,defineOpen } = this.state;
const { snackbarOpen, snackbarText, snackbarHorizontal, snackbarVertical, dialogOpen, content ,subContent ,defineOpen } = this.state;
return (
<React.Fragment>
<Modals
<Modals
modalsType={dialogOpen}
modalsTopval={
content
}
modalsBottomval={""}
modalsBottomval={ subContent || "" }
modalCancel={this.handleDialogClose}
modalSave={this.onDialogOkBtnClick}
okText={this.okText}

@ -48,6 +48,22 @@ class ExerciceNew extends Component{
editMode: !this.props.match.params.Id,
}
}
// 已发布试卷修改答案确认修改分数
sureChangeScore = (question_id,answerArray) =>{
let url=`/exercise_questions/${question_id}/update_scores.json`
axios.post((url),{
standard_answers:answerArray
}).then((result)=>{
if(result){
this.props.showNotification(`${result.data.message}`);
this.addSuccess();
}
}).catch((error)=>{
console.log(error);
})
}
fetchExercise = () => {
const Id = this.props.match.params.Id
this.isEdit = !!Id
@ -507,7 +523,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} ></SingleEditor>
return <SingleEditor {...this.props} {...item} index={index} {...commonHandler} sureChangeScore={this.sureChangeScore}></SingleEditor>
} else {
return <SingleDisplay {...this.props} {...item} index={index} {...commonHandler}
displayCount={exercise_questions.length}
@ -515,13 +531,13 @@ class ExerciceNew extends Component{
}
} else if (item.question_type == 2) {
if (item.isNew) {
return <JudgeEditor {...this.props} {...item} index={index} {...commonHandler} ></JudgeEditor>
return <JudgeEditor {...this.props} {...item} index={index} {...commonHandler} sureChangeScore={this.sureChangeScore}></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} ></NullEditor>
return <NullEditor {...this.props} {...item} index={index} {...commonHandler} sureChangeScore={this.sureChangeScore}></NullEditor>
} else {
return <NullDisplay {...this.props} {...item} index={index} {...commonHandler} ></NullDisplay>
}

@ -93,10 +93,20 @@ class SingleEditor extends Component{
question_choices,
standard_answers: answerArray,
insert_id: question_id_to_insert_after || undefined
})
.then((response) => {
}).then((response) => {
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();
}
})
}
})
.catch(function (error) {

@ -133,10 +133,20 @@ class NullEditor extends Component{
standard_answers: answerArray,
insert_id: question_id_to_insert_after || undefined,
is_ordered:newis_ordered,
})
.then((response) => {
}).then((response) => {
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();
}
})
}
})
.catch(function (error) {

@ -105,8 +105,6 @@ class SingleEditor extends Component{
if(!question_title) {
this.refs['titleEditor'].showError()
this.props.showNotification('题目:不能为空'); return;
}
for(let i = 0; i < question_choices.length; i++) {
@ -115,7 +113,6 @@ class SingleEditor extends Component{
this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`); return;
}
}
/**
{
"question_title":"同学朋友间常用的沟通工具是什么?",
@ -134,15 +131,25 @@ class SingleEditor extends Component{
question_choices,
standard_answers: answerArray,
insert_id: question_id_to_insert_after || undefined
}).then((response) => {
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();
}
})
}
})
.then((response) => {
if (response.data.status == 0) {
this.props.addSuccess()
}
})
.catch(function (error) {
console.log(error);
});
.catch(function (error) {
console.log(error);
});
} else {
const url = `/exercises/${Id}/exercise_questions.json`
@ -167,6 +174,9 @@ class SingleEditor extends Component{
onCancel = () => {
this.props.onEditorCancel()
}
componentDidMount = () => {
}

Loading…
Cancel
Save