diff --git a/public/react/src/modules/courses/elearning/Elearning.js b/public/react/src/modules/courses/elearning/Elearning.js index e107115ae..ef6be4180 100644 --- a/public/react/src/modules/courses/elearning/Elearning.js +++ b/public/react/src/modules/courses/elearning/Elearning.js @@ -61,18 +61,18 @@ class Elearning extends Component{ }) }); - this.setState({ - userlogin:this.props.current_user.login, - }) - } - - componentDidUpdate = (prevProps) => { + if(prevProps.current_user!=this.props.current_user){ + if(this.props.current_user!==undefined){ + this.setState({ + userlogin :this.props.current_user.login, + }) + } + } + } - - }; //开始学习 Startlearning=()=>{ let {userlogin} = this.state; @@ -125,7 +125,6 @@ class Elearning extends Component{ console.log("精品课堂开发学习"); console.log(response); // console.log(JSON.stringify(response)); - debugger if (response.data.status === -2) { this.setState({