From 800089a4c395aa6abf314ad6318931c70d699b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 24 Jun 2019 09:50:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesDetail/CoursesBanner.js | 35 ++----------------- public/react/src/modules/tpm/NewHeader.js | 29 +++++++++++++-- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index f113209c4..e88e10a9f 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -44,35 +44,14 @@ class CoursesBanner extends Component { modalsBottomval: "", antIcon:false, coursedata:undefined, - user_phone_binded:false, - isRenders:false, - showTrial:false, } } componentDidMount() { this.onloadupdatabanner() - try { - if(this.props.current_user!==undefined){ - this.setState({ - user_phone_binded :this.props.current_user.user_phone_binded, - }) - } - }catch (e) { - console.log("CoursesBanner 60") - console.log(e) - } } - componentDidUpdate = (prevProps) => { - if(prevProps.current_user!=this.props.current_user){ - if(this.props.current_user!==undefined){ - this.setState({ - user_phone_binded :this.props.current_user.user_phone_binded, - }) - } - } - } + onloadupdatabanner=()=>{ this.updatabanner() } @@ -82,19 +61,10 @@ class CoursesBanner extends Component { axios.get(url).then((result) => { if( result!=undefined){ let data = result.data; - if(result.data.status === 407){ - this.setState({ - isRenders:true, - coursedata: data, - showTrial:false, - }) - }else{ this.setState({ coursedata: data, - showTrial:true, }) - } }else{ this.onloadupdatabanner() } @@ -352,11 +322,10 @@ class CoursesBanner extends Component { } render() { - let { Addcoursestypes, coursedata, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,user_phone_binded} = this.state; + let { Addcoursestypes, coursedata, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon} = this.state; return (
- { coursedata === undefined || coursedata.status===401?
:
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 17061f530..f69641f9c 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -170,6 +170,7 @@ class NewHeader extends Component { submitapplications:false, isRender:false, isRenders:false, + user_phone_binded:false, showTrial:false, } console.log("176") @@ -207,7 +208,29 @@ class NewHeader extends Component { } - + componentDidUpdate = (prevProps) => { + // console.log("211"); + // console.log(prevProps); + // 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); + // // if(this.props.current_user!==undefined){ + // // this.setState({ + // // user_phone_binded :this.props.current_user.user_phone_binded, + // // }) + // // } + // }else { + // + // + // } + } componentWillReceiveProps(newProps, oldProps) { this.setState({ user:newProps.user @@ -567,6 +590,7 @@ submittojoinclass=(value)=>{ user, isRender, isRenders, + user_phone_binded, }=this.state; /* 用户名称 用户头像url @@ -588,7 +612,6 @@ submittojoinclass=(value)=>{ }else { activeIndex = true; } - // join_course_url: "https://www.educoder.net/courses/join_course_multi_role" // join_project_url: "https://www.educoder.net/applied_project/applied_project_info" // rolearr:["",""], @@ -612,7 +635,7 @@ submittojoinclass=(value)=>{ {/* />*/} {/* :""*/} {/*}*/} - +
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} From 97e83ab154e211f523e7a36023ba7ab7aa500806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 24 Jun 2019 09:52:38 +0800 Subject: [PATCH 2/2] =?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/courses/coursesDetail/CoursesBanner.js | 1 - public/react/src/modules/tpm/NewHeader.js | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index e88e10a9f..74a1cd6f2 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -9,7 +9,6 @@ import '../css/Courses.css'; import Modals from "../../modals/Modals"; import AddStudentModal from '../members/modal/AddStudentModal' import AddTeacherModal from '../members/modal/AddTeacherModal' -import Trialapplication from "../../login/Trialapplication"; // 点击按钮复制功能 // function jsCopy(){ diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index f69641f9c..9b57d72f0 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -213,11 +213,11 @@ class NewHeader extends Component { // console.log(prevProps); // 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(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);