diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js index e9733b079..bde5895e1 100755 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommon.js @@ -30,8 +30,6 @@ class CompetitionCommon extends Component{ componentDidMount(){ window.document.title = '竞赛'; - console.log("CompetitionCommon"); - console.log(this.props); if(this.props.match.params.identifier!=null){ this.getbannerdata(); // this.setState({ @@ -50,9 +48,30 @@ class CompetitionCommon extends Component{ } } + componentDidUpdate = (prevProps) => { + if (prevProps.user != this.props.user) { + + console.log("componentDidUpdatess"); + console.log(this.props.user); + if (this.props.user && this.props.user.login != "") { + const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`; + axios.get((zul)).then((result) => { + if (result) { + if (result.data) { + this.setState({ + signupdata: result.data + }) + } + } + }).catch((error) => { + //console.log(error); + }) + } + } + + } //获取头部信息 getbannerdata=()=>{ - debugger let menuid=this.props.location.search.replace('?menu=', ''); let url=`/competitions/${this.props.match.params.identifier}/common_header.json`; axios.get(url).then((response) => { @@ -86,8 +105,9 @@ class CompetitionCommon extends Component{ }).catch((error) => { console.log(error) }) - console.log("CompetitionCommonCompetitionCommon"); - console.log(this.props.user); + + //this.props.user 有可能为空 + if (this.props.user && this.props.user.login != "") { const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`; axios.get((zul)).then((result) => {