import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl} from 'educoder'; import axios from 'axios'; import './../questioncss/questioncom.css'; import { Select, Input,Menu, Dropdown,notification, Spin, Table, Pagination} from 'antd'; import 'antd/lib/style/index.css'; import 'antd/lib/select/style/index.css'; import 'antd/lib/input/style/index.css'; import '../../tpm/shixuns/shixunCss/ShixunSearchBar.css'; const $ = window.$; const Option = Select.Option; const Search = Input.Search; class Headplugselections extends Component { constructor(props) { super(props); this.state = { page:1, titlestting:"全部", titlesttingid:null, titlesttings:null, titlesttingss:null, status: undefined, diff: null, InputValue: undefined, shixunhoverData: [], shixunchildValues:'', shixunsearchAllvalue:"a", openStatus:false, openLevel:false, tixing:null, } } //初始化 componentDidMount(){ } settitlestting=(name,id)=>{ //如果全部其他的选项重置 this.setState({ titlestting:name, titlesttingid:id, titlesttings:null, titlesttingsid:null, titlesttingss:null, titlesttingssid:null }) if(name==="全部"){ this.props.setdiscipline_id(null); }else{ this.props.setdiscipline_id(id); } } shixunsearchall=(id)=>{ this.setState({ shixunsearchAllvalue:id, shixunchildValues:"" }) try { this.props.setdiscipline_id(null); }catch (e) { } } shixunserdchAlls=(itme,id)=>{ if(id!=undefined){ this.setState({ shixunsearchAllvalue:id, }) try { this.props.setdiscipline_id(id); }catch (e) { } } // console.log(itme); // console.log(itme[0]); if(itme!=undefined){ try { this.props.setsub_discipline_id(id,itme[0].id); }catch (e) { } } } //获取方向 shixunsearchAll = (id) => { //大写A //console.log("获取方向"); //console.log(id); if(id!=undefined){ this.setState({ shixunsearchAllvalue:id, }) try { this.props.setdiscipline_id(id); }catch (e) { } } } //难度筛选 diff_search = (value) => { this.setState({ diff: value, openLevel:false }) try { this.props.setdifficulty(value); }catch (e) { } } //题型塞选 settixingtixing=(value)=>{ this.setState({ tixing: value, }) try { this.props.setitem_types(value); }catch (e) { } } getshixunchildValue = (id,ids) => { // //console.log("getshixunchildValue"); // console.log(id); // console.log(ids); // debugger if(id!=undefined ||ids!=undefined){ this.setState({ shixunsearchAllvalue:ids }) try { this.props.setsub_discipline_id(ids,id); }catch (e) { } } } render() { let {shixunhoverData, shixunchildValues, shixunsearchAllvalue, InputValue,openStatus,openLevel} = this.state; let {disciplinesdata} = this.props; let overlaymenu=(item,id)=>( { item&&item.map((list,k)=>{ return(
this.getshixunchildValue(list.id,id)}>{list.name}
) }) }
) return (
{/*课程*/}
方向:
  • this.shixunsearchall("a")}>全部
  • { disciplinesdata&&disciplinesdata.map((item,key)=>{ return( item.sub_disciplines.length>0? trigger.parentNode} overlay={ overlaymenu(item.sub_disciplines,item.id)} key={key} placement={"bottomRight"}>
  • this.shixunserdchAlls(item.sub_disciplines,item.id)}> {item.name}
  • :
  • this.shixunsearchAll(item.id)}> {item.name}
  • ) }) }
    {/*题型*/}
    题型: { }
  • this.settixingtixing(null)}>全部
  • this.settixingtixing("PROGRAM")}>编程题
  • this.settixingtixing("SINGLE")}>单选题
  • this.settixingtixing("MULTIPLE")}>多选题
  • this.settixingtixing("JUDGMENT")}>判断题
  • {/*题型结尾*/} {/*难度*/}
    难度: { }
  • this.diff_search(null)}>全部
  • this.diff_search(1)}>简单
  • this.diff_search(2)}>适中
  • this.diff_search(3)}>困难
  • {/*难度结尾*/}
    {/*课程尾巴*/}
    ) } } export default Headplugselections ;