12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import React, { Component } from "react";
- import { connect } from "react-redux";
- import BannerContainer from '@containers/TypeConfigContainer';
- // 引入组件
- import BodyContainer from "@components/BodyContainer";
- import {HIDEDROP,SETMINSCREEN} from '@store/types/homePage.js';
- import style from './index.less';
- /*import {getInitModules} from '@store/async-actions/homePage.js';*/
- import { getUrlArgObject } from "@utils/tools";
- import $ from 'jquery';
- import loading from '@common/images/loading.gif';
- class HomePage extends Component {
- constructor() {
- super();
- this.state={
- timer:null
- }
- }
-
- componentDidMount(){
- const {setWindow} = this.props;
- /* clearTimeout(this.state.timer);
- const that = this;
- const timer = setTimeout(function(){//解决患者信息在获取模板之后的问题
- that.props.getInit();
- },200)
- this.setState({
- timer
- }) */
- // 获取并监听窗口宽度,用于有横向滚动条时患者信息和打印预览跟随滚动
- 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});
- })
- //光标没落到span的时候继续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"){
- return false;
- }
- }
- })
- }
- render() {
- const {flag} = this.props;
- return <div className={style['home-page']} onClick={this.props.hideAllDrop}>
- <BannerContainer />
- {/* <InfoTitle /> */}
- <BodyContainer></BodyContainer>
- <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
- }
- };
- const mapDispatchToProps = function (dispatch) {
- return {
- hideAllDrop(){
- dispatch({
- type:HIDEDROP
- });
- },
- /*getInit(){
- dispatch(getInitModules);
- }*/
- setWindow(obj){
- dispatch({
- type:SETMINSCREEN,
- obj:obj
- })
- }
- }
- };
- export default connect(mapStateToProps, mapDispatchToProps)(HomePage);
|