From f1eb51c1d5b3ad311826554498ba541ede4f424b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 23 Jul 2019 13:25:17 +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 --- public/react/src/AppConfig.js | 7 ++--- .../courses/coursesPublic/Addcourses.js | 30 ++++++++++++++----- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 5721c88a9..8cca8205f 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -18,10 +18,9 @@ function locationurl(list){ } // TODO 开发期多个身份切换 -const debugType ="" -// window.location.search.indexOf('debug=t') != -1 ? 'teacher' : -// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin' -// window._debugType = debugType; +const debugType =window.location.search.indexOf('debug=t') != -1 ? 'teacher' : + window.location.search.indexOf('debug=s') != -1 ? 'mfp2guqj3' : 'admin' +window._debugType = debugType; export function initAxiosInterceptors(props) { // TODO 避免重复的请求 https://github.com/axios/axios#cancellation diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index 914a82c6d..b7d46eac6 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -117,7 +117,7 @@ class Addcourses extends Component{ hidetojoinclass=()=>{ - + let {Addcoursestype}=this.props; // console.log(this.props) this.setState({ invite_code:undefined, @@ -132,11 +132,16 @@ class Addcourses extends Component{ student:null, Addcoursestypes:false }) - this.props.hideAddcoursestype(); + + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } + } submitasyn=(course_id)=>{ - let{professor}=this.state; + let{professor,Addcoursestype}=this.state; + if(professor===1){ this.setState({ loadtype:true, @@ -145,13 +150,17 @@ class Addcourses extends Component{ modalSave:(course_id)=>this.submitasyns(course_id), Addcoursestype:false }) - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } }else{ // let{course_id}=this.state; this.setState({ Addcoursestype:false }) - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } window.location.href ="/courses/"+course_id+"/students"; } @@ -161,6 +170,7 @@ class Addcourses extends Component{ } submittojoinclass=()=>{ + let{Addcoursestype}=this.state; this.setState({ isSpin:true }) @@ -207,7 +217,9 @@ class Addcourses extends Component{ message:"提示", description:response.data.message }); - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } // this.props.showNotification(response.data.message); @@ -220,7 +232,9 @@ class Addcourses extends Component{ this.setState({ Addcoursestype:false }) - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } // this.setState({ @@ -318,7 +332,7 @@ class Addcourses extends Component{ keyboard={false} className={"HomeworkModal"} title="加入课堂" - visible={Addcoursestype===undefined?Addcoursestypes:Addcoursestype} + visible={Addcoursestype===undefined||Addcoursestype===false?Addcoursestypes:Addcoursestype} closable={false} footer={null} destroyOnClose={true}