默认显示当期开课

dev_hs
杨树明 6 years ago
parent 8f9db17c91
commit ed78052620

@ -30,38 +30,41 @@ class DetailTop extends Component{
}
}
componentDidMount(){
let courseslist=[]
this.getdatalist();
}
getdatalist=()=>{
let courseslist=[];
let keys=1;
if(this.props.courses!=undefined&&this.props.courses.length!=0){
this.props.courses.map((item,key)=>{
if(this.props.pathtopskey===key+1){
return(
courseslist.push(item)
)
}
})
if(this.props.detailInfoList.has_start===true){
this.props.courses.map((item,key)=>{
if(item.course_status.status===1){
keys=key+1
return(
courseslist.push(item)
)
}
})
}else{
this.props.courses.map((item,key)=>{
if(this.props.pathtopskey===key+1){
keys=key+1
return(
courseslist.push(item)
)
}
})
}
}
this.setState({
courseslist:courseslist
courseslist:courseslist,
MenuItemskey:keys,
})
}
componentDidUpdate=(prevProps)=> {
if(prevProps.courses!=this.props.courses){
let courseslist=[]
if(this.props.courses!=undefined&&this.props.courses.length!=0){
this.props.courses.map((item,key)=>{
if(this.props.pathtopskey===key+1){
return(
courseslist.push(item)
)
}
})
}
this.setState({
courseslist:courseslist
})
this.getdatalist();
}
}

Loading…
Cancel
Save