twt 3 年之前
父節點
當前提交
817966c8a7

+ 12 - 4
operatingCompany/common/request.js

@@ -12,8 +12,14 @@ const http = (url = '', date = {}, type = 'POST', header = {
 		//console.log(burl2 + url)
 		header={};
 		const logInData = uni.getStorageSync("logInData");
-		header['token']=logInData.token;
-		header['uid']=logInData.uid; 
+		if(logInData){
+			header['token']=logInData.token;
+			header['uid']=logInData.uid; 
+		}else{
+			header['token']='';
+			header['uid']=''; 
+		}
+	
 		// header['token']='BA205B2ABFE4445EA5D111042E7BCE56';
 		// header['uid']='BE98A41B9E0C44C1B5EDCBCE39D550D0'; 
 		header['Content-Type']='application/x-www-form-urlencoded';
@@ -28,9 +34,9 @@ const http = (url = '', date = {}, type = 'POST', header = {
            /* setTimeout(function() {
                 uni.hideLoading();
             }, 200); */
-			uni.hideLoading();
-            let [error, res] = response;
 			
+            let [error, res] = response;
+			uni.hideLoading();
 			if(res.data.code==1){
 				/* uni.showToast({
 				     title: res.data.msg ? res.data.msg : '接口错误',
@@ -40,6 +46,7 @@ const http = (url = '', date = {}, type = 'POST', header = {
 				 resolve(res.data);
 			}
 			else if(res.data.code==401){
+				uni.hideLoading();
 				 uni.showToast({
 				     title: res.data.msg,
 				 	 icon:'none',
@@ -61,6 +68,7 @@ const http = (url = '', date = {}, type = 'POST', header = {
 				}
 			}else if(res.data.code==0){
 				// 正常
+				uni.hideLoading();
 				 resolve(res.data);
 			}
             

文件差異過大導致無法顯示
+ 21 - 17
operatingCompany/pages/logIn/home.vue


+ 10 - 1
operatingCompany/pages/logIn/logIn.vue

@@ -137,7 +137,16 @@
 					type: this.roleType,
 					openid:openid,
 				}, 'POST').then(res => {
-
+                    if(res.code!=0){
+						console.log(1111)
+						uni.showToast({
+						     title: res.msg ? res.msg : '接口错误',
+						 	 icon:'none',
+						     duration: 2000,
+						 });
+					}else{
+						
+					}
 					uni.setStorage({
 						key: 'logInData',
 						data: res.data,

二進制
operatingCompany/static/img/dl_bg@2x.png