zhaojs
2023-06-27 338b2fd1c682864ddc6e3372887a38c1820c1805
uniapp/pages/login/wxlogin.vue
@@ -47,13 +47,14 @@
            isread: false,
            haswxlogin: false,
            isSupportMob:false,
            isother:false
            isother:false,
            clientid:''
         }
      },
      onLoad() {
         this.appInfo = uni.getStorageSync('appInfo')
         console.log(this.appInfo.iosExamine)
         console.log(getApp().globalData.ifwt)
         //console.log(this.appInfo.iosExamine)
         //console.log(getApp().globalData.ifwt)
         //this.haswxlogin = this.appInfo.iosExamine ? false : (getApp().globalData.ifwt == 1 ? true : false)
         this.haswxlogin = getApp().globalData.ifwt == 1 ? true :false;
         this.isSupportMoblie();
@@ -86,7 +87,6 @@
                  // 不显示一键登录选项(或置灰)
                // 根据错误信息判断失败原因,如有需要可将错误提交给统计服务器
                  console.log(res)
                  console.log(res.errMsg)
               }
            })
         },
@@ -97,7 +97,8 @@
              name: 'getPhoneNumber', // 你的云函数名称
              data: {
                'access_token': mobRes.access_token, // 客户端一键登录接口返回的access_token
                'openid': mobRes.openid // 客户端一键登录接口返回的openid
                'openid': mobRes.openid ,// 客户端一键登录接口返回的openid
               'push_cid':that.clientid//客户端推送的cid
              }
            }).then(res => {
               console.log(res)
@@ -107,10 +108,8 @@
            }).catch(err=>{
               // 处理错误
               console.log(err)
               uni.hideLoading();
               that.isother=true;
               that.$alert('获取手机号码失败,请使用其他方式登录')
               setTimeout(function(){
                  univerifyManager.close();
               },2000);
@@ -120,6 +119,12 @@
         mobileLogin()
         {
            var that=this;
            // #ifdef APP-PLUS
                plus.push.getClientInfoAsync((info) => {
                     that.clientid = info["clientid"];
                });
            // #endif
            if (this.isread) {
               univerifyManager.login({
                  provider: 'univerify',
@@ -191,6 +196,11 @@
         },
         wxlogin() {
            var that = this;
            // #ifdef APP-PLUS
                plus.push.getClientInfoAsync((info) => {
                     that.clientid = info["clientid"];
                });
            // #endif
            if (this.isread) {
               uni.getProvider({
                  service: 'oauth',
@@ -200,10 +210,12 @@
                        uni.login({
                           provider: 'weixin',
                           success: (loginRes) => {
                              console.log(loginRes);
                              that.$u.api.wxapplogin({
                                 openid: loginRes.authResult.openid,
                                 access_token: loginRes.authResult.access_token
                              }).then(e => {
                                 console.log(e);
                                 if (e.code != 0) return that.$alert(e.msg)
                                 var res = e.data;
                                 if(res.type == 'goUser'){