当前位置:网站首页>uniapp获取登录授权和手机号授权(整理)
uniapp获取登录授权和手机号授权(整理)
2022-06-21 18:16:00 【000000001111】
<template>
<view>
<view class="tx-w">
<view class="tx">
<image class="tx-img" :src="info.avatarUrl"></image>
<view class="zx"></view>
</view>
<view class="name">{
{
info.nickName}} </view>
<view class="name-qm">自然的美好的,你的</view>
</view>
<button @click="getUserProfile"> 获取用户信息 </button>
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="login-but">获取手机号</button>
</view>
</template>
<script>
export default {
data() {
return {
info:[]
}
},
onLoad(){
let that = this;
uni.login({
provider: 'weixin',
success: function(loginRes) {
// 获取用户信息
console.log(loginRes.code)
}
});
},
methods: {
getUserProfile() {
let that =this
uni.getUserProfile({
desc:"用于完善用户信息",
success: (res1) => {
that.info = res1.userInfo;
console.log(res1)
uni.showToast({
icon:"none",
title:'获取成功'
})
},
fail: (err) => {
console.log(err)
uni.showToast({
icon:"none",
title:'用户拒绝获取'
})
}
})
},
getPhoneNumber(e){
console.log(e.detail)
}
}
}
</script>
<style>
.tx-w{
margin-top:200upx;
}
.tx{
text-align:center;
}
.tx image{
width:140upx;
height:140upx;
border-radius: 50%;
}
.name{
text-align:center;
margin-top:20upx;
}
.name-qm{
text-align:center;
margin-top:20upx;
font-size:30upx;
}
</style>
边栏推荐
- Forwarding to remind metamask how to deal with the potential private key disclosure of the expansion program
- Medical expense list can be entered at a second speed, and OCR recognition can help double the efficiency
- The GLM function of R language is used to build a binary logistic regression model (the family parameter is binomial), and the summary function is used to view the summary statistical information of t
- The GLM function of R language is used to build a binary logistic regression model (the family parameter is binomial), and the coef function is used to obtain the model coefficients and analyze the me
- Two ways of encrypting Excel files
- How does the easycvr intelligent edge gateway hardware set power on self start?
- 508. Most Frequent Subtree Sum
- 动态规划【一】(背包问题)
- HMS core machine learning service ID card identification function to achieve efficient information entry
- Manjaro installs the downloaded TTF font file
猜你喜欢

Medical expense list can be entered at a second speed, and OCR recognition can help double the efficiency

API interface for discharge summary identification - medical bill OCR identification / discharge diagnosis record / electronic medical record / claim settlement service

【ICML2022】CtrlFormer: 通过Transformer学习视觉控制的可迁移状态表示

Leetcode personal question solution (Sword finger offer 21-25) 21 Adjust the array order so that odd numbers precede even numbers, 22 The penultimate node in the linked list, 24 Reverse linked list, 2

HMS core machine learning service ID card identification function to achieve efficient information entry

gorm数据库是否需要设置外键

With a playback volume of up to 4000w+, how do couples get out of the ring by scattering dog food?

Kubernetes 跨 StorageClass 迁移 Persistent Volumes 完全指南

CPDA|数据分析师需要具备哪些基本功?

W10添加系统环境变量Path
随机推荐
2022年6月25日PMP考试通关宝典-4
动态规划【一】(背包问题)
pnpm 中无法使用 patch-package 打补丁
SQL operation: with expression and its application
The dist function of R language calculates the distance between two samples in dataframe data and returns the distance matrix between samples. The distance matrix is input to the hclust function for h
NPDP|如何做好产品生命周期管理?
When the move protocol beta is in progress, the ecological core equity Momo is divided
2022年6月25日PMP考试通关宝典-5
How to temporarily modify samesite=none and secure in Chrome browser
基于k近邻的MNIST图像分类对比
MySQL必知必会-第九章-用正则表达式进行搜索
Yolov5 trains its own data set to report error records
C. Helping the Nature(cf)差分
机器学习之绪论
Use the uniapp framework to build the zheliban micro application (single sign on, embedded point, aging adaptation, RPC gateway)
系统集成项目管理工程师(软考中级)怎么备考?
Qt Creator 7.0常见问题和常见用法
RestTemplate多个认证信息Authorization问题
机器学习之贝叶斯分类与集成学习
inno setup 安装路径框学习