|
@@ -1,44 +1,45 @@
|
|
|
import React, { Component } from 'react';
|
|
|
import style from './index.less';
|
|
|
-import { SearchOption } from '@commonComp';
|
|
|
import {windowEventHandler,getCurrentDate,getWindowInnerHeight} from '@utils/tools'
|
|
|
|
|
|
class MedicalInfo extends Component {
|
|
|
constructor(props) {
|
|
|
- super(props)
|
|
|
- this.$cont = React.createRef();
|
|
|
+ super(props);
|
|
|
+ this.$inp = React.createRef();
|
|
|
+ this.search = this.search.bind(this);
|
|
|
}
|
|
|
-
|
|
|
- componentDidMount() {
|
|
|
- const height = getWindowInnerHeight() - 200;
|
|
|
- this.$cont.current.style.height = height + "px";
|
|
|
-
|
|
|
- windowEventHandler('resize', ()=>{
|
|
|
- const height = getWindowInnerHeight() - 200;
|
|
|
- this.$cont.current.style.height = height + "px";
|
|
|
- });
|
|
|
+ getSearchList() {
|
|
|
+ const { getAllConceptDetail,searchResult } = this.props;
|
|
|
+ return searchResult && searchResult.map((item) => {
|
|
|
+ return <li key={item.conceptId} onClick={() =>getAllConceptDetail({name: item.name, type: item.type})}>
|
|
|
+ <span>{item.name}</span>
|
|
|
+ <i>( {item.libTypeName} )</i>
|
|
|
+ <button>查看</button>
|
|
|
+ </li>;
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
- getSearchList(searchResult) {
|
|
|
- const { getAllConceptDetail } = this.props
|
|
|
- return <div className={style['search-result']}>
|
|
|
- {
|
|
|
- searchResult && searchResult.map((item) => {
|
|
|
- return (<div key={item.conceptId} className={style['search-result-item']} onClick={() =>getAllConceptDetail({name: item.name, type: item.type})}>{item.name + '('+ item.libTypeName + ')'}</div>)
|
|
|
- })
|
|
|
- }
|
|
|
- </div>
|
|
|
+ search(){
|
|
|
+ const {handleChangeValue} = this.props;
|
|
|
+ const val = this.$inp.current.value;
|
|
|
+ handleChangeValue&&handleChangeValue(val);
|
|
|
}
|
|
|
render() {
|
|
|
- const {searchResult, handleChangeValue,pageTop,windowHeight } = this.props
|
|
|
+ const {searchResult} = this.props;
|
|
|
return (
|
|
|
<div className={style['mefical-info-wrapper']}>
|
|
|
- <div ref={this.$cont}>
|
|
|
- <SearchOption handleChangeValue={handleChangeValue} pageTop={pageTop} windowHeight={windowHeight} height={180} visible={true}>
|
|
|
- {this.getSearchList(searchResult)}
|
|
|
- </SearchOption>
|
|
|
+ <div className={style['search-cont']}>
|
|
|
+ <p className={style['title']}>医学知识搜索</p>
|
|
|
+ <p>
|
|
|
+ <input type="text" className={style['input']} ref={this.$inp}/>
|
|
|
+ <button onClick={this.search}>搜索</button>
|
|
|
+ </p>
|
|
|
+ {searchResult&&searchResult.length>0?<div className={style['result']}>
|
|
|
+ <p className={style['title']}>查询内容</p>
|
|
|
+ <ul>
|
|
|
+ {this.getSearchList()}
|
|
|
+ </ul>
|
|
|
+ </div>:<p className={style['no-data']}>暂无搜索结果!</p>}
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
|
|
|
)
|