求助:原来用的是getUserInfo,怎么改成getUserProfile?

小程序 文章 2021-03-18 11:41 223 0 全屏看文

求助:原来用的是getUserInfo,怎么改成getUserProfile?Help: I ​​used getUserInfo, how to change it to getUserProfile?

求助:原来用的是getUserInfo,怎么改成getUserProfile?

求助:原来用的是getUserInfo,怎么改成getUserProfile?用下面的代码,按钮点了没反映,调用不了微信头像。

wxml:

<button open-type="getUserInfo"  bindgetuserinfo="bindGetUserInfo" class="btn">使用微信头像</button>

js:

bindGetUserInfo (e) {	    const that = this 		wx.getUserProfile({   					success (res){     	          if (res.authSetting['scope.userInfo']) { 	            	            wx.getUserInfo({   	              success: function(res) {  				       wx.downloadFile({   	                    url: res.userInfo.avatarUrl, 	                    success (res) {              	                        console.log(res.tempFilePath) 	                      if (res.statusCode === 200) {   	                        that.setData({                	                            imgg:res.tempFilePath    	                        })	                        that.create()	                      }	                    }	                })	                	              }	            })	          }	        }	    })	},


Request: The original use of getUserInfo, how to change the getUserProfile? using the following code, press 38062; points do not reflect, not use micro-headers. wxml: js: bindGetUserInfo (e) { const that = this subset;: 9; wx.getUserProfile ({ strictly & & strictly & & strictly; & & strictly; & # 160;) (res){ 0 ± 0 ± 0 ± 0 ± 0 if ( res.authSetting [' scope.userInfo ']) { 2 ; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + wx.getUserInfo == sync, corrected by elderman == sync, corrected by elderman == sync, corrected by elderman == sync, corrected by elderman == sync, corrected by elderman == sync, corrected by elderman == wx.downloadFile ({ 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + res.userInfo.avatarUrl (%s) Long term success console.log ( res.tempFilePath ) res.statusCode === 200) { ≥ 9,000 ≥ 1,000 setData I'm sorry. imgg:res.tempFilePath   I'm sorry. that.create ()* 9; t t t t t From } = 9; → }) = 9;},

回答:

默垂眸:
wx.getUserProfile 获取用户信息的这个API不会给你返回用户的授权信息的 你的代码问题 去掉就行了


还有这两个API不要同时调用

Brother斌🎈:
<view bindtap="bindGetUserProfile">点击</view>bindGetUserProfile() {	    const that = this 		wx.getUserProfile({    desc:'测试'  		  		 success (res){     	       console.log(res)    	      }	    })	},


-EOF-