|
@@ -1,18 +1,60 @@
|
|
import React, { Component } from 'react';
|
|
import React, { Component } from 'react';
|
|
import style from './index.less';
|
|
import style from './index.less';
|
|
|
|
+import LastDrug from './LastDrug/index.jsx';
|
|
|
|
+import info2 from './../img/info2.png';
|
|
|
|
+import info3 from './../img/info3.png';
|
|
|
|
+import $ from "jquery";
|
|
|
|
|
|
class LastTreat extends Component {
|
|
class LastTreat extends Component {
|
|
constructor(props){
|
|
constructor(props){
|
|
super(props);
|
|
super(props);
|
|
|
|
+ this.state = {
|
|
|
|
+ currentIndex: -1
|
|
|
|
+ }
|
|
|
|
+ this.handleMouseLeaveDrug = this.handleMouseLeaveDrug.bind(this);
|
|
|
|
+ this.handleMouseLeaveImg = this.handleMouseLeaveImg.bind(this);
|
|
|
|
+ this.setDrugInfo = this.setDrugInfo.bind(this);
|
|
}
|
|
}
|
|
|
|
+ handleMouseEnterDrug(index, item) {
|
|
|
|
+ const drugNameWidth = parseInt($('#'+item.medicitionName)[0].offsetWidth)
|
|
|
|
+ const imgLeft = drugNameWidth/2-8
|
|
|
|
+ $('#'+item.medicitionName).find('img').css('left', imgLeft)
|
|
|
|
+ this.setState({
|
|
|
|
+ currentIndex: index,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ handleMouseLeaveDrug() {
|
|
|
|
+ this.setState({
|
|
|
|
+ currentIndex: -1,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ handleMouseEnterImg() {
|
|
|
|
+ this.setState({
|
|
|
|
+ hasEnterImg: true
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ handleMouseLeaveImg() {
|
|
|
|
+ this.setState({
|
|
|
|
+ hasEnterImg: false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ setDrugInfo(item) {
|
|
|
|
+ const { setDrugInfo } = this.props;
|
|
|
|
+ setDrugInfo && setDrugInfo(item);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
render() {
|
|
render() {
|
|
- const { icon, titleStyle,titleBg, filter, title, lasttreatTreat } = this.props
|
|
|
|
|
|
+ const { icon, titleStyle,titleBg, filter, title, lastTreat, showDrugInfo, setDrugInfo } = this.props
|
|
|
|
+ const { chronicDisMedica, commonDisMedica } = lastTreat
|
|
return(
|
|
return(
|
|
- lasttreatTreat.content && lasttreatTreat.content.length > 0 && <div className={style['last-treat-wrapper']}>
|
|
|
|
|
|
+ chronicDisMedica && chronicDisMedica.length > 0 && commonDisMedica && commonDisMedica.length > 0 &&
|
|
|
|
+ <div className={style['last-treat-wrapper']}>
|
|
|
|
+ {console.log('lasttreatTreat', lastTreat)}
|
|
<div className={style['last-treat-title-box']} style={titleStyle}></div>
|
|
<div className={style['last-treat-title-box']} style={titleStyle}></div>
|
|
<div className={style['last-treat-title']} ><img className={style['last-treat-icon']} src={icon}/>{title}</div>
|
|
<div className={style['last-treat-title']} ><img className={style['last-treat-icon']} src={icon}/>{title}</div>
|
|
-
|
|
|
|
|
|
+ {commonDisMedica.length > 0 && <LastDrug title='普通病用药内容' lastDrugList = {commonDisMedica} showDrugInfo={showDrugInfo} setDrugInfo={setDrugInfo}></LastDrug>}
|
|
|
|
+ {chronicDisMedica.length > 0 && <LastDrug title='慢病用药内容' lastDrugList = {chronicDisMedica} showDrugInfo={showDrugInfo} setDrugInfo={setDrugInfo}></LastDrug>}
|
|
</div>
|
|
</div>
|
|
)
|
|
)
|
|
}
|
|
}
|