Browse Source

登录失效重新登录

aleyds 3 years ago
parent
commit
8c741775b6
2 changed files with 16 additions and 4 deletions
  1. 2 2
      common/config.js
  2. 14 2
      common/http.interceptor.js

+ 2 - 2
common/config.js

@@ -1,5 +1,5 @@
-const host = 'http://wx.hw.hongweisoft.com/parking';//本地
-// const host = 'http://parking.pdzhtc.com';//正式
+// const host = 'http://wx.hw.hongweisoft.com/parking';//本地
+const host = 'http://parking.pdzhtc.com';//正式
 // const host = 'http://172.16.90.64:7000';
 const config = {
 	wxAppid:'wxbe90cc7c5233dd84',// wxAppid 

+ 14 - 2
common/http.interceptor.js

@@ -54,8 +54,20 @@ const install = (Vue, vm) => {
 			return res;  
 		} else if(res.msg == "令牌不能为空"||res.code == 401){			
 			// console.log('location.href',location);
-			alert('还未登录,即将跳转登录');
-			setTimeout(()=>{location.href = location.origin+'/#/pages/login/login';});
+			// alert('还未登录,即将跳转登录');
+			// setTimeout(()=>{location.href = location.origin+'/#/pages/login/login';});
+			uni.showModal({
+			  title: '温馨提示',  
+			  content: '登录失效,请重新登录', 
+			  showCancel: false,
+			  success: (res) => {
+				  if(res.confirm){
+					  uni.reLaunch({
+					      url: '/pages/login/login'
+					  });
+				  }
+			  } 
+			});
 			// uni.reLaunch({
 			//     url: location.origin+'/#/pages/login/login'
 			// });