李旭东
2023-12-08 7efc6ed86025b610cab109a2e9f83362740d8ed4
xcx/pages/loginIndex/index.vue
@@ -40,7 +40,8 @@
                     </template>
                  </u-input>
               </u-form-item>
               <u-text type="primary" text="立即注册" @click="navGotoRegister()"></u-text>
               <!-- <u-text type="primary" text="立即注册" @click="navGotoRegister()"></u-text> -->
               <u-text type="primary" text="管理员电话:13800138008"></u-text>
               <view class="login_content_button">
                  <u-button 
                     type="primary" 
@@ -92,69 +93,72 @@
      },
      onShow() {
         const that = this;
         uni.clearStorage();
         uni.clearStorageSync();
         wx.getSetting({
            complete: (info) => {
               if(!info.authSetting['scope.userInfo']) {
                  uni.showModal({
                     title: '提示',
                     content: '是否授权获取您的信息,该信息仅用于确认身份信息',
                     success: function (res) {
                        if (res.confirm) {
                           wx.login({
                              success(res) {
                                 uni.$u.toast('授权成功!');
                                 that.$api.system.getUserInfo(res.code).then((res) => {
                                    if(res.success) {
                                       uni.setStorageSync('openId', res.data.openid);
                                       that.$api.system.changeWChartUser({
                                          openId: res.data.openid
                                       }).then((reslut) => {
                                          console.log(reslut);
                                          that.switchUserInfo(reslut.data.regstatus, reslut.data.reginfo);
                                       })
                                    } else {
                                       uni.$u.toast(res.statusMsg);
                                    }
                                 })
                              },
                              fail: (err) => {
                                 console.log(err,'---');
                              }
                           })
                        } else if (res.cancel) {
                           wx.exitMiniProgram({
                              success: (res) => {
                                 console.log(res,'--');
                              }
                           })
                        }
                     }
                  });
               } else {
                  wx.login({
                     success(res) {
                        that.$api.system.getUserInfo(res.code).then((res) => {
                           if(res.success) {
                              uni.setStorageSync('openId', res.data.openid);
                              that.$api.system.changeWChartUser({
                                 openId: res.data.openid
                              }).then((reslut) => {
                                 that.switchUserInfo(reslut.data.regstatus, reslut.data.reginfo);
                              })
                           } else {
                              uni.$u.toast(res.statusMsg);
                           }
                        })
                     },
                     fail: (err) => {
                        console.log(err,'---');
                     }
                  })
               }
            }
         })
         // uni.clearStorage();
         // uni.clearStorageSync();
         // wx.getSetting({
         //    complete: (info) => {
         //       if(!info.authSetting['scope.userInfo']) {
         //          uni.showModal({
         //             title: '提示',
         //             content: '是否授权获取您的信息,该信息仅用于确认身份信息',
         //             success: function (res) {
         //                if (res.confirm) {
         //                   wx.login({
         //                      success(res) {
         //                         uni.$u.toast('授权成功!');
         //                         that.$api.system.getUserInfo(res.code).then((res) => {
         //                            if(res.success) {
         //                               uni.setStorageSync('openId', res.data.openid);
         //                               that.$api.system.changeWChartUser({
         //                                  openId: res.data.openid
         //                               }).then((reslut) => {
         //                                  console.log(reslut);
         //                                  that.switchUserInfo(reslut.data.regstatus, reslut.data.reginfo);
         //                               })
         //                            } else {
         //                               uni.$u.toast(res.statusMsg);
         //                            }
         //                         })
         //                      },
         //                      fail: (err) => {
         //                         console.log(err,'---');
         //                      }
         //                   })
         //                } else if (res.cancel) {
         //                   wx.exitMiniProgram({
         //                      success: (res) => {
         //                         console.log(res,'--');
         //                      }
         //                   })
         //                }
         //             }
         //          });
         //       } else {
         //          wx.login({
         //             success(res) {
         //                that.$api.system.getUserInfo(res.code).then((res) => {
         //                   if(res.success) {
         //                      uni.setStorageSync('openId', res.data.openid);
         //                      that.$api.system.changeWChartUser({
         //                         openId: res.data.openid
         //                      }).then((reslut) => {
         //                         that.switchUserInfo(reslut.data.regstatus, reslut.data.reginfo);
         //                         // uni.navigateTo({
         //                         //    url: '../../robePages/safeManage/addHidden'
         //                         // })
         //                      })
         //                   } else {
         //                      uni.$u.toast(res.statusMsg);
         //                   }
         //                })
         //             },
         //             fail: (err) => {
         //                console.log(err,'---');
         //             }
         //          })
         //       }
         //    }
         // })
      },
      onReady() {
         this.$refs.form.setRules(this.rulesLogin);