x***@sina.com
x***@sina.com
  • 发布:2022-11-28 09:55
  • 更新:2023-03-01 18:41
  • 阅读:233

Uni-app 打包apk微信一键登录无效

分类:uni-app

安卓微信一键登录代码,在本地使用模拟器可以完成登录,但是打包成apk之后在真机上无法唤起微信,mainifest.json 已经配置过了微信登录,添加了 appid 求教问题出现在哪儿

 uni.login({  
              provider: 'weixin',  
              success: (loginRes) => {  
                // 微信用户信息存入本地,后期备用  
                var auth = null  
                plus.oauth.getServices(  
                  (services) => {  
                    auth = services.find(service => {  
                      return service.id === 'weixin'  
                    })  
                    try {  
                      uni.setStorageSync('auth_service', auth)  
                    } catch { }  
                  },  
                  function (e) {  
                    console.log(e)  
                  }  
                )  
                if (loginRes.authResult) {  
                  this.$axios.post('/api/wxUser/loginApp.json', {  
                    openId: loginRes.authResult.openid  
                  }).then(res => {  
                    if (res.success) {  
                      this.$store.commit("setLogin", res.result);  
                      uni.getUserInfo({  
                        provider: 'weixin',  
                        success: (infoRes) => {  
                          this.$store.commit("setUserInfo", infoRes.userInfo);  
                        }  
                      });  
                      uni.navigateTo({  
                        url: '/pages/tags/index'  
                      })  
                    }  

                  })  
                } else {  
                }  
              },  
              fail(e) {  
                console.log(e)  
              }  
            })
2022-11-28 09:55 负责人:无 分享
已邀请:
九月的阿信

九月的阿信

解决了没呢? 什么问题导致的?

  • x***@sina.com (作者)

    没解决

    2023-03-03 08:48

  • 九月的阿信

    回复 x***@sina.com: 持续关注一下,解决了记得来填一下坑.

    2023-04-21 11:36

要回复问题请先登录注册