index.jsx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. const {showLoading,hideLoading}=this.props;
  25. showLoading();
  26. // 底部页面禁止滚动
  27. // store.dispatch(initItemList());
  28. // store.dispatch(showHistory(true))
  29. // initItemList().then((res)=>{
  30. // const result = res.data;
  31. // if(result.code==0 && result.data){
  32. // hideLoading();
  33. // store.dispatch(setInitHistory(result.data));
  34. // store.dispatch(showHistory(true));
  35. // }else{
  36. // hideLoading();
  37. // Notify.info("暂无历史病历");
  38. // }
  39. // })
  40. initItemList().then(res=>{
  41. const result = res.data
  42. if (result.code === '0' && result.data.records.length !== 0) {
  43. hideLoading();
  44. store.dispatch(setInitHistory(result.data));
  45. store.dispatch(showHistory(true));
  46. document.body.style.overflow = 'hidden';
  47. }else{
  48. hideLoading();
  49. Notify.info("暂无历史病历");
  50. }
  51. })
  52. // store.dispatch(getHospitalInfo())
  53. }
  54. componentWillReceiveProps(next){
  55. const that = this;
  56. if(next.winWidth <= 1024){
  57. $(window).scroll(function(){
  58. let scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
  59. let left = -(scrollLeft - 10) +'px';
  60. that.setState({
  61. le:left
  62. })
  63. })
  64. }
  65. }
  66. render() {
  67. const {loading,loadingText,loadingType} = this.props;
  68. const {le} = this.state;
  69. return <div className={style['title-wrapper']} style={{paddingRight:'122px'}}>
  70. <PatInfoContainer />
  71. {
  72. <div className={style['activeWrap']}>
  73. <div className={style["operations"]} onClick={this.showHistoryBox}>
  74. <span><img src={historyCase} />&nbsp;历史病历</span>
  75. </div>
  76. </div>
  77. }
  78. <HistoryCases></HistoryCases>
  79. <Loading show={loading} text={loadingText} type={loadingType}/>
  80. </div>;
  81. }
  82. }
  83. function mapStateToProps(state) {
  84. return {
  85. disVisible: state.copyRight.disVisible,
  86. copyVisible:state.copyRight.copyVisible,
  87. winWidth:state.homePage.windowWidth,
  88. loading:state.copyRight.loading,
  89. loadingText:state.copyRight.loadingText,
  90. loadingType:state.copyRight.loadingType
  91. }
  92. }
  93. function mapDispatchToProps(dispatch){
  94. return{
  95. showLoading(){
  96. // dispatch({type:MODI_LOADING,flag:true});
  97. dispatch({type:SHOW_LOADING,flag:true});
  98. },
  99. hideLoading(){
  100. // dispatch({type:MODI_LOADING,flag:false});
  101. dispatch({type:SHOW_LOADING,flag:false});
  102. }
  103. }
  104. }
  105. const InfoTitleCont = connect(
  106. mapStateToProps,
  107. mapDispatchToProps
  108. )(InfoTitle);
  109. export default InfoTitleCont;