import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl} from 'educoder'; import axios from 'axios'; import { notification, Spin, Table, Pagination, Tabs, Input, Popover, Tooltip } from "antd"; import './../questioncss/questioncom.css'; import NoneDatas from '../component/NoneDatas'; import LoadingSpin from '../../../common/LoadingSpin'; import Contentquestionbank from "./Contentquestionbank"; import Listjihe from "./Listjihe"; import Certifiedprofessional from "../../modals/Certifiedprofessional"; import QuestionModalPicture from '../component/QuestionModalPicture.js' const { TabPane } = Tabs; const Search = Input.Search; class Contentpart extends Component { constructor(props) { super(props); this.state = { page:1, chakanjiexibool:false, mydisplay:false, occupation:2, url: "", isysladmins:false, } } //初始化 componentDidMount(){ 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 }) } handleShowUploadImage = (url) => { // console.log('==============>>>>>>>>>>>>',url); // setUrl(url); this.setState({ url:url }) } handleClose=()=>{ this.setState({ url:'', }) } chakanjiexibool=(index)=>{ if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } this.props.chakanjiexibool(index); } showmodels=(e)=>{ if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } this.props.showmodels(e) } showmodelsInaudit=(e)=>{ if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } this.props.showmodelsInaudit(e) } showmodelysl=(e)=>{ if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } this.props.showmodelysl(e) } 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; var 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) { } this.setState({ isysladmins:isysladmins }) if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ defaultActiveKeys="1" } this.props.callback(defaultActiveKeys); } } HideAddcoursestypess=(i)=>{ console.log("调用了"); this.setState({ mydisplay:true, occupation:i, }) } mydisplayHidedel=()=>{ this.setState({ mydisplay:false, }) } xinzenw=(e)=>{ //只限制了教师 if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ this.HideAddcoursestypess(2); return } var urls=""; if(this.props.discipline_id){ // if(urls==="?"){ // urls=urls+`discipline_id=${this.props.discipline_id}` // }else { urls=urls+`&discipline_id=${this.props.discipline_id}` // } } if(this.props.sub_discipline_id){ // if(urls==="?"){ // urls=urls+`sub_discipline_id=${this.props.sub_discipline_id}` // }else { urls=urls+`&sub_discipline_id=${this.props.sub_discipline_id}` // } } if(this.props.tag_discipline_id){ // if(urls==="?"){ // urls=urls+`sub_discipline_id=${this.props.tag_discipline_id}` // }else { urls=urls+`&sub_discipline_id=${this.props.tag_discipline_id}` // } } if(this.props.difficulty){ // if(urls==="?"){ // urls=urls+`difficulty=${this.props.difficulty}&` // }else { urls=urls+`&difficulty=${this.props.difficulty}` // } } if(this.props.item_type){ // if(urls==="?"){ // urls=urls+`item_type=${this.props.item_type}` // }else { urls=urls+`&item_type=${this.props.item_type}` // } } this.props.history.push("/question/newitem?pages="+this.props.pages+urls); } render() { let {page,mydisplay,url}=this.state; let {defaultActiveKey,item_type,booljupyterurls}=this.props; const 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(is_teacher===false){ if(this.props.current_user.user_identity !=="学生"){ //专业人士 is_teacher=true } } 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; } } } }catch (e) { } const content = (

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

this.props.setitem_types("SINGLE")}>单选题

this.props.setitem_types("MULTIPLE")}>多选题

this.props.setitem_types("JUDGMENT")}>判断题

this.props.setitem_types("PROGRAM")}>编程题

); const contents = (

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

this.props.setoj_status(0)}>未发布

this.props.setoj_status(1)}>已发布

); // console.log("Contentpart.js"); // console.log(this.props.current_user.professional_certification); return (
{url? this.handleClose()}> : "" } { mydisplay===true? :"" } { mydisplay===true? :"" }
{ isysladmins===true||is_teacher===true? this.props.callback(e)}> : this.props.callback(e)}> }
{ defaultActiveKey===0||defaultActiveKey==="0"? isysladmins===true||is_teacher===true? this.props.Isitapopup&&this.props.Isitapopup==="true"? "" : this.xinzenw(e)}>

新增

:"" :"" } {item_type==="PROGRAM"? defaultActiveKey===0||defaultActiveKey==="0"? trigger.parentNode} placement="bottom" trigger="hover" content={contents} onVisibleChange={()=>this.props.handleVisibleChange(true)}>
全部
: "":"" } { defaultActiveKey===0||defaultActiveKey==="0"? this.props.Isitapopup&&this.props.Isitapopup==="true"? this.props.setdatafunsval(e)} onSearch={ (value)=>this.props.setdatafuns(value)} /> : this.props.setdatafunsval(e)} onSearch={ (value)=>this.props.setdatafuns(value)} /> : this.props.setdatafunsval(e)} onSearch={ (value)=>this.props.setdatafuns(value)} /> }
{/*内容*/} { this.props.Contentdata.items === undefined ||this.props.Contentdata.items === null||this.props.Contentdata.items.length===0 ?
:
{ defaultActiveKey===1||defaultActiveKey==="1"? this.props.selectallquestionsonthispage(bool)} > :"" } { defaultActiveKey===0||defaultActiveKey==="0"? this.props.selectallquestionsonthispage(bool)}> :"" }
}
{/*列表集合*/}
{ this.props.booljupyterurls===true? : this.props.Contentdata.items === undefined ||this.props.Contentdata.items === null||this.props.Contentdata.items.length===0? : this.props.Contentdata.items.map((object, index) => { return ( this.chakanjiexibool(keindex)} listjihe={index+1} keindex={index} items={object} key={index} pages={this.props.pages} getitem_basketss={(id)=>this.props.getitem_basketss(id)} getitem_baskets={(e)=>this.props.getitem_baskets(e)} showmodels={(e)=>this.showmodels(e)} showmodelysl={(e)=>this.showmodelysl(e)} showmodelsInaudit={(e)=>this.showmodelsInaudit(e)} handleShowUploadImage={(e)=>this.handleShowUploadImage(e)} handleClose={()=>this.handleClose()} > ) })}
) } } export default Contentpart