import React, { Component } from 'react'; import style from './index.less'; import close from './../img/close.png'; import $ from "jquery"; import {dragBox} from '@utils/tools' class DrugInfo extends Component { constructor(props) { super(props); this.state = { currentIndex: 0, zIndex:302 } this.setDragBox = this.setDragBox.bind(this) } componentDidMount(){ dragBox('drugWrapper','drugTitle') } handleClickMenu(index, item, drugDesc) { const that = this setTimeout(function(){ that.setState({ currentIndex: index }) },0) let scrollTop = 60 //标题高度为60px drugDesc.map((it, ii) => { if( ii < index) { scrollTop = scrollTop + parseInt($('#' + it.title.trim()).css('height')) } }) $('#drugDesc').scrollTop(scrollTop) } handleScrollModal(drugDesc) { const scrollTop = $('#drugDesc').scrollTop() let divHeight = 60; //标题高度为60px for (let i = 0; i < drugDesc.length; i++) { divHeight = divHeight + parseInt($('#' + drugDesc[i].title.trim()).css('height')) -5 if(divHeight > scrollTop) { this.setState({ currentIndex: i }) return } } } setDragBox(){ $('#treatWrapper').css({'z-index': 301}); $('#drugWrapper').css({'z-index': 302}); } render() { const { drugInfo, hideDrugInfo, drugInfoList,hideDrugInfoMore } = this.props const { currentIndex } = this.state {console.log('drugInfodrugInfo', drugInfo)} return (

{drugInfo.tagType == 8 ? drugInfo.title+'说明书' : drugInfo.tagType == 10 ? drugInfo.title+ '说明': ''}

{ drugInfo && drugInfo.drugDesc.length > 0 &&
{drugInfo.tagType == 8 ? drugInfo.title+'说明书' : drugInfo.tagType == 10 ? drugInfo.title+ '说明': ''}
{drugInfo.drugDesc.map((item, index) =>{ return
{item.title.trim()}
})}
{drugInfo.drugDesc.map((item, index) => { return (
{index === 0 ? '' :
} {item.title}
) })}
} { !drugInfo || (drugInfo && drugInfo.drugDesc.length === 0) &&
{drugInfo.tagType == 8 ? '该药品暂无说明' : drugInfo.tagType == 10 ?'该不良反应暂无说明': ''}
}
) //多个药品药品说明书(添加数据时查看药品说明书用) // return (
//

说明书

// { drugInfoList && drugInfoList.length > 0 &&
// {drugInfoList.map((item,index) => { // return
//

{'【'+item.id+'】'}{item.name}说明书

// {item.introduceDetailList&&item.introduceDetailList.length>0&&item.introduceDetailList.map((it, index) =>{ // return
{it.title.trim()}
// })} //
//



//
// })} //
} //
) } } export default DrugInfo;