import React, { Component } from 'react'; import style from './index.less'; import delIcon from '@common/images/del_nor.png'; import {windowEventHandler,getCurrentDate,getWindowInnerHeight} from '@utils/tools' class MedicalInfo extends Component { constructor(props) { super(props); this.$inp = React.createRef(); this.$cont = React.createRef(); this.state={ val:'' }; this.search = this.search.bind(this); this.handleChange = this.handleChange.bind(this); this.clear = this.clear.bind(this); this.getSearchList = this.getSearchList.bind(this); } getSearchList() { const { getAllConceptDetail,searchResult } = this.props; return searchResult && searchResult.map((item) => { return
  • getAllConceptDetail({name: item.name, type: item.type})}> {item.name} ( {item.libTypeName} )
  • ; }); } search(){ const {handleChangeValue} = this.props; const val = this.$inp.current.value; handleChangeValue&&handleChangeValue(val); } handleChange(){ console.log('change') this.setState({ val:this.$inp.current.value }); } clear(){ this.$inp.current.value = ''; this.setState({ val:'' }); } componentDidMount(){ const height = getWindowInnerHeight()-170; this.$cont.current.style.height = height+"px"; if(this.$cont.current){ windowEventHandler('resize', ()=>{ const height = getWindowInnerHeight()-170; this.$cont.current.style.height = height+"px"; }); } } render() { const {searchResult} = this.props; const {val} = this.state; return (

    医学知识搜索

    {val?清空:''}

    {searchResult&&searchResult.length>0?

    查询内容

      {this.getSearchList()}
    :

    暂无搜索结果!

    }
    ) } } export default MedicalInfo;