题库权限调整联调

dev_hss
杨树明 6 years ago
parent 93af3c7872
commit 1cd5e2dc9a

@ -62,7 +62,7 @@ module.exports = {
// We generate sourcemaps in production. This is slow but gives good results. // We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment. // You can exclude the *.map files from the build during deployment.
// devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版 // devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
devtool: shouldUseSourceMap ? 'source-map' : 'source-map',//测试版 devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
// In production, we only want to load the polyfills and the app code. // In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs], entry: [require.resolve('./polyfills'), paths.appIndexJs],
output: { output: {

@ -31,8 +31,8 @@ class InfosBanner extends Component{
let user_type=this.props.current_user&&this.props.current_user.user_identity; let user_type=this.props.current_user&&this.props.current_user.user_identity;
let targetuserid=this.props.data&&this.props.data.id; let targetuserid=this.props.data&&this.props.data.id;
// console.log(is_current) // console.log(is_current)
// console.log(current_user) // console.log(current_user)
// console.log(current_user.is_teacher) // console.log(current_user.is_teacher)
// console.log(current_user.admin) // console.log(current_user.admin)
return( return(
@ -124,7 +124,7 @@ class InfosBanner extends Component{
</li>} </li>}
{/*自己的主页且不是学生显示题库按钮*/} {/*自己的主页且不是学生显示题库按钮*/}
{((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin) {(is_current && current_user)
&&<li className={`${moduleName == 'topics' ? 'active' : '' }`}> &&<li className={`${moduleName == 'topics' ? 'active' : '' }`}>
<Link <Link
onClick={() => this.setState({moduleName: 'topics'})} onClick={() => this.setState({moduleName: 'topics'})}

@ -103,7 +103,7 @@ class InfosCourse extends Component{
} = this.state; } = this.state;
let is_current=this.props.is_current; let is_current=this.props.is_current;
console.log(this.props.current_user&&this.props.current_user.user_identity==="学生") // console.log(this.props.current_user&&this.props.current_user.user_identity==="学生")
return( return(
<div className="educontent"> <div className="educontent">
<Spin size="large" spinning={isSpin}> <Spin size="large" spinning={isSpin}>

@ -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)=>{

Loading…
Cancel
Save