柒零 1 yıl önce
ebeveyn
işleme
671e44f6f0

+ 15 - 13
componets/authorized-login-dialog/authorizedLoginDialog.js

@@ -265,18 +265,31 @@ Component({
             console.log('loginRes=' + JSON.stringify(loginRes));
             console.log('loginRes.data=' + JSON.stringify(loginRes.data));
             if (loginRes.data.codes && loginRes.data.codes == 'success') {
+              that.setData({ showLoading: false });
               console.log('123123123');
               console.log('loginRes.data.back.unionid=' + loginRes.data.back.unionid);
               console.log('loginRes.data.back.openid=' + loginRes.data.back.openid);
               wx.setStorageSync('unionid', loginRes.data.back.unionid);
               wx.setStorageSync('openid', loginRes.data.back.openid);
               // 获取后台授权
-              that.startInterval();
+              // that.startInterval();
               // 可以在这里提示用户进行手机号授权  
               that.setData({
+                disableCommitBtn: false,
                 unionid: loginRes.data.back.unionid,
                 openid: loginRes.data.back.openid,
               });
+              wx.setStorageSync('userInfo', {
+                unionid: that.data.unionid,
+                openid: that.data.openid,
+                session_key: that.data.session_key,
+                nickName: that.data.nickName,
+                avatarUrl: that.data.avatarUrl,
+                encryptphone: that.data.encryptphone,
+                phoneNumber: that.data.phoneNumber
+              })
+              wx.setStorageSync('hasAuth', true);
+              that.triggerEvent('authorizationSuccessful', true);
             } else {
               that.setData({ showLoading: false });
               wx.showToast({
@@ -304,7 +317,7 @@ Component({
         // 可以选择在这里处理用户拒绝授权后的逻辑,如跳转到其他页面或显示提示信息  
       }
     },
-    // 轮询后台信息
+    // 轮询后台信息 暂时废弃
     startInterval: function () {
       var that = this;
       this.data.intervalId = setInterval(() => {
@@ -326,17 +339,6 @@ Component({
               wx.setStorageSync('hasAuth', true);
               wx.setStorageSync('hotelEmpower', intervalRes.data.hotel);
               wx.setStorageSync('roomEmpower', intervalRes.data.room);
-              wx.setStorageSync('userInfo', {
-                hotel: intervalRes.data.hotel,
-                room: intervalRes.data.room,
-                unionid: that.data.unionid,
-                openid: that.data.openid,
-                session_key: that.data.session_key,
-                nickName: that.data.nickName,
-                avatarUrl: that.data.avatarUrl,
-                encryptphone: that.data.encryptphone,
-                phoneNumber: that.data.phoneNumber
-              })
               that.setData({
                 disableCommitBtn: false,
               });