|
|
|
@ -238,6 +238,37 @@ class Coursesleftnav extends Component{
|
|
|
|
|
this.props.updataleftNavfun()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidUpdate=(prevProps)=>{
|
|
|
|
|
if(prevProps!=this.props){
|
|
|
|
|
let courstype=this.props.match.url;
|
|
|
|
|
courstype = courstype.split('/');
|
|
|
|
|
courstype=courstype[3];
|
|
|
|
|
const query =this.props.location.search;
|
|
|
|
|
let category_id;
|
|
|
|
|
if(courstype==="board"){
|
|
|
|
|
category_id=parseInt(this.props.match.params.boardId);
|
|
|
|
|
}else{
|
|
|
|
|
category_id=parseInt(this.props.match.params.category_id);
|
|
|
|
|
}
|
|
|
|
|
if(query===""){
|
|
|
|
|
this.setState({
|
|
|
|
|
positiontype:courstype,
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
if(isNaN(category_id)){
|
|
|
|
|
this.setState({
|
|
|
|
|
positiontype:courstype,
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.setState({
|
|
|
|
|
positiontype:courstype,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setnavid=(e,key,id,type,url)=>{
|
|
|
|
|
// this.props.getleftNavid && this.props.getleftNavid(key,type);
|
|
|
|
|
// let {selectnavid,navid}=this.state;
|
|
|
|
@ -493,7 +524,8 @@ class Coursesleftnav extends Component{
|
|
|
|
|
navidtype=true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveNavmodapost=(url,value)=>{
|
|
|
|
|
saveNavmodapost=(url,value,positiontype,coursesId)=>{
|
|
|
|
|
|
|
|
|
|
axios.post(url,
|
|
|
|
|
{name:value}).then((result)=>{
|
|
|
|
|
if(result.data.status===0){
|
|
|
|
@ -505,6 +537,10 @@ class Coursesleftnav extends Component{
|
|
|
|
|
description:result.data.message
|
|
|
|
|
});
|
|
|
|
|
trigger('updateNavSuccess')
|
|
|
|
|
if(positiontype==="files"){
|
|
|
|
|
window.location.href=`/courses/${coursesId}/file/${result.data.category_id}`;
|
|
|
|
|
// this.props.history.push(`/courses/${coursesId}/file/${result.data.category_id}`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error)
|
|
|
|
@ -556,9 +592,8 @@ class Coursesleftnav extends Component{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(Navmodaltypename===1){
|
|
|
|
|
|
|
|
|
|
let url="/course_modules/"+id+"/add_second_category.json"
|
|
|
|
|
this.saveNavmodapost(url,NavmodalValue)
|
|
|
|
|
this.saveNavmodapost(url,NavmodalValue,this.state.positiontype,this.props.match.params.coursesId)
|
|
|
|
|
|
|
|
|
|
} else if(Navmodaltypename===2){
|
|
|
|
|
|
|
|
|
|