Browse Source

获取模板接口放在获取病人信息回调中,确保参数不为空

zhouna 6 years ago
parent
commit
a96e98a90f
2 changed files with 6 additions and 5 deletions
  1. 5 5
      src/modules/HomePage/index.jsx
  2. 1 0
      src/store/async-actions/patInfo.js

+ 5 - 5
src/modules/HomePage/index.jsx

@@ -6,7 +6,7 @@ import BodyContainer from "@components/BodyContainer";
 
 
 import {HIDEDROP} from '@store/types/homePage.js';
 import {HIDEDROP} from '@store/types/homePage.js';
 import style from './index.less';
 import style from './index.less';
-import {getInitModules} from '@store/async-actions/homePage.js';
+/*import {getInitModules} from '@store/async-actions/homePage.js';*/
 import { getUrlArgObject } from "@utils/tools";
 import { getUrlArgObject } from "@utils/tools";
 
 
 class HomePage extends Component {
 class HomePage extends Component {
@@ -17,7 +17,7 @@ class HomePage extends Component {
         }
         }
     }
     }
     
     
-    componentDidMount(){
+    /*componentDidMount(){
         clearTimeout(this.state.timer);
         clearTimeout(this.state.timer);
         const that = this;
         const that = this;
         const timer = setTimeout(function(){//解决患者信息在获取模板之后的问题
         const timer = setTimeout(function(){//解决患者信息在获取模板之后的问题
@@ -26,7 +26,7 @@ class HomePage extends Component {
         this.setState({
         this.setState({
             timer
             timer
         })      
         })      
-    }
+    }*/
     render() {
     render() {
         return <div className={style['home-page']} onClick={this.props.hideAllDrop}>
         return <div className={style['home-page']} onClick={this.props.hideAllDrop}>
             <BannerContainer />
             <BannerContainer />
@@ -48,9 +48,9 @@ const mapDispatchToProps = function (dispatch) {
               type:HIDEDROP
               type:HIDEDROP
             });
             });
         },
         },
-        getInit(){
+        /*getInit(){
             dispatch(getInitModules);
             dispatch(getInitModules);
-        }
+        }*/
     }
     }
 };
 };
 
 

+ 1 - 0
src/store/async-actions/patInfo.js

@@ -94,6 +94,7 @@ export const getPatientMessage = (dispatch, getState) => {
         type: CONFIRM_TYPE,
         type: CONFIRM_TYPE,
         confirmType:data1.modeValue
         confirmType:data1.modeValue
       });
       });
+      dispatch(getInitModules);     //确保病人信息获取以后再获取模板等数据,否则参数为空
       if(state.tabTemplate.items.length == 0){
       if(state.tabTemplate.items.length == 0){
         dispatch(initItemList(data1.modeValue));        //模板列表没有就获取模板列表用于保存时做数据对比是否保存过
         dispatch(initItemList(data1.modeValue));        //模板列表没有就获取模板列表用于保存时做数据对比是否保存过
       }
       }