import React, { Component } from 'react'; import style from './index.less'; import $ from "jquery"; import close from './img/close.png'; import info from './img/info.png'; import info1 from './img/info1.png'; class TreatDesc extends Component { constructor(props){ super(props); this.state = { currentIndex: -1 } this.hideTreatDesc = this.hideTreatDesc.bind(this); this.handleSelect= this.handleSelect.bind(this); this.handleMouseLeaveImg = this.handleMouseLeaveImg.bind(this) } handleMouseEnterImg(index) { this.setState({ currentIndex: index, }) } handleMouseLeaveImg() { this.setState({ currentIndex: -1, }) } handleSelect(index,ii) { const { selectDrug } = this.props; selectDrug && selectDrug(index,ii); } hideTreatDesc() { $('#treatDescBox').css({'display': 'none'}); $('#treatDescBox').animate({'display': 'none'}, 500); $('#treatWrapper').animate({'margin-left': '-340px'}, 500); } render(){ const { treatment, treatDesc, setDrugInfo, showDrugInfo} = this.props const { title, basic, otherDrugIndex, drugDesc} = treatDesc const { currentIndex } = this.state return (treatment && treatment.length >0 &&
{title && title === '药品推荐' ?
{/* { basic && basic.length > 0 &&
//推荐依据不需要展示

推荐依据

{basic.map((item, index) =>{ return (
) })}
} */} { otherDrugIndex > -1 &&

同类药物({treatment[otherDrugIndex].drugsName})

{treatment[otherDrugIndex].medicitionsList.map((item, index) =>{ return ( {index === 0 ? '' : ', '} {setDrugInfo(item);showDrugInfo();}} onClick={()=>{item.forbidden === '2' ? '' : this.handleSelect(otherDrugIndex,index)}} style={item.selected ? {color: '#3B9ED0'}:''}> {item.medicitionName} {{setDrugInfo(item);showDrugInfo();}}/>} {item.forbidden === '1' ? 慎用: item.forbidden === '2' ? 禁用 : ''}, 使用率{item.rate} ) })}
}
: '' } {/* { title !== '药品推荐' ?
{ drugDesc && drugDesc.length > 0 &&

说明

{drugDesc.map((item, index) =>{ return
{item.title}:
})}
}
: '' } */}
) } } export default TreatDesc;