lsc 3 months ago
parent
commit
5312eb8666
1 changed files with 5 additions and 18 deletions
  1. 5 18
      src/views/login/loginPage.vue

+ 5 - 18
src/views/login/loginPage.vue

@@ -299,7 +299,7 @@ export default {
 					id: "QRcode", 
 					appid: "wxe9d7fff3c659445f", 
 					scope: "snsapi_login", 
-					redirect_uri: encodeURIComponent("https://cocorobo.cn"),//https://liyuan.cocorobo.cn/#/wxTest
+					redirect_uri: encodeURIComponent("https://cocorobo.cn/weixin.html"),//https://liyuan.cocorobo.cn/#/wxTest
 					state: randomState,
 					style: "black",
 					href: "data:text/css;base64,LmltcG93ZXJCb3gge2Rpc3BsYXk6IGZsZXg7fQouaW1wb3dlckJveCAucXJjb2RlIHt3aWR0aDogMjMycHg7IGhlaWdodDogMjMycHh9Ci5pbXBvd2VyQm94IC50aXRsZSB7ZGlzcGxheTogbm9uZTt9Ci5pbXBvd2VyQm94IC5pbmZvIHtkaXNwbGF5OiBub25lO30KLmxvZ2luUGFuZWx7d2lkdGg6MTAwJTtoZWlnaHQ6MTAwJTtkaXNwbGF5OmZsZXg7ZmxleC1kaXJlY3Rpb246Y29sdW1uO2FsaWduLWl0ZW1zOmNlbnRlcjtqdXN0aWZ5LWNvbnRlbnQ6Y2VudGVyO30KLnN0YXR1c19pY29uIHtkaXNwbGF5OiBub25lfQoud2ViX3FyY29kZV9wYW5lbF9hcmVhe2hlaWdodDoxMDAlO3dpZHRoOjEwMCU7ZGlzcGxheTpmbGV4O2FsaWduLWl0ZW1zOmNlbnRlcjtqdXN0aWZ5LWNvbnRlbnQ6Y2VudGVyO30K",
@@ -313,27 +313,14 @@ export default {
 					iframe.style.height = '100%'
 					
 				}, 0);
-				let timer = setInterval(() => {
-					let iframe = this.$refs.QRcode && this.$refs.QRcode.querySelector('iframe')
-					console.log(iframe);
-					
-					try {
-						if(iframe.contentWindow.location.search.includes('code')){
-							this.loginType = 'bind'
-							console.log(iframe.contentWindow.location.search);
-							
-							clearInterval(timer)
-						}
-					} catch (error) {
-						// console.log(error);
-						
-					}
-
-				}, 50);
 			},0);
 		}
 	},
 	mounted() {
+		window.addEventListener('message', function (e) { // 监听 message 事件
+			console.log(e);
+			this.loginType = 'bind'
+		});
 		// this.getLoading();
 		this.getOrdOidData();
 	},