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"; const { TabPane } = Tabs; const Search = Input.Search; class Contentpart extends Component { constructor(props) { super(props); this.state = { page:1, chakanjiexibool:false, } } //初始化 componentDidMount(){ } chakanjiexibool=(index)=>{ this.props.chakanjiexibool(index); } componentDidUpdate(prevProps) { if(prevProps.current_user !== this.props.current_user) { debugger const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; const 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; if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ defaultActiveKeys="1" } this.props.callback(defaultActiveKeys); } } xinzenw=(e)=>{ 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"+urls); } render() { let {page}=this.state; let {defaultActiveKey,item_type,booljupyterurls}=this.props; const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; const 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; 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.defaultActiveKey); return (
{ isysladmins===true||(is_teacher===true&&professional_certification===true)? this.props.callback(e)}> : this.props.callback(e)}> }
{ defaultActiveKey===0||defaultActiveKey==="0"? isysladmins===true||(is_teacher===true&&professional_certification===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()} > :"" } { defaultActiveKey===0||defaultActiveKey==="0"? this.props.selectallquestionsonthispage()}> :"" }
}
{/*列表集合*/}
{ 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} getitem_basketss={(id)=>this.props.getitem_basketss(id)} getitem_baskets={(e)=>this.props.getitem_baskets(e)} showmodels={(e)=>this.props.showmodels(e)} showmodelysl={(e)=>this.props.showmodelysl(e)}> ) })}
) } } export default Contentpart