From ddf7bbfcbfe96c4728a3f0ad1c5611506f701c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 25 Oct 2019 14:04:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AF=BC=E8=88=AA=E6=A0=8F?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Competitioncommon/CompetitionCommon.js | 9 ++-- .../CompetitionContentsMd.js | 41 +++++++++++-------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js index 0ff9f6bab..3c4c59b88 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js @@ -119,10 +119,7 @@ class CompetitionCommon extends Component{ } getrightdata=(id,typeid,module_url,has_url,listkey)=>{ - this.setState({ - module_id:id, - module_type:typeid - }) + if(typeid==="enroll"){ this.props.history.replace(`/newcompetitions/${this.props.match.params.identifier}/enroll`); return @@ -146,6 +143,10 @@ class CompetitionCommon extends Component{ return } + this.setState({ + module_id:id, + module_type:typeid + }) } Competitionedit=()=>{ diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsMd.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsMd.js index 8cb5ba985..6cd1ccafb 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsMd.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionContentsMd.js @@ -14,8 +14,8 @@ class CompetitionContentsMd extends Component{ } } componentDidUpdate =(prevState)=>{ - if(prevState.tabkey!=this.props.tabkey){ - this.getchartdata() + if(prevState!=this.props){ + this.getchartdata(); } } componentDidMount(){ @@ -26,30 +26,37 @@ class CompetitionContentsMd extends Component{ getchartdata=()=>{ let {mdContentdata,chart_rules}=this.props; + // is_pdf: false if(this.props.module_type==="chart"){ let type=true; - chart_rules.rule_contents.map((items,keys)=>{ - if(parseInt(this.props.tabkey)===items.competition_stage_id){ - console.log(items) - this.contentMdRef.current.setValue(items.content); + if(chart_rules===undefined){ + + }else{ + chart_rules.rule_contents.map((items,keys)=>{ + debugger + if(parseInt(this.props.tabkey)===items.competition_stage_id){ + console.log(items) + this.contentMdRef.current.setValue(items.content); + this.setState({ + contentFileList:undefined, + chartmodule_id:items.id + }) + type=false; + } + }) + + if(type===true){ + this.contentMdRef.current.setValue(""); this.setState({ contentFileList:undefined, - chartmodule_id:items.id + chartmodule_id:undefined }) - type=false; - } - }) - - if(type===true){ - this.contentMdRef.current.setValue(""); - this.setState({ - contentFileList:undefined, - chartmodule_id:undefined - }) + } } + }else{ let contentFileList = mdContentdata===undefined?[]:mdContentdata.attachments===undefined?[]:mdContentdata.attachments.map((item) => { return {