index.jsx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import React, { Component } from "react";
  2. import PatInfoContainer from '@containers/PatInfoContainer.js';
  3. import style from "./index.less";
  4. import { connect } from 'react-redux';
  5. import historyCase from '@common/images/history.png';
  6. import health from '@common/images/health.png'
  7. import store from '@store';
  8. import { showHistory } from '@store/actions/historyTemplates';
  9. import { initItemList, setInitHistory, getHospitalInfo } from '@store/async-actions/historyTemplates';
  10. import HistoryCases from '@containers/HistoryCases';
  11. import $ from 'jquery';
  12. import {Notify,Loading} from '@commonComp';
  13. // import {MODI_LOADING} from '@store/types/homePage.js';
  14. import {SHOW_LOADING} from '@store/types/copyRight.js';
  15. class InfoTitle extends Component {
  16. constructor(props){
  17. super(props);
  18. this.state={
  19. le:''
  20. }
  21. this.showHistoryBox = this.showHistoryBox.bind(this)
  22. }
  23. showHistoryBox(){
  24. // console.log('关闭');
  25. const {showLoading,hideLoading}=this.props;
  26. showLoading();
  27. // 底部页面禁止滚动
  28. document.body.style.overflow = 'hidden';
  29. // store.dispatch(initItemList());
  30. // store.dispatch(showHistory(true))
  31. // initItemList().then((res)=>{
  32. // const result = res.data;
  33. // if(result.code==0 && result.data){
  34. // hideLoading();
  35. // store.dispatch(setInitHistory(result.data));
  36. // store.dispatch(showHistory(true));
  37. // }else{
  38. // hideLoading();
  39. // Notify.info("暂无历史病历");
  40. // }
  41. // })
  42. initItemList().then(res=>{
  43. const result = res.data
  44. if (result.code === '0' && result.data.records.length !== 0) {
  45. hideLoading();
  46. store.dispatch(setInitHistory(result.data));
  47. store.dispatch(showHistory(true));
  48. }else{
  49. hideLoading();
  50. Notify.info("暂无历史病历");
  51. }
  52. })
  53. // store.dispatch(getHospitalInfo())
  54. }
  55. componentWillReceiveProps(next){
  56. const that = this;
  57. if(next.winWidth <= 1024){
  58. $(window).scroll(function(){
  59. let scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
  60. let left = -(scrollLeft - 10) +'px';
  61. that.setState({
  62. le:left
  63. })
  64. })
  65. }
  66. }
  67. render() {
  68. const {loading,loadingText,loadingType} = this.props;
  69. const {le} = this.state;
  70. return <div className={style['title-wrapper']} style={{paddingRight:'122px'}}>
  71. <PatInfoContainer />
  72. {
  73. <div className={style['activeWrap']}>
  74. <div className={style["operations"]} onClick={this.showHistoryBox}>
  75. <span><img src={historyCase} />&nbsp;历史病历</span>
  76. </div>
  77. </div>
  78. }
  79. <HistoryCases></HistoryCases>
  80. <Loading show={loading} text={loadingText} type={loadingType}/>
  81. </div>;
  82. }
  83. }
  84. function mapStateToProps(state) {
  85. return {
  86. disVisible: state.copyRight.disVisible,
  87. copyVisible:state.copyRight.copyVisible,
  88. winWidth:state.homePage.windowWidth,
  89. loading:state.copyRight.loading,
  90. loadingText:state.copyRight.loadingText,
  91. loadingType:state.copyRight.loadingType
  92. }
  93. }
  94. function mapDispatchToProps(dispatch){
  95. return{
  96. showLoading(){
  97. // dispatch({type:MODI_LOADING,flag:true});
  98. dispatch({type:SHOW_LOADING,flag:true});
  99. },
  100. hideLoading(){
  101. // dispatch({type:MODI_LOADING,flag:false});
  102. dispatch({type:SHOW_LOADING,flag:false});
  103. }
  104. }
  105. }
  106. const InfoTitleCont = connect(
  107. mapStateToProps,
  108. mapDispatchToProps
  109. )(InfoTitle);
  110. export default InfoTitleCont;