|
@@ -12,52 +12,23 @@ import HasInfoItem from '@common/components/HasInfoItem'
|
|
|
class TreatDesc extends Component {
|
|
|
constructor(props){
|
|
|
super(props);
|
|
|
- this.state = {
|
|
|
- currentIndex: -1,
|
|
|
- hasEnterImg: false
|
|
|
- }
|
|
|
+
|
|
|
this.hideTreatDesc = this.hideTreatDesc.bind(this);
|
|
|
this.handleSelect= this.handleSelect.bind(this);
|
|
|
- this.handleMouseEnterDrug = this.handleMouseEnterDrug.bind(this)
|
|
|
- this.handleMouseLeaveDrug = this.handleMouseLeaveDrug.bind(this)
|
|
|
- this.handleMouseEnterImg = this.handleMouseEnterImg.bind(this)
|
|
|
- this.handleMouseLeaveImg = this.handleMouseLeaveImg.bind(this)
|
|
|
+ this.setDrugInfo = this.setDrugInfo.bind(this)
|
|
|
this.getPosition = this.getPosition.bind(this)
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- handleMouseEnterDrug( index, item) {
|
|
|
- // console.log('item', item)
|
|
|
- // const drugNameWidth = parseInt($('#'+item.medicitionName)[0].offsetWidth)
|
|
|
-
|
|
|
- // const imgLeft = drugNameWidth/2-10
|
|
|
- // console.log('imgLeft', imgLeft)
|
|
|
- // $('#'+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
|
|
|
- })
|
|
|
- }
|
|
|
+
|
|
|
handleSelect(position) {
|
|
|
|
|
|
const { selectDrug } = this.props;
|
|
|
selectDrug && selectDrug(position);
|
|
|
}
|
|
|
+ setDrugInfo(item) {
|
|
|
+ const { setDrugInfo } = this.props;
|
|
|
+ setDrugInfo && setDrugInfo({name: item.medicitionName, type: 8, position: 5});
|
|
|
+ }
|
|
|
hideTreatDesc() {
|
|
|
$('#treatDescBox').css({'display': 'none'});
|
|
|
$('#treatDescBox').animate({'display': 'none'}, 500);
|
|
@@ -73,7 +44,6 @@ class TreatDesc extends Component {
|
|
|
render(){
|
|
|
const { treatment, treatDesc, setDrugInfo} = this.props
|
|
|
const { title, basic, position, drugDesc} = treatDesc
|
|
|
- const { currentIndex, hasEnterImg } = this.state
|
|
|
let treatmentItem
|
|
|
if(position) {
|
|
|
treatmentItem = treatment[position[0]].meditionDetails[position[1]].treatment[position[2]]
|