调分成功-重新调用接口

dev_cs
caicai8 5 years ago
parent 964c22e604
commit e45e15a451

@ -268,8 +268,8 @@ class ExerciseReviewAndAnswer extends Component{
exercise_questions : update(prevState.exercise_questions, {[key]: { setScore: {$set: flag == undefined || flag==false ? true : false}}}) exercise_questions : update(prevState.exercise_questions, {[key]: { setScore: {$set: flag == undefined || flag==false ? true : false}}})
}),()=>{ }),()=>{
if (position && type && (flag == undefined || flag==false)) { if (position && type && (flag == undefined || flag==false)) {
$("#input_"+position+"_"+type).focus();
$("html").animate({ scrollTop: $("#Anchor_"+position+"_"+type).offset().top - 150 }); $("html").animate({ scrollTop: $("#Anchor_"+position+"_"+type).offset().top - 150 });
if(id){ if(id){
let { ajustSore } = this.state; let { ajustSore } = this.state;
let obj = ajustSore.filter(obj => obj.id === id).length > 0; let obj = ajustSore.filter(obj => obj.id === id).length > 0;
@ -382,26 +382,26 @@ class ExerciseReviewAndAnswer extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.status==200){ if(result.status==200){
this.props.showNotification('调分成功'); this.props.showNotification('调分成功');
this.getInfo();
// let statusScore = score==0 ? 0 : score > 0 && score < maxScore ? 2 : 1;
let statusScore = score==0 ? 0 : score > 0 && score < maxScore ? 2 : 1; // this.setState(
// (prevState) => ({
this.setState( // exercise_questions : update(prevState.exercise_questions, {[key]: { user_score: {$set: parseFloat(score).toFixed(1)},answer_status : {$set: statusScore},question_comments:{$set:result.data.question_comments} }}),
(prevState) => ({ // })
exercise_questions : update(prevState.exercise_questions, {[key]: { user_score: {$set: parseFloat(score).toFixed(1)},answer_status : {$set: statusScore},question_comments:{$set:result.data.question_comments} }}), // )
})
)
this.setState( // this.setState(
(prevState) => ({ // (prevState) => ({
ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: undefined},inputSore:{ $set:undefined }}}) // ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: undefined},inputSore:{ $set:undefined }}})
}) // })
) // )
let {exerciseTotalScore} = this.state; // let {exerciseTotalScore} = this.state;
let newScore = parseFloat(parseFloat(exerciseTotalScore)+parseFloat(score)-parseFloat(oldScore)).toFixed(1); // let newScore = parseFloat(parseFloat(exerciseTotalScore)+parseFloat(score)-parseFloat(oldScore)).toFixed(1);
this.setState({ // this.setState({
exerciseTotalScore:newScore // exerciseTotalScore:newScore
}) // })
this.showSetScore(key,true); // this.showSetScore(key,true);
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
@ -932,6 +932,7 @@ class ExerciseReviewAndAnswer extends Component{
precision={1} precision={1}
className={ list && list.length>0 && list[0].setTip !="" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"} className={ list && list.length>0 && list[0].setTip !="" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"}
onChange={(value)=>this.inputScore(value,item.question_id)} onChange={(value)=>this.inputScore(value,item.question_id)}
id={`${"input_"+item.q_position+"_"+item.question_type}`}
></InputNumber> ></InputNumber>
<span className="ml5"></span> <span className="ml5"></span>
{ {

Loading…
Cancel
Save