发现微信开发工具和手机 通过getUserInfo 获取的头像的路径不一样 开发工具获取的是对的 但是手机测试的时候不对 开发工具获取的可以显示但是手机获取的不能显示 开发工具获取的https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJ2GuAvvKecNTC3ia8icrVFs9mSkfSdysuOdt3SrqELZmk60Sk6UrdYAQk8iayG2GemULRKBJuia9WR5A/132 手机测试获取的 https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132
在微信开发者工具上能获取到头像的url,但是在手机上测试(已授权),头像的url为空?wx.getUserInfo({ success: res => { this.globalData.userInfo = res.userInfo this.globalData.nickname = res.userInfo.nickName //获取用户头像 var userInfo = res.userInfo var avatarUrl = userInfo.avatarUrl; //获取微信用户头像存放的Url wx.getImageInfo({ src: avatarUrl, success: function (res) { //访问存放微信用户头像的Url that.globalData.userimg = res.path } }) console.log(that.globalData.userimg) if (this.userInfoReadyCallback) { this.userInfoReadyCallback(res) }
2021-06-29