import React, { Component } from 'react'; import { Select, Input,Menu, Dropdown } from 'antd'; import 'antd/lib/style/index.css'; import 'antd/lib/select/style/index.css'; import 'antd/lib/input/style/index.css'; import './shixunCss/ShixunSearchBar.css'; import axios from 'axios'; const $ = window.$; const Option = Select.Option; const Search = Input.Search; class ShixunSearchBar extends Component { constructor(props) { super(props) this.state = { status: undefined, diff: 0, InputValue: undefined, shixunhoverData: [], shixunchildValues:'', shixunsearchAllvalue:"a", openStatus:false, openLevel:false } } //状态筛选 status_search = (value) => { let newvalue = value; if (newvalue === "0") { newvalue = " " } else if (newvalue === "1") { newvalue = 2 } else if (newvalue === "2") { newvalue = 1 } else if (newvalue === "3") { newvalue = 3 } this.setState({ status: newvalue, openStatus:false }) let list = [{'type': 1}, {'value': newvalue}]; this.props.StatusEnquiry(list); } //难度筛选 diff_search = (value) => { this.setState({ diff: value, openLevel:false }) let list=[{'type':2},{'value':value}]; this.props.StatusEnquiry(list); } //输入框搜索 Input_search = (value) => { this.setState({ InputValue: value }) this.props.OnSearchInput(value); } //查询 shixunsearchAll = (e) => { let{shixunsearchAllvalue}=this.state; let id = e.target.value; if(shixunsearchAllvalue===id){ return } if(id===0){ id=" " this.setState({ InputValue: " " }) this.props.OnSearchInput(""); } let list=[{'tag_level':1},{'tag_id':id}]; if(id!=undefined){ this.setState({ shixunsearchAllvalue:id, shixunchildValues:"" }) this.props.Updatasearchlist(list); } } shixunsearchall=(e)=>{ let{shixunsearchAllvalue}=this.state; let id = "a"; if(shixunsearchAllvalue===id){ return } this.setState({ shixunsearchAllvalue:"a", shixunchildValues:"" }) this.props.allUpdatashixunlist(); } //选择Tab页详情 getshixunchildValue = (e) => { let id = e.target.name; let newid=e.target.id; let list=[{'tag_level':2},{'tag_id':id}]; if(id!=undefined||newid!=undefined){ this.setState({ shixunsearchAllvalue:newid }) this.props.Updatasearchlist(list); } } getshixunchildValues = (e) => { let id = e.target.id; let newid=e.target.name; let list=[{'tag_level':3},{'tag_id':id}]; if(id!=undefined||newid!=undefined){ this.setState({ shixunchildValues:id, shixunsearchAllvalue:newid }) this.props.Updatasearchlist(list); } } componentDidMount() { let hoverUrlArr = []; let hoverUrl = `/shixuns/menus.json`; axios.get(hoverUrl ).then((response) => { hoverUrlArr = response.data; // hoverUrlArr.reverse(); this.setState({ shixunhoverData: hoverUrlArr }) }).catch((error) => { console.log(error) }) } render() { let {shixunhoverData, shixunchildValues, shixunsearchAllvalue, InputValue,openStatus,openLevel} = this.state; let {typepvisible} = this.props; // //实训首页筛选的移入和点击事件 // $(".shaiItem").hover(function(){ // var hei=parseInt($(".shaiAllItem").height())-2; // $(this).find(".subshaicontent").css("top", '34px'); // $(this).find(".subshaicontent").show(); // },function(){ // $(this).find(".subshaicontent").hide(); // }); // // $(".shaiItem").live("click",function(){ // $(".shaiItem").removeClass("active"); // $(this).addClass("active"); // $(".subshaicontent").hide(); // }); // // $(".subshaicontent").live("click", function(event){ // $(".subshaicontent").hide(); // event.stopPropagation(); // }); let overlaymenu=(item,id)=>(
) return (