From 19f678e5972b581d7899f337b3a698ccc7b38de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 25 Jun 2019 09:32:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/login/Trialapplication.js | 332 +++++++++--------- public/react/src/modules/tpm/NewHeader.js | 28 +- 2 files changed, 179 insertions(+), 181 deletions(-) diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index 283574938..8b93fe88c 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -32,6 +32,7 @@ class Trialapplication extends Component { readonlyInput: true, user_phone_binded: false, showTrial: false, + user: undefined, } //user_phone_binded 判断是否手机号验证 // console.log("Trialapplication"); @@ -43,15 +44,32 @@ class Trialapplication extends Component { } componentWillReceiveProps(nextProps) { + // console.log("46"); + // console.log(nextProps); + // console.log(this.props); + if (nextProps.user != this.props.user) { + // console.log("50"); + // console.log(nextProps.user); + if (nextProps.user !== undefined) { + // console.log("53"); + // console.log(nextProps.user); + this.setState({ + user_phone_binded: nextProps.user.user_phone_binded, + }) + } + + + } } + //初始化数据 componentDidMount() { - console.log("53"); - - console.log(this.props.isRenders); + // console.log("53"); + // + // console.log(this.props.isRenders); if (this.props.isRenders != undefined) { this.setState({ @@ -77,21 +95,6 @@ class Trialapplication extends Component { //TODO 这里如果样式变了会出现css不加载的情况 }); - console.log(this.props.isRenders); - console.log("89"); - console.log(this.state.props.user_phone_binded ); - try { - if (this.state.props.user_phone_binded !== undefined) { - console.log(this.state.props.user_phone_binded); - this.setState({ - user_phone_binded: this.state.props.user_phone_binded, - }) - } - - } catch (e) { - console.log(e); - - } } @@ -384,154 +387,151 @@ class Trialapplication extends Component { diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 6ea5360b4..294339b54 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -170,7 +170,6 @@ class NewHeader extends Component { submitapplications:false, isRender:false, isRenders:false, - user_phone_binded:false, showTrial:false, } // console.log("176") @@ -209,18 +208,18 @@ class NewHeader extends Component { } componentDidUpdate = (prevProps) => { - if(prevProps.user!=this.props.user){ - // console.log("216") - // console.log(prevProps.user); - // console.log(this.props.user); - if(this.props.user !== undefined){ - this.setState({ - user_phone_binded :this.props.user.user_phone_binded, - }) - } - - - } + // if(prevProps.user!=this.props.user){ + // // console.log("216") + // // console.log(prevProps.user); + // // console.log(this.props.user); + // if(this.props.user !== undefined){ + // this.setState({ + // user_phone_binded :this.props.user.user_phone_binded, + // }) + // } + // + // + // } } componentWillReceiveProps(newProps, oldProps) { this.setState({ @@ -581,7 +580,6 @@ submittojoinclass=(value)=>{ user, isRender, isRenders, - user_phone_binded, }=this.state; /* 用户名称 用户头像url @@ -627,7 +625,7 @@ submittojoinclass=(value)=>{ {/* />*/} {/* :""*/} {/*}*/} - +
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/}