import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl,queryString} from 'educoder'; import axios from 'axios'; import { notification, Spin, Table, Pagination, Tabs, Input, Popover } from "antd"; import './../testioncss/testioncss.css'; import NoneDatas from '../component/NoneDatas'; import Contentquestionbank from "./Contentquestionbank"; import LoadingSpin from '../../../common/LoadingSpin'; import Listjihe from "./Listjihe"; import Certifiedprofessional from "../../modals/Certifiedprofessional"; const { TabPane } = Tabs; const Search = Input.Search; class Contentpart extends Component { constructor(props) { super(props); this.state = { page:1, defaultActiveKeyss:"0", mydisplay:false, occupation:2, isysladmins:false, } } //初始化 componentDidMount(){ const query = this.props.location.search; const parsed = queryString.parse(query); console.log("Contentpart"); console.log(parsed); if(JSON.stringify(parsed)==="{}"){ this.setState({ defaultActiveKeyss:"0", }) }else { if(parsed.defaultActiveKey==="0"){ this.setState({ defaultActiveKeyss:"0", }) }else{ this.setState({ defaultActiveKeyss:"1", }) } } let isysladmins=false; if(this.props){ if(this.props.current_user){ if(this.props.current_user.admin){ isysladmins=true; } else if(this.props.current_user.business){ isysladmins=true; } } } this.setState({ isysladmins:isysladmins }) } //跳转人工组卷 Mantegeneration=()=>{ this.props.history.push('/question'); } componentDidUpdate(prevProps) { if(prevProps.current_user !== this.props.current_user) { let isysladmins=false; let is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; let {defaultActiveKey} = this.props; let defaultActiveKeys=defaultActiveKey; try { if(this.props){ if(this.props.current_user){ if(this.props.current_user.admin){ isysladmins=true; } else if(this.props.current_user.business){ isysladmins=true; } } } if(is_teacher===false){ if(this.props.current_user.user_identity !=="学生"){ //专业人士 is_teacher=true } } }catch (e) { } if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ defaultActiveKeys="1" } try { if(this.props.defaultActiveKeybool===false){ if (this.state.defaultActiveKeyss==="0"){ defaultActiveKeys="0" } else { defaultActiveKeys="1" } } }catch (e) { } this.props.callback(defaultActiveKeys,false); } } HideAddcoursestypess=(i)=>{ console.log("调用了"); this.setState({ mydisplay:true, occupation:i, }) } mydisplayHidedel=()=>{ this.setState({ mydisplay:false, }) } xinzenw=(url)=>{ //只限制了教师 if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } this.props.history.push(url); } HideAddcoursestypess=(i)=>{ console.log("调用了"); this.setState({ mydisplay:true, occupation:i, }) } mydisplayHidedel=()=>{ this.setState({ mydisplay:false, }) } Testpapereditor=(e)=>{ if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } this.props.Testpapereditor(e) } showmodels=(e)=>{ if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } this.props.showmodels(e) } showmodelysl=(e)=>{ if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } this.props.showmodelysl(e) } showmodelsInaudit=(e)=>{ if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } this.props.showmodelsInaudit(e) } render() { let {page,defaultActiveKeyss,mydisplay}=this.state; let {defaultActiveKey,defaultActiveKeybool}=this.props; let defaultActiveKeys=defaultActiveKey+''; let isysladmins=false; let is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; try { if(this.props){ if(this.props.current_user){ if(this.props.current_user.admin){ isysladmins=true; } else if(this.props.current_user.business){ isysladmins=true; } } } if(is_teacher===false){ if(this.props.current_user.user_identity !=="学生"){ //专业人士 is_teacher=true } } }catch (e) { } const contents = (

this.props.setdifficulty(null)}>全部

this.props.setdifficulty(1)}>简单

this.props.setdifficulty(2)}>适中

this.props.setdifficulty(3)}>困难

); if(defaultActiveKeybool===false){ if(defaultActiveKeyss==="0"){ defaultActiveKeys="0"; }else { defaultActiveKeys="1"; } } return (
{ mydisplay===true? :"" } { mydisplay===true? :"" }
{ isysladmins===true||is_teacher===true? this.props.callback(e,true)}> : this.props.callback(e,true)}> }
this.props.setdatafunsval(e)} onSearch={ (value)=>this.props.setdatafuns(value)} value={this.props.keyword} /> { isysladmins===true||is_teacher===true? :"" }
{/*内容*/} { this.props.Contentdata.exams === undefined ||this.props.Contentdata.exams === null||this.props.Contentdata.exams.length===0 ?
:
{ defaultActiveKey===1||defaultActiveKey==="1"? :"" } { defaultActiveKey===0||defaultActiveKey==="0"? :"" }
}
{/*列表集合*/}
{ this.props.booljupyterurls===true? : this.props.Contentdata.exams === undefined ||this.props.Contentdata.exams === null||this.props.Contentdata.exams.length===0? : this.props.Contentdata.exams.map((object, index) => { return ( this.Testpapereditor(e)} showmodels={(e)=>this.showmodels(e)} showmodelysl={(e)=>this.showmodelysl(e)} Isitapopup={this.props.Isitapopup} showmodelsInaudit={(e)=>this.props.showmodelsInaudit(e)} > ) })}
) } } export default Contentpart