From e45e15a45105f2871eedc089485d1546bcbc108e Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Thu, 12 Sep 2019 15:54:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E5=88=86=E6=88=90=E5=8A=9F-=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E8=B0=83=E7=94=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise/ExerciseReviewAndAnswer.js | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index 97b6a5174..780b87688 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -268,8 +268,8 @@ class ExerciseReviewAndAnswer extends Component{ exercise_questions : update(prevState.exercise_questions, {[key]: { setScore: {$set: flag == undefined || flag==false ? true : false}}}) }),()=>{ if (position && type && (flag == undefined || flag==false)) { + $("#input_"+position+"_"+type).focus(); $("html").animate({ scrollTop: $("#Anchor_"+position+"_"+type).offset().top - 150 }); - if(id){ let { ajustSore } = this.state; let obj = ajustSore.filter(obj => obj.id === id).length > 0; @@ -382,26 +382,26 @@ class ExerciseReviewAndAnswer extends Component{ }).then((result)=>{ if(result.status==200){ 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) => ({ - 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( + // (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( - (prevState) => ({ - ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: undefined},inputSore:{ $set:undefined }}}) - }) - ) - let {exerciseTotalScore} = this.state; - let newScore = parseFloat(parseFloat(exerciseTotalScore)+parseFloat(score)-parseFloat(oldScore)).toFixed(1); - this.setState({ - exerciseTotalScore:newScore - }) - this.showSetScore(key,true); + // this.setState( + // (prevState) => ({ + // ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: undefined},inputSore:{ $set:undefined }}}) + // }) + // ) + // let {exerciseTotalScore} = this.state; + // let newScore = parseFloat(parseFloat(exerciseTotalScore)+parseFloat(score)-parseFloat(oldScore)).toFixed(1); + // this.setState({ + // exerciseTotalScore:newScore + // }) + // this.showSetScore(key,true); } }).catch((error)=>{ console.log(error); @@ -932,6 +932,7 @@ class ExerciseReviewAndAnswer extends Component{ 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"} onChange={(value)=>this.inputScore(value,item.question_id)} + id={`${"input_"+item.q_position+"_"+item.question_type}`} > {