Browse Source

1. 调整登录方式

MONSTER-ygh 1 year ago
parent
commit
4917bd628a
1 changed files with 4 additions and 2 deletions
  1. 4 2
      pages/login/login.vue

+ 4 - 2
pages/login/login.vue

@@ -273,9 +273,10 @@
 			async login(e){
 				// console.log('e',e);
 				let _this = this;
-				let wxinfo = await this.$u.api.wxinfo({code:this.code});
+				let wxinfo = null
 				let data = {}
 				// #ifdef MP
+				wxinfo = await this.$u.api.wxinfo({code:this.code});
 				let {openid,sessionKey,unionid} = wxinfo.data;
 				
 				_this.$u.vuex('vuex_wechatOpenid', openid);
@@ -305,6 +306,7 @@
 				// #endif
 				
 				// #ifdef H5
+				wxinfo = await this.$u.api.wxinfoH5({code:this.code});
 				let { openid } = wxinfo.data;
 				data = {
 					"openId": "",
@@ -458,7 +460,7 @@
 			/**  公众号 微信授权登录  */
 			redirectToAuth() {
 			    const appid = 'wx6490eaa0d20d2be2';
-			    const redirectUri = encodeURIComponent('https://greath5.dev.gztjy.top/pages/login/loginh5');
+			    const redirectUri = encodeURIComponent('https://greath5.dev.gztjy.top/pages/login/login');
 			    const authUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`;
 			 
 			    window.location.href = authUrl;