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(
-
  • this.showsandians(e,key,item.category_url,1)} className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}> - this.showsandians(e,key,item.category_url,1)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}> +
  • this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={this.props.mainurl===item.category_url?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}> + this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}> { item.type==="announcement"?: item.type==="online_learning"?: @@ -976,7 +982,7 @@ class Coursesleftnav extends Component{ ref={provided.innerRef} {...provided.droppableProps} className={"droppableul"} - style={{display: this.props.mainurl===item.category_url&&key===this.props.indexs?"":"none"}} + style={{display: key===this.props.indexs?"":"none"}} > {item.second_category===undefined?"":item.second_category.map((iem,index)=>{ if(item.type==="course_group"){ @@ -1039,12 +1045,15 @@ class Coursesleftnav extends Component{ }) : course_modules===undefined?"":course_modules.map((item,key)=>{ - + if(key===this.props.indexs){ + console.log(key) + console.log(this.props.indexs) + } return(
    {/**/} -
  • this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)} title={item.name.length<7?"":item.name} > @@ -1069,11 +1078,8 @@ class Coursesleftnav extends Component{
  • - {/**/} - {/*下拉列表*/} - {/* className={this.props.location.pathname===item.category_url||this.props.location.pathname===this.state.url&&key===this.state.indexs?"":""}*/} -