123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- import React, { Component } from "react";
- import PatInfoContainer from '@containers/PatInfoContainer.js';
- import style from "./index.less";
- import { connect } from 'react-redux';
- import historyCase from '@common/images/history.png';
- import health from '@common/images/health.png'
- import store from '@store';
- import { showHistory } from '@store/actions/historyTemplates';
- import { initItemList, setInitHistory, getHospitalInfo } from '@store/async-actions/historyTemplates';
- import HistoryCases from '@containers/HistoryCases';
- import $ from 'jquery';
- import {Notify,Loading} from '@commonComp';
- // import {MODI_LOADING} from '@store/types/homePage.js';
- import {SHOW_LOADING} from '@store/types/copyRight.js';
- class InfoTitle extends Component {
- constructor(props){
- super(props);
- this.state={
- le:''
- }
- this.showHistoryBox = this.showHistoryBox.bind(this)
- }
- showHistoryBox(){
- // console.log('关闭');
- const {showLoading,hideLoading}=this.props;
- showLoading();
- // 底部页面禁止滚动
- document.body.style.overflow = 'hidden';
- // store.dispatch(initItemList());
- // store.dispatch(showHistory(true))
- // initItemList().then((res)=>{
- // const result = res.data;
- // if(result.code==0 && result.data){
- // hideLoading();
- // store.dispatch(setInitHistory(result.data));
- // store.dispatch(showHistory(true));
- // }else{
- // hideLoading();
- // Notify.info("暂无历史病历");
- // }
- // })
- initItemList().then(res=>{
- const result = res.data
- if (result.code === '0' && result.data.records.length !== 0) {
- hideLoading();
- store.dispatch(setInitHistory(result.data));
- store.dispatch(showHistory(true));
- }else{
- hideLoading();
- Notify.info("暂无历史病历");
- }
- })
- // store.dispatch(getHospitalInfo())
- }
- componentWillReceiveProps(next){
- const that = this;
- if(next.winWidth <= 1024){
- $(window).scroll(function(){
- let scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
- let left = -(scrollLeft - 10) +'px';
- that.setState({
- le:left
- })
- })
- }
- }
- render() {
- const {loading,loadingText,loadingType} = this.props;
- const {le} = this.state;
- return <div className={style['title-wrapper']} style={{paddingRight:'122px'}}>
- <PatInfoContainer />
- {
- <div className={style['activeWrap']}>
- <div className={style["operations"]} onClick={this.showHistoryBox}>
- <span><img src={historyCase} /> 历史病历</span>
- </div>
- </div>
- }
- <HistoryCases></HistoryCases>
- <Loading show={loading} text={loadingText} type={loadingType}/>
- </div>;
- }
- }
- function mapStateToProps(state) {
- return {
- disVisible: state.copyRight.disVisible,
- copyVisible:state.copyRight.copyVisible,
- winWidth:state.homePage.windowWidth,
- loading:state.copyRight.loading,
- loadingText:state.copyRight.loadingText,
- loadingType:state.copyRight.loadingType
- }
- }
- function mapDispatchToProps(dispatch){
- return{
- showLoading(){
- // dispatch({type:MODI_LOADING,flag:true});
- dispatch({type:SHOW_LOADING,flag:true});
- },
- hideLoading(){
- // dispatch({type:MODI_LOADING,flag:false});
- dispatch({type:SHOW_LOADING,flag:false});
- }
- }
- }
- const InfoTitleCont = connect(
- mapStateToProps,
- mapDispatchToProps
- )(InfoTitle);
- export default InfoTitleCont;
|