1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- 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 } from '@store/async-actions/historyTemplates';
- import HistoryCases from '@containers/HistoryCases';
- import $ from 'jquery';
- import Notify from '@commonComp/Notify';
- import {MODI_LOADING} from '@store/types/homePage.js';
- class InfoTitle extends Component {
- constructor(props){
- super(props);
- this.state={
- le:''
- }
- this.showHistoryBox = this.showHistoryBox.bind(this)
- }
- showHistoryBox(){
- const {showLoading,hideLoading}=this.props;
- showLoading();
- // 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("暂无历史病历");
- }
- })
- }
- 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 {disVisible,copyVisible,winWidth} = this.props;
- const {le} = this.state;
- return <div className={style['title-wrapper']} style={{zIndex:disVisible||copyVisible?40:204,left:le}}>
- <PatInfoContainer sizeFlag={winWidth <= 1065?true:false}/>
- <div className={style["operations"]} onClick={this.showHistoryBox}>
- <span><img src={historyCase} /> 历史病历</span>
- </div>
- <div className={style["health"]} >
- <span><img src={health} /> 健康档案</span>
- </div>
- <HistoryCases></HistoryCases>
- </div>;
- }
- }
- function mapStateToProps(state) {
- return {
- disVisible: state.copyRight.disVisible,
- copyVisible:state.copyRight.copyVisible,
- winWidth:state.homePage.windowWidth
- }
- }
- function mapDispatchToProps(dispatch){
- return{
- showLoading(){
- dispatch({type:MODI_LOADING,flag:true});
- },
- hideLoading(){
- dispatch({type:MODI_LOADING,flag:false});
- }
- }
- }
- const InfoTitleCont = connect(
- mapStateToProps,
- mapDispatchToProps
- )(InfoTitle);
- export default InfoTitleCont;
|