From 6d80a53e6d3fce45cb2e444c3fac2cba05eef5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 31 Aug 2019 13:26:25 +0800 Subject: [PATCH] b --- .../OfficialAcademicTranscript.js | 93 +++++++++++-------- 1 file changed, 56 insertions(+), 37 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js b/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js index 750b1c69e..fe8bf988d 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js @@ -14,42 +14,6 @@ class OfficialAcademicTranscript extends Component { } componentDidMount() { - - } - myjumptopic=(e)=>{ - console.log("获取到值"); - console.log(e); - this.props.jumptopic(e); - } - - editgame_scores=(e,id)=>{ - let score=e.target.value; - if(score!=null&&score!=undefined&&score!=""){ - let work_id=this.props.data.work_id; - let url=`/student_works/${work_id}/adjust_review_score.json` - axios.post(url,{ - type:"report", - score:score, - challenge_id:id - }).then((result)=>{ - if(result.data.status===0){ - // this.props.getdatalist() - this.props.showNotification(result.data.message); - - this.props.setupdalist(result.data.challenge_score,result.data.overall_appraisal,result.data.work_score) - }else{ - this.props.showNotification(result.data.message); - } - }).catch((error)=>{ - - }) - }else{ - this.props.showNotification("调分为空将不会修改之前的分数"); - } - } - - render() { - let {data}=this.props; let datas=[]; @@ -68,8 +32,63 @@ class OfficialAcademicTranscript extends Component { // adjustmentminute:asdasd }) }) + + this.setState({ + datas:datas + }) + } + } + myjumptopic=(e)=>{ + console.log("获取到值"); + console.log(e); + this.props.jumptopic(e); + } + + editgame_scores=(e,id,maxsum)=>{ + let{datas}=this.state; + let newdatas=datas; + let score=e.target.value; + + if(score!=null&&score!=undefined&&score!=""){ + if(scoremaxsum){ + this.props.showNotification(`调分不能大于${maxsum}`); + }else{ + let work_id=this.props.data.work_id; + let url=`/student_works/${work_id}/adjust_review_score.json` + axios.post(url,{ + type:"report", + score:score, + challenge_id:id + }).then((result)=>{ + if(result.data.status===0){ + // this.props.getdatalist() + this.props.showNotification(result.data.message); + this.props.setupdalist(result.data.challenge_score,result.data.overall_appraisal,result.data.work_score) + newdatas.map((item,key)=>{ + if(item.challenge_id.id===id){ + item.game_scores.game_score=score + } + }) + this.setState({ + datas:newdatas + }) + }else{ + this.props.showNotification(result.data.message); + } + }).catch((error)=>{ + + }) + } + + }else{ + this.props.showNotification("调分为空将不会修改之前的分数"); } + } + render() { + let {datas}=this.state; let columns=[{ title: '关卡', @@ -165,7 +184,7 @@ class OfficialAcademicTranscript extends Component { render: (text, record) => ( this.editgame_scores(e,record.challenge_id.id)} + onBlur={(e) => this.editgame_scores(e,record.challenge_id.id,record.game_scores.game_score_full)} min={0} max={record.game_scores.game_score_full} /> {/*查看*/}