123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- import React, { Component } from "react";
- import { connect } from "react-redux";
- import BannerContainer from '@containers/TypeConfigContainer';
- // 引入组件
- import BodyContainer from "@components/BodyContainer";
- import EmergencyProcedure from '@components/EmergencyProcedure';
- import {HIDEDROP,SETMINSCREEN,SETSYSTEMCONFIG} from '@store/types/homePage.js';
- import style from './index.less';
- import {getInitModules,getChronic,getSystemConfig} from '@store/async-actions/homePage.js';
- import { getUrlArgObject,parseNameVal } from "@utils/tools";
- import dataLis from '@components/EmergencyProcedure/emergency';
- import $ from 'jquery';
- import loading from '@common/images/loading.gif';
- class HomePage extends Component {
- constructor() {
- super();
- this.state={
- timer:null,
- dataEmergency:{},
- idx:''
- }
- this.setDataIdx = this.setDataIdx.bind(this)
- }
- componentDidMount(){
- const {setWindow,getChronicList,getConfig} = this.props;
- getConfig();
- getChronicList&&getChronicList();//获取慢病列表
- // 获取并监听窗口宽度,用于有横向滚动条时患者信息和打印预览跟随滚动
- let width = $(window).width();
- let height = $(window).height();
- setWindow && setWindow({width,height});
-
- $(window).resize(function(){
- let reWidth = $(window).width();
- let reHeight = $(window).height();
- setWindow && setWindow({width:reWidth,height:reHeight});
- })
- //光标没落到元素上继续backspace防止页面回退
- $(window).on("keydown",(e)=>{
- let ev = e || window.event;
- if(ev.keyCode==8){
- const elem = ev.srcElement || ev.target;
- const nodeN = elem.nodeName;
- if(nodeN != "SPAN" && nodeN != "DIV" && nodeN != "INPUT" && nodeN != "TEXTAREA"){
- return false;
- }
- }
- })
- }
- setDataIdx(index){
- this.setState({
- idx:index+''
- })
- }
- render() {
- const {flag,setPushEmergencyIdx,sysConfig} = this.props;
- return <div className={style['home-page']} onClick={this.props.hideAllDrop}>
- <BannerContainer />
- {/* <InfoTitle /> */}
- <BodyContainer></BodyContainer>
- {
- (setPushEmergencyIdx+'')&&(sysConfig.emergency_show==1)?<EmergencyProcedure data={dataLis[this.state.idx]||dataLis[setPushEmergencyIdx]} idx={this.state.idx||setPushEmergencyIdx} setDataIdx={this.setDataIdx}></EmergencyProcedure>:null
- }
- <div className={style['mask']} style={{display:flag?"block":"none"}}>
- <img src={loading} className={style['load']}/>
- </div>
- </div>;
- }
- }
- const mapStateToProps = function (state) {
- return {
- flag:state.homePage.loadingFlag,
- setPushEmergencyIdx: state.pushMessage.setPushEmergencyIdx || '',
- sysConfig:state.homePage.sysConfig
- }
- };
- const mapDispatchToProps = function (dispatch) {
- return {
- hideAllDrop(){
- dispatch({
- type:HIDEDROP
- });
- },
- /*getInit(){
- dispatch(getInitModules);
- }*/
- setWindow(obj){
- dispatch({
- type:SETMINSCREEN,
- obj:obj
- })
- },
- getChronicList(){
- dispatch(getChronic)
- },
- getConfig(){
- getSystemConfig().then((res)=>{
- if(res.data.code=='0'){
- dispatch({
- type:SETSYSTEMCONFIG,
- data: parseNameVal(res.data.data)
- })
- }else{
- }
- });
- }
- }
- };
- export default connect(mapStateToProps, mapDispatchToProps)(HomePage);
|