|
@@ -1,6 +1,7 @@
|
|
import React, { Component } from 'react';
|
|
import React, { Component } from 'react';
|
|
import style from './index.less';
|
|
import style from './index.less';
|
|
import info from './../img/info.png';
|
|
import info from './../img/info.png';
|
|
|
|
+import info1 from './../img/info1.png';
|
|
import drugIcon from './../img/drug.png';
|
|
import drugIcon from './../img/drug.png';
|
|
import more from '@common/images/addItem1.png';
|
|
import more from '@common/images/addItem1.png';
|
|
import $ from "jquery";
|
|
import $ from "jquery";
|
|
@@ -8,16 +9,31 @@ import $ from "jquery";
|
|
class DrugTreat extends Component {
|
|
class DrugTreat extends Component {
|
|
constructor(props) {
|
|
constructor(props) {
|
|
super(props);
|
|
super(props);
|
|
|
|
+ this.state = {
|
|
|
|
+ currentImg: -1
|
|
|
|
+ }
|
|
this.handleSelect = this.handleSelect.bind(this);
|
|
this.handleSelect = this.handleSelect.bind(this);
|
|
this.setOtherRecommend = this.setOtherRecommend.bind(this);
|
|
this.setOtherRecommend = this.setOtherRecommend.bind(this);
|
|
this.setDrugInfo = this.setDrugInfo.bind(this);
|
|
this.setDrugInfo = this.setDrugInfo.bind(this);
|
|
this.showTreatDesc = this.showTreatDesc.bind(this);
|
|
this.showTreatDesc = this.showTreatDesc.bind(this);
|
|
|
|
+ this.handleMouseLeaveImg = this.handleMouseLeaveImg.bind(this)
|
|
}
|
|
}
|
|
|
|
|
|
handleSelect(index,ii) {
|
|
handleSelect(index,ii) {
|
|
const { selectDrug } = this.props;
|
|
const { selectDrug } = this.props;
|
|
selectDrug && selectDrug(index,ii);
|
|
selectDrug && selectDrug(index,ii);
|
|
}
|
|
}
|
|
|
|
+ handleMouseEnterImg(ii, index) {
|
|
|
|
+ this.setState({
|
|
|
|
+ currentIndex: index,
|
|
|
|
+ currentImg: ii
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ handleMouseLeaveImg() {
|
|
|
|
+ this.setState({
|
|
|
|
+ currentIndex: -1,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
setOtherRecommend(item, index) {
|
|
setOtherRecommend(item, index) {
|
|
this.showTreatDesc();
|
|
this.showTreatDesc();
|
|
const { setOtherRecommend } = this.props;
|
|
const { setOtherRecommend } = this.props;
|
|
@@ -38,6 +54,7 @@ class DrugTreat extends Component {
|
|
|
|
|
|
render(){
|
|
render(){
|
|
const { treatment,showDrugInfo } = this.props
|
|
const { treatment,showDrugInfo } = this.props
|
|
|
|
+ const { currentImg, currentIndex } = this.state
|
|
return(
|
|
return(
|
|
treatment && treatment.length > 0 && <div className={style['drug-box']}>
|
|
treatment && treatment.length > 0 && <div className={style['drug-box']}>
|
|
<h3 className={style['drug-title']}><img className={style['drug-icon']} src={drugIcon}/> 常用药物治疗</h3>
|
|
<h3 className={style['drug-title']}><img className={style['drug-icon']} src={drugIcon}/> 常用药物治疗</h3>
|
|
@@ -53,7 +70,11 @@ class DrugTreat extends Component {
|
|
onClick={()=>{it.forbidden === '2' ? '' : this.handleSelect(index,ii)}} style={it.selected ? {color: '#3B9ED0', borderBottom: '1px solid #3B9ED0'}:''}>
|
|
onClick={()=>{it.forbidden === '2' ? '' : this.handleSelect(index,ii)}} style={it.selected ? {color: '#3B9ED0', borderBottom: '1px solid #3B9ED0'}:''}>
|
|
{it.medicitionName}
|
|
{it.medicitionName}
|
|
</span>
|
|
</span>
|
|
- {<img className={style['info-img']} src={info} onClick={() =>{this.setDrugInfo(it);showDrugInfo();}}/>}
|
|
|
|
|
|
+ {<img className={style['info-img']}
|
|
|
|
+ src={currentIndex === index ? (ii === currentImg ? info1 : info) : info}
|
|
|
|
+ onMouseEnter={this.handleMouseEnterImg.bind(this, ii, index)}
|
|
|
|
+ onMouseLeave = {this.handleMouseLeaveImg}
|
|
|
|
+ onClick={() =>{this.setDrugInfo(it);showDrugInfo();}}/>}
|
|
{it.forbidden === '1' ? <span className={style['info-flag']} style={{border: '1px solid #F4C051', background: '#F4C051',marginLeft: '5px'}}>慎用</span>: it.forbidden === '2' ? <span className={style['info-flag']} style={{border: '1px solid #000',marginLeft: '5px'}}>禁用</span> : ''}, 使用率{it.rate}
|
|
{it.forbidden === '1' ? <span className={style['info-flag']} style={{border: '1px solid #F4C051', background: '#F4C051',marginLeft: '5px'}}>慎用</span>: it.forbidden === '2' ? <span className={style['info-flag']} style={{border: '1px solid #000',marginLeft: '5px'}}>禁用</span> : ''}, 使用率{it.rate}
|
|
|
|
|
|
</span>)
|
|
</span>)
|