Explorar o código

登录页添加loading

luolei %!s(int64=5) %!d(string=hai) anos
pai
achega
3bf93e5454
Modificáronse 1 ficheiros con 9 adicións e 3 borrados
  1. 9 3
      src/components/Login.vue

+ 9 - 3
src/components/Login.vue

@@ -57,10 +57,11 @@
           placeholder="请输入姓名"
         />
       </div>
-      <div :class="['btn',canClick&&!allow?'btnClick':'btnDis']" @click.stop.prevent="handleDepart">进入预问诊</div>
+      <div :class="['btn',canClick?'btnClick':'btnDis']" @click.stop.prevent="handleDepart">进入预问诊</div>
     </div>
     <!-- <div class="tip">注:建议您可先输入病情情况,方便医生提前了解情况</div> -->
     <Submit v-if="submit" :showType="showType" :fail="failMsg" @showSubmit="showSubmit"></Submit>
+    <Loading v-if="this.$store.state.loadingShow"></Loading>
     <Tiptoast
         :show="showTip"
 				@close="close"
@@ -72,12 +73,14 @@ import { phoneTest, identify, jgpattern,name } from "@utils/tools.js";
 import Submit from "../common/Submit";
 import Tiptoast from "../common/Tiptoast";
 import api from "@utils/api.js";
+import Loading from '../common/Loading';
 import $ from "jquery";
 // let iscanscrollpage = false
 export default {
   name: "Login",
   data() {
     return {
+      loadingShow: this.$store.state.loadingShow,
       showTip: false,
       showType: "fail",
       failMsg: "",
@@ -250,7 +253,6 @@ export default {
       }
     },
     defaultWaring(msg) {
-      this.$store.commit("handleToggleShow", false);
       this.showType = "fail";
       this.failMsg = msg;
       this.submit = true;
@@ -294,6 +296,7 @@ export default {
             this.allow = false;
             return;
           }
+          this.$store.commit('handleToggleShow', true);
           const param = {
             patientInfo: value,
             patientInfoType: type,
@@ -349,9 +352,11 @@ export default {
               this.defaultWaring(res.data.msg||"网络异常请稍后重试");
               clearTimeout(timer)
             }
+            this.$store.commit('handleToggleShow', false);
           }).catch(() => {
             this.allow = false
             clearTimeout(timer)
+            this.$store.commit('handleToggleShow', false);
             this.defaultWaring("网络异常请稍后重试");
           });
         }, 200);
@@ -360,7 +365,8 @@ export default {
   },
   components: {
     Submit,
-    Tiptoast
+    Tiptoast,
+    Loading
   }
 };
 </script>