|
|
@ -31,33 +31,34 @@ class InfosTopics extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount(){
|
|
|
|
componentDidMount(){
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
// let types=this.props.match.params.topicstype;
|
|
|
|
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
|
|
|
|
// let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
|
|
|
|
|
|
|
|
//
|
|
|
|
if(professional_certification===false&&types==="publicly"){
|
|
|
|
// if(professional_certification===false&&types==="publicly"){
|
|
|
|
this.setState({
|
|
|
|
// this.setState({
|
|
|
|
isshowprofes:true
|
|
|
|
// isshowprofes:true
|
|
|
|
})
|
|
|
|
// })
|
|
|
|
}else{
|
|
|
|
// }else{
|
|
|
|
this.updataslist()
|
|
|
|
// this.updataslist()
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
this.updataslist()
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(prevProps.current_user!=this.props.current_user){
|
|
|
|
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
|
|
|
|
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(professional_certification)
|
|
|
|
|
|
|
|
if(professional_certification===false&&types==="publicly"){
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
isshowprofes:true
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
this.updataslist()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// componentDidUpdate(prevProps) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if(prevProps.current_user!=this.props.current_user){
|
|
|
|
|
|
|
|
// let types=this.props.match.params.topicstype;
|
|
|
|
|
|
|
|
// let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// console.log(professional_certification)
|
|
|
|
|
|
|
|
// if(professional_certification===false&&types==="publicly"){
|
|
|
|
|
|
|
|
// this.setState({
|
|
|
|
|
|
|
|
// isshowprofes:true
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
// this.updataslist()
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
updataslist=()=>{
|
|
|
|
updataslist=()=>{
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
|
|
|
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
|
|
@ -65,39 +66,12 @@ class InfosTopics extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{
|
|
|
|
searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{
|
|
|
|
|
|
|
|
|
|
|
|
// if(this.props.current_user.login!=this.props.match.params.username){
|
|
|
|
|
|
|
|
// return
|
|
|
|
|
|
|
|
// }else{
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
|
|
|
|
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(professional_certification===false&&types==="publicly"){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
isSpin:true
|
|
|
|
isSpin:true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
let types=this.props.match.params.topicstype;
|
|
|
|
|
|
|
|
let user_id="";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(types==="publicly"){
|
|
|
|
|
|
|
|
user_id=this.props.current_user&&this.props.current_user.login;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
user_id=this.props.match.params&&this.props.match.params.username;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(user_id===undefined){
|
|
|
|
|
|
|
|
user_id=1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let {per_page}=this.state;
|
|
|
|
let {per_page}=this.state;
|
|
|
|
let url=`/users/${user_id}/question_banks.json`;
|
|
|
|
let url=`/users/question_banks.json`;
|
|
|
|
|
|
|
|
|
|
|
|
axios.get(encodeURI(url),{params:{
|
|
|
|
axios.get(encodeURI(url),{params:{
|
|
|
|
type,
|
|
|
|
type,
|
|
|
@ -109,19 +83,33 @@ class InfosTopics extends Component{
|
|
|
|
per_page
|
|
|
|
per_page
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).then((response) => {
|
|
|
|
}).then((response) => {
|
|
|
|
this.setState({
|
|
|
|
if(response){
|
|
|
|
data:response.data,
|
|
|
|
if(response.status){
|
|
|
|
checkBoxValues:[],
|
|
|
|
if(response.data.status == -2){
|
|
|
|
isSpin:false
|
|
|
|
this.setState({
|
|
|
|
})
|
|
|
|
isshowprofes:true,
|
|
|
|
|
|
|
|
isSpin:false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}else if(response.data.status === 403||response.data.status === 401||response.data.status === 500){
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
isSpin:false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
data:response.data,
|
|
|
|
|
|
|
|
checkBoxValues:[],
|
|
|
|
|
|
|
|
isSpin:false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
isSpin:false
|
|
|
|
isSpin:false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
searchCategory=(type)=>{
|
|
|
|
searchCategory=(type)=>{
|
|
|
|