Kaynağa Gözat

登录错误信息处理

luolei 5 yıl önce
ebeveyn
işleme
233b3aeca1
1 değiştirilmiş dosya ile 20 ekleme ve 18 silme
  1. 20 18
      src/components/Login.vue

+ 20 - 18
src/components/Login.vue

@@ -147,23 +147,22 @@ export default {
   
   methods: {
     getHospitalList(code){
-      api.getHospitalDatas({'hospitalCode':'A010'}).then(res => {
+      api.getHospitalDatas({'hospitalCode':code}).then(res => {
         let result = res.data;
         if (result.code == 0) {
           let tmpMain = result.data.superiorsInfo;
           let tmpLis = result.data.juniorHospital;
           tmpLis.unshift(tmpMain)
           this.hospitalList = tmpLis
-          this.hospitalName = tmpLis[0].hospitalName
-          this.hospitalNum = tmpLis[0].hospitalCode
+          this.hospitalName = tmpLis[0].hospitalName  //默认第一个
+          this.hospitalNum = tmpLis[0].hospitalCode   
+        }else{
+          // this.defaultWaring(res.data.msg);
         }
       })
     },
     getSysConfig(code){
-      const param = {
-        'hospitalCode':code,
-      }
-      api.getSysConfig(param).then((res)=>{
+      api.getSysConfig({'hospitalCode':code}).then((res)=>{
         const result = res.data;
         if(result.code==0){
           const datas = result.data;
@@ -174,6 +173,8 @@ export default {
               this.hospitalShow = +datas[i].value==1?true:false
             }
           }
+        }else{
+          this.defaultWaring(res.data.msg);
         }
       })
     },
@@ -239,7 +240,7 @@ export default {
       this.submit = flg;
     },
     handleDepart(){
-      const { type, value,patName,allow,hospitalNum,hospitalName,code } = this;
+      const { type, value,patName,allow,hospitalNum,hospitalName,code,hospitalList } = this;
       this.allow = false
       if (value&&patName&&allow) {
         let timer = setTimeout(() => {
@@ -268,10 +269,10 @@ export default {
             return;
           }
           const param = {
-            patientInfo: this.value,
-            patientInfoType: this.type,
+            patientInfo: value,
+            patientInfoType: type,
             hospitalCode:code,
-            hospitalName:this.hospitalList[0].hospitalName||'',
+            hospitalName:hospitalList.length>0&&hospitalList[0].hospitalName||'',
             patientName:patName,
             sonHospitalCode: code==hospitalNum?'':hospitalNum||'',
             sonHospitalName: code==hospitalNum?'':hospitalName||''
@@ -308,13 +309,14 @@ export default {
               }
               clearTimeout(timer)
             } else {
-              if(res.msg.indexOf('暂无今日挂号信息') != -1){
-                this.message.title = '温馨提示'
-                this.message.text = '暂无今日挂号信息,可更换登录方式再次尝试。'
-                this.showTip = true
-              }else{
-                this.defaultWaring(res.msg);
-              }
+              // if(res.msg.indexOf('暂无今日挂号信息') != -1){
+              //   this.message.title = '温馨提示'
+              //   this.message.text = '暂无今日挂号信息,可更换登录方式再次尝试。'
+              //   this.showTip = true
+              // }else{
+              //   this.defaultWaring(res.data.msg);
+              // }
+              this.defaultWaring(res.data.msg);
               clearTimeout(timer)
             }
           }).catch(() => {