From d9716703f0f649fad2fc4e2555d6a335350c7c25 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, 24 Sep 2019 15:57:33 +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/modules/courses/Index.js | 1 - .../courses/coursesDetail/CoursesLeftNav.js | 173 ++++++------------ .../courses/exercise/ExerciseListItem.js | 8 +- .../graduation/tasks/GraduateTaskItem.js | 4 +- .../src/modules/courses/poll/PollListItem.js | 2 +- .../react/src/modules/message/js/MessagSub.js | 4 +- 6 files changed, 64 insertions(+), 128 deletions(-) diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index f9f80a9da..c414df55a 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -299,7 +299,6 @@ class CoursesIndex extends Component{ this.historyArray = [window.location.pathname]; this.props.history.listen( location => { - console.log(location); this.historyArray.unshift(window.location.pathname); this.historyArray.length = 2; //Do your stuff here diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 35b06f305..e50ec56e6 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -181,7 +181,7 @@ class Coursesleftnav extends Component{ on('editshixunname',this.editshixunchild) on('editshixunmainname',this.editshixunmainname) - this.props.updataleftNavfun(); + // this.props.updataleftNavfun(); // this.props.getleftNavid && this.props.getleftNavid("shixun_homework"); // const position =parseInt(this.props.match.params.position); @@ -239,50 +239,52 @@ class Coursesleftnav extends Component{ setnavid=(e,key,id,type,url)=>{ // this.props.getleftNavid && this.props.getleftNavid(key,type); - let {selectnavid,navid}=this.state; - - if(navidtype===true&&selectnavid===false){ - - if(navid===key){ - this.setState({ - navid:"", - selectnavid:false, - newselectnavid:id - }) - }else{ - this.setState({ - navid:key, - positiontype:type, - selectnavid:false, - newselectnavid:id - }) - } - }else{ - // console.log(navidtype) - // console.log(selectnavid) - this.setState({ - navid:"", - selectnavid:false, - newselectnavid:id - }) - } - this.props.updataleftNavfun(); - this.props.history.replace( url ); - e.stopPropagation();//阻止冒泡 + // let {selectnavid,navid}=this.state; + // + // if(navidtype===true&&selectnavid===false){ + // + // if(navid===key){ + // this.setState({ + // navid:"", + // selectnavid:false, + // newselectnavid:id + // }) + // }else{ + // this.setState({ + // navid:key, + // positiontype:type, + // selectnavid:false, + // newselectnavid:id + // }) + // } + // }else{ + // // console.log(navidtype) + // // console.log(selectnavid) + // this.setState({ + // navid:"", + // selectnavid:false, + // newselectnavid:id + // }) + // } + // + // this.props.updataleftNavfun(); + // this.props.history.replace( url ); + // e.stopPropagation();//阻止冒泡 + this.selectnavid(e,key,id,type,url) } selectnavid=(e,key,id,type,urls,index)=>{ let {url}=this.state; if(urls!=url){ - + this.props.updataleftNavfun(); this.props.history.replace(urls); - this.props.updataleftNavfun(); }else{ if (key === this.props.indexs) { this.props.unlocationNavfun(undefined) } else { + this.props.updataleftNavfun(); this.props.unlocationNavfun(key) this.props.history.replace(urls); } @@ -304,8 +306,9 @@ class Coursesleftnav extends Component{ url:urls, indexs:index }) + this.props.updataleftNavfun(); this.props.history.replace(urls); - this.props.updataleftNavfun(); + } @@ -721,24 +724,27 @@ class Coursesleftnav extends Component{ e.stopPropagation();//阻止冒泡 } - showsandians=(e,key,urls,num)=> { + showsandians=(e,key,urls,num,id,type,index)=> { let {url}=this.state; if (key === this.props.indexs) { this.props.unlocationNavfun(undefined) this.props.history.replace(urls); } else { + this.props.updataleftNavfun(); this.props.unlocationNavfun(key) this.props.history.replace(urls); } if(urls!=url){ + this.props.updataleftNavfun(); this.props.history.replace(urls); } - // if(this.props.indexs===undefined){ - // - // }else{ - // - // } + this.setState({ + selectnavid:true, + newselectnavid:id, + url:urls, + indexs:index + }) } maincontent=(item,key)=>{ @@ -930,8 +936,8 @@ class Coursesleftnav extends Component{ return(