Procházet zdrojové kódy

内嵌webview登录跳转手机号

xueyihao před 4 měsíci
rodič
revize
4e7643dc7f

+ 9 - 5
src/pages/login/wxLogin.vue

@@ -59,7 +59,7 @@
 				isLogin: false,
 				isLogin: false,
 				token: '',
 				token: '',
 				look:false,
 				look:false,
-        isWechat:navigator.userAgent.toLowerCase().includes('micromessenger'),
+        isWechat:true,
         phone: '',
         phone: '',
         code: '',
         code: '',
         countdown: 60,
         countdown: 60,
@@ -75,6 +75,13 @@
       canBind() {
       canBind() {
         return this.phone && this.validatePhone(this.phone) && this.code && this.code.length === 6 && !this.isBinding
         return this.phone && this.validatePhone(this.phone) && this.code && this.code.length === 6 && !this.isBinding
       }
       }
+    },
+    onLoad(options) {
+      if(options.type === 'webview'){
+        this.isWechat = false;
+      }else {
+        this.isWechat = navigator.userAgent.toLowerCase().includes('micromessenger');
+      }
     },
     },
 		methods: {
 		methods: {
 			goPrivacy(){
 			goPrivacy(){
@@ -226,10 +233,7 @@
             })
             })
           }
           }
       }
       }
-		},
-		onLoad(options) {
-
-    }
+		}
 	}
 	}
 </script>
 </script>
 
 

+ 3 - 2
src/points/pointInfo/billPage.vue

@@ -192,6 +192,7 @@ export default {
     },
     },
     // H5 返回强制刷新
     // H5 返回强制刷新
     __h5BackRefresh() {
     __h5BackRefresh() {
+      console.log('返回强制刷新---广誉源')
       if(this.currentPlatform && this.currentUser && uni.getStorageSync('access-token')){
       if(this.currentPlatform && this.currentUser && uni.getStorageSync('access-token')){
         this.bindAccount();//若没有登录。登录后获取绑定信息
         this.bindAccount();//若没有登录。登录后获取绑定信息
       }
       }
@@ -217,13 +218,13 @@ export default {
             if(_this.uuId){
             if(_this.uuId){
               _this.uuLogin();
               _this.uuLogin();
             }else{
             }else{
-              if (!_this.$utils.checkLogin({ type: 'navigate' })) return;
+              if (!_this.$utils.checkLogin({ type: 'navigate-webview' })) return;
             }
             }
           }else{
           }else{
             _this.fetchPointDetails()
             _this.fetchPointDetails()
           }
           }
         }else{
         }else{
-          if (!_this.$utils.checkLogin({ type: 'navigate' })) return;
+          if (!_this.$utils.checkLogin({ type: 'navigate-webview' })) return;
         }
         }
       })
       })
     },
     },

+ 17 - 9
src/utils/index.js

@@ -94,15 +94,23 @@ const otherUtil = {
 
 
 		const token = uni.getStorageSync('access-token') || '';
 		const token = uni.getStorageSync('access-token') || '';
 		const isLogin = !!token;
 		const isLogin = !!token;
-		
+
 		// 后退参数
 		// 后退参数
 		let str = uni.$u.queryParams({ isBack: 1 });
 		let str = uni.$u.queryParams({ isBack: 1 });
 		// 跳转路由
 		// 跳转路由
 		let path = `/pages/login/wxLogin${str}`;
 		let path = `/pages/login/wxLogin${str}`;
-
 		// 未登录时,根据 type 执行对应操作
 		// 未登录时,根据 type 执行对应操作
 		if (!isLogin) {
 		if (!isLogin) {
 			switch (type) {
 			switch (type) {
+				case 'navigate-webview':
+					// 跳转登录页内嵌
+					uni.navigateTo({
+						url: path+'&type=webview',
+						success: () => {
+							console.log('未登录,已跳转至登录页');
+						}
+					});
+					break;
 				case 'navigate':
 				case 'navigate':
 					// 跳转登录页(带返回跳转,可返回原页面)
 					// 跳转登录页(带返回跳转,可返回原页面)
 					uni.navigateTo({
 					uni.navigateTo({
@@ -112,7 +120,7 @@ const otherUtil = {
 						}
 						}
 					});
 					});
 					break;
 					break;
-			
+
 				case 'modal':
 				case 'modal':
 					// 弹窗提示,确认后跳转登录页
 					// 弹窗提示,确认后跳转登录页
 					uni.showModal({
 					uni.showModal({
@@ -127,7 +135,7 @@ const otherUtil = {
 						}
 						}
 					});
 					});
 					break;
 					break;
-			
+
 				// 默认:仅返回登录状态,不执行额外操作
 				// 默认:仅返回登录状态,不执行额外操作
 				default:
 				default:
 					console.log('未登录,仅返回登录状态');
 					console.log('未登录,仅返回登录状态');
@@ -155,21 +163,21 @@ const otherUtil = {
 		if (!e || typeof e !== 'string') {
 		if (!e || typeof e !== 'string') {
 		  	return [];
 		  	return [];
 		}
 		}
-	  
+
 		// 分割图片字符串为数组
 		// 分割图片字符串为数组
 		const imgArr = e.split(',');
 		const imgArr = e.split(',');
-	  
+
 		// 判断index是否为null/undefined(用户传空时),返回完整数组
 		// 判断index是否为null/undefined(用户传空时),返回完整数组
 		if (index === null || index === undefined) {
 		if (index === null || index === undefined) {
 		  	return imgArr;
 		  	return imgArr;
 		}
 		}
-	  
+
 		// 处理索引:确保是整数,且在有效范围内(0 <= index < 数组长度)
 		// 处理索引:确保是整数,且在有效范围内(0 <= index < 数组长度)
 		const validIndex = Math.floor(Number(index)); // 转为整数(避免传入字符串/小数)
 		const validIndex = Math.floor(Number(index)); // 转为整数(避免传入字符串/小数)
 		if (isNaN(validIndex) || validIndex < 0 || validIndex >= imgArr.length) {
 		if (isNaN(validIndex) || validIndex < 0 || validIndex >= imgArr.length) {
 		  	return ''; // 索引无效时,返回空字符串(避免显示错误图片)
 		  	return ''; // 索引无效时,返回空字符串(避免显示错误图片)
 		}
 		}
-	  
+
 		// 返回指定索引的图片URL
 		// 返回指定索引的图片URL
 		return imgArr[validIndex];
 		return imgArr[validIndex];
 	},
 	},
@@ -187,4 +195,4 @@ const otherUtil = {
 export default {
 export default {
 	...formatUtil,
 	...formatUtil,
 	...otherUtil,
 	...otherUtil,
-};
+};