Logic Sri Lanka Return (Returning to the chance of numbers) jn

2022-12-20   ES  

Get user information

This is click the login button to get user information

  <image src="{
  <view wx:if="{
   <Button wx: else open-type = "getuserinfo" bindgetUserInfo = "ONEGETUSERINFO"> Login </Button>

On the corresponding page JS file:

	data: {
		userInfo: {}

Here you need to keep the function of obtaining information in the app.js:

 App ({{ 
   onlaunch: function () { 
     // Run the cloud function to configure it 
     wx.cloud.init (); 

     // Log in 
     wx.login ({{ 
       Success: res => { 
         // Send res.code to the background in exchange for openid, sessionkey, unionid 
     // Get user information 
     wx.getSetting ({{ 
       Success: res => { 
         if (res.authSetting ['scope.userinfo'] {) { 
           // I have been authorized, you can directly call getuserinfo to get the avatar nickname, you will not play the frame 
           wx.getUserInfo ({{ 
             Success: res => { 
               // You can send the Res to the background to decode the unionid 
               this.globaldata.userinfo = res.userinfo 

               // Since getuserinfo is a network request, it may be returned after pay.onload 
               // So add callback here to prevent this 
               if (this.userinForeADYCALLLLLK) { 
                 this.userinForeADYCALLLLK (res) 
   globaldata: { 
     userInfo: null 


Related Posts

MySQL InsertorUpDate is updated, and inserts in CAPPADOCIA when there is no existence

nr CSI (3) CQI

adt upgrade leads to FILENOTFOUNDEXCEUON solution

Business operation and maintenance actual combat: How does Tencent optimize the APP user experience?

Logic Sri Lanka Return (Returning to the chance of numbers) jn

Random Posts

POJ 1797 Heavy Transportation

Python realizes Apple (recursion)

python2.7 and 3.5 dual versions coexist and the use of PIP

ubuntu18.04 Install Fast-DDS-PYTHON and use case reference

Maven project uses log4j configuration output log pengyao