Specific use of the wx.getUserProfile interface in the applet

Specific use of the wx.getUserProfile interface in the applet

Recently, WeChat Mini Program has proposed adjustments to the wx.login and wx.getUserInfo interfaces for the audit mini program, and proposed a new interface for developers to call

The following figure is the official document details for the new interface

Click to visit the official website for more details

insert image description here

insert image description here

It is worth noting that the new interface wx.getUserProfile can only be called using catchtap or bindtap (ps: it can be used in wx.showmodel), and cannot be called directly in onload, onshow, etc., and the return parameters have changed.

The following figure shows the data type returned by the new interface wx.getUserProfile

// An highlighted block
 wx.showModal({
   title: 'Warm Tips',
   content: 'Requesting your personal information',
   success(res) {
     if (res.confirm) {
       wx.getUserProfile({
       desc: "Get your nickname, avatar, region and gender",
       success: res => {
         console.log(res)
         let wxUserInfo = res.userInfo;
       },
       fail: res => {
       	 //Reject authorization that.showErrorModal('You rejected the request');
         return;
       }
     })} else if (res.cancel) {
       //Reject authorization showErrorModal is a custom prompt that.showErrorModal('You rejected the request');
       return;
     }
   }
 })

insert image description here

The new version of wx.login interface returns. The interface return of wx.getUserInfo remains unchanged for the time being. User information can no longer be directly obtained.

wx.login

insert image description here

wx.getUserInfo

insert image description here

I spent some time working on this new interface. Maybe I am not very good at it (no, ヽ(≧□≦)ノ). Anyway, this matter has finally come to a head, right? I hope this can help more friends! <( ̄︶ ̄)>

This is the end of this article about the specific use of the wx.getUserProfile interface of the mini program. For more relevant content about the wx.getUserProfile interface of the mini program, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Axios-like request encapsulated based on the applet request interface wx.request
  • The applet encapsulates the wx.request request and creates an interface management file
  • WeChat applet wx.request (interface calling method) detailed explanation and examples

<<:  MySQL's conceptual understanding of various locks

>>:  Analysis of Hyper-V installation CentOS 8 problem

Recommend

Summary of Linux nc command

NC's full name is Netcat (Network Knife), and...

How to realize vertical arrangement of text using CSS3

In a recent project, I wanted to align text verti...

Vue must learn knowledge points: the use of forEach()

Preface In front-end development, we often encoun...

MySQL quick recovery solution based on time point

The reason for writing such an article is that on...

Supplementary article on front-end performance optimization

Preface I looked at the previously published arti...

Detailed explanation of the difference between CSS link and @import

How to add css in html? There are three ways to s...

Start nginxssl configuration based on docker

Prerequisites A cloud server (centOS of Alibaba C...

Native js implementation of magnifying glass component

This article example shares the specific code for...

MySQL conditional query and or usage and priority example analysis

This article uses examples to illustrate the usag...

Vue easily realizes watermark effect

Preface: Use watermark effect in vue project, you...

A brief discussion on docker-compose network settings

Networks usage tutorial Official website docker-c...

How to display TIF format images in browser

The browser displays TIF format images Copy code T...