Prechádzať zdrojové kódy

回读数据请求成功前添加loading,搜索数据需点击两次的bug

liucf 6 rokov pred
rodič
commit
a0beff1d16

+ 2 - 1
src/common/components/EditableSpan/index.jsx

@@ -96,7 +96,8 @@ class EditableSpan extends Component{
       temp = newText.replace(searchPre,'');
       isEnd = !(newText.indexOf(searchPre)>0);
       search = temp.replace(/[(^\s*)|(\s*$)|(^\,*)|(\,*$)]/g,'');
-      if(!search&&searchPre){
+      // if(!search&&searchPre){
+      if(!temp&&searchPre){
         search = searchPre;
       }
       //console.log(labelVal,'旧:',searchPre,'新:',newText,'搜索:',search);

BIN
src/common/images/loading.gif


+ 2 - 1
src/components/SearchDrop/index.jsx

@@ -47,6 +47,7 @@ class SearchDrop extends Component{
   }
 
   handleSelect(e,item){
+    // onClick事件换成onmouseup--点击清除后谷歌下搜索结果点击不上去的情况
     e.stopPropagation();
     const {onSelect,onShow} = this.props;
     onSelect&&onSelect(item);
@@ -60,7 +61,7 @@ class SearchDrop extends Component{
         <ul>
           {this.props.data&&this.props.data.map((it)=>{
             litext = it.showType==1?it.name:it.name+'('+it.retrievalName+')';
-            return <li onClick={(e)=>this.handleSelect(e,it)} title={litext}>{litext}</li>
+            return <li onmouseup={(e)=>this.handleSelect(e,it)} title={litext}>{litext}</li>
           })}
         </ul>
       </div>

+ 6 - 1
src/modules/HomePage/index.jsx

@@ -9,6 +9,7 @@ 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();
@@ -40,17 +41,21 @@ class HomePage extends Component {
 
     }
     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) {

+ 19 - 0
src/modules/HomePage/index.less

@@ -0,0 +1,19 @@
+.mask {
+    position: fixed;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background: #000;
+    opacity: .4;
+    filter:alpha(opacity=40);
+    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=40);";
+    z-index: 9998;
+}
+.load{
+    position: absolute;
+    top: 50%;
+    left:50%;
+    margin-top: -64px;
+    margin-left: -64px;
+}

+ 4 - 3
src/store/async-actions/homePage.js

@@ -1,5 +1,5 @@
 import {post,json} from '@utils/ajax.js';
-import {SETINITDATA} from '@store/types/homePage.js';
+import {SETINITDATA,MODI_LOADING} from '@store/types/homePage.js';
 import {SET_CURRENT} from '@store/types/currentIll';
 import {SET_MAINSUIT} from '@store/types/mainSuit';
 import config from '@config/index.js';
@@ -27,7 +27,8 @@ function modulesParseJson(data){
 export const getInitModules= (dispatch,getStore)=>{
   const state = getStore();
   const {message} = state.patInfo;
-  return json(api.getModules,{age:message.patientAge,sexType:message.sex}).then((res) => {
+  return json(api.getModules,{age:message.patientAge,sexType:message.sex}).then((res) => {console.log("模板请求成功",res);
+      dispatch({type:MODI_LOADING});
       if (res.data.code == '0') {
         const newObj = modulesParseJson(res.data.data);
         const initData = newObj.json;
@@ -73,7 +74,7 @@ export const initHis = (dispatch)=> {
           dispatch(initHistoryDetails(baseDate.patInfo.message));
           clearInterval(timer)
         }
-    },500)
+    },200)
 }
 
 // 埋点事件,点击保存时调用

+ 6 - 2
src/store/reducers/homePage.js

@@ -1,5 +1,5 @@
 import {HIDE,RESET,SETINITDATA,SETDROPSHOW,SETADDITEMINIT,SETT0EDIT,SETREADDITEMS,
-  HIDEDROP,CLICKCOUNT,ISREAD,SETOTHERHISTORY,SETMINSCREEN} from '../types/homePage.js';
+  HIDEDROP,CLICKCOUNT,ISREAD,SETOTHERHISTORY,SETMINSCREEN,MODI_LOADING} from '../types/homePage.js';
 import {showDrop,setAddItemInit,setLabelToEdit,confirmHide,clickNum} from '../actions/homePage.js';
 
 const initState = {
@@ -9,7 +9,8 @@ const initState = {
   focusTextIndex:'',
   clickData:[],
   addItems:{},
-  commSymHide:false
+  commSymHide:false,
+  loadingFlag:true
 };
 
 export default function (state=initState,action) {
@@ -55,6 +56,9 @@ export default function (state=initState,action) {
       res.windowWidth = action.obj.width;
       res.windowHeight = action.obj.height;
       return res;
+    case MODI_LOADING:
+      res.loadingFlag = false;
+      return res;
     default:
       return res;
   }

+ 2 - 1
src/store/types/homePage.js

@@ -10,4 +10,5 @@ export const HIDEDROP = 'set_box_drop_hide';//点击确定隐藏
 export const CLICKCOUNT = 'click_count';//埋点
 export const ISREAD = 'is_history_or_template';     //是否回读或模板数据
 export const SETOTHERHISTORY = 'set_otherHis_history';    //其他史历史数据暂存
-export const SETMINSCREEN = 'SETMINSCREEN';    //1024标识
+export const SETMINSCREEN = 'SETMINSCREEN';    //1024标识
+export const MODI_LOADING = 'MODI_LOADING';    //1024标识