当前位置:网站首页>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>
边栏推荐
- 【CVPR2022】CMU《多模态机器学习》教程,200+页阐述表示、对齐、推理、迁移、生成与量化六大挑战的多模态学习系统知识
- 如何在Chrome浏览器中模拟请求或修改请求的域名
- 转发提醒 MetaMask小狐狸钱包安全公告 如何应对拓展程序潜在的私钥泄露
- 网管型全国产加固交换机如何创建网络冗余
- 记一些PAT题目(一)
- R语言使用plyr包的rbind.fill函数纵向合并两个数据列不同的dataframe数据
- Dynamic programming [1] (knapsack problem)
- Two problems that may occur in the use of ThreadLocal and thread pool
- 記一些PAT題目(一)
- 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
猜你喜欢

MFC interface library bcgcontrolbar v33.0 - Desktop alert window, grid control upgrade
![Dynamic programming [1] (knapsack problem)](/img/a6/3f60aa162b0597cf91a05bbc2d2b53.png)
Dynamic programming [1] (knapsack problem)

nacos-配置中心-源码

508. Most Frequent Subtree Sum

汇编语言贪吃蛇、俄罗斯方块双任务设计实现详解(三)——俄罗斯方块详细设计

Kubernetes 跨 StorageClass 迁移 Persistent Volumes 完全指南

yolov5训练自己的数据集报错记录

动态规划【一】(背包问题)

How to temporarily modify samesite=none and secure in Chrome browser

Whether Gorm database needs to set foreign keys
随机推荐
API de table & SQL et module d'échantillon pour le système Flink
Technology sharing | mysql:caching_ sha2_ Password quick Q & A
机器学习之聚类和降维与度量技术
Ogg-21.3 error reporting ogg-00768 failed to map database character to ulibcharaset
Using fastjson to deserialize simplegrantedauthority in the security framework
R language uses GLM function to build Poisson regression model, and coef function to obtain the coefficients of Poisson regression model and analyze the effects of various variables
nacos-配置中心-源码
自定义代码模板
机器学习之线性模型与决策树
TensorFlow 2:使用神经网络对Fashion MNIST分类并进行比较分析
WMS仓库仓储管理系统源码
yolov5训练自己的数据集报错记录
谷粒学院P40~43
Gradle下载与安装配置
Cloudcompare & PCL point cloud AABB bounding box
DataGear 使用坐标映射表制作地理坐标数据可视化看板
Codeforces Round #394 (Div. 2) E. Dasha and Puzzle
Linux MySQL command
【ICML2022】CtrlFormer: 通过Transformer学习视觉控制的可迁移状态表示
RecycleView懒加载失效问题