当前位置:网站首页>Uniapp obtains login authorization and mobile number authorization (sorting)
Uniapp obtains login authorization and mobile number authorization (sorting)
2022-06-21 20:02: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"> Natural and beautiful , Yours </view>
</view>
<button @click="getUserProfile"> Get user information </button>
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="login-but"> Get cell phone number </button>
</view>
</template>
<script>
export default {
data() {
return {
info:[]
}
},
onLoad(){
let that = this;
uni.login({
provider: 'weixin',
success: function(loginRes) {
// Get user information
console.log(loginRes.code)
}
});
},
methods: {
getUserProfile() {
let that =this
uni.getUserProfile({
desc:" Used to improve user information ",
success: (res1) => {
that.info = res1.userInfo;
console.log(res1)
uni.showToast({
icon:"none",
title:' To be successful '
})
},
fail: (err) => {
console.log(err)
uni.showToast({
icon:"none",
title:' User refused to get '
})
}
})
},
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>
边栏推荐
- 07_那些可以改变你认知的知识
- [high frequency interview questions] difficulty 1/5, popular enumeration simulation questions
- Gradle download and installation configuration
- ArrayList源码解析
- [high frequency interview questions] linked list interview questions with 1/5 difficulty and lower difficulty
- Introduction to machine learning
- 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
- Using fastjson to deserialize simplegrantedauthority in the security framework
- MySQL must know - Chapter 9 - Search with regular expressions
- 删除倒数第k个节点-链表专题
猜你喜欢

动态规划【二】(线性dp)

《安富莱嵌入式周报》第270期:2022.06.13--2022.06.19

尚硅谷 尚硅谷 | 什么是ClickHouse表引擎 Memory和Merge

Grain College p40~43

How to use devaxpress WPF to create the first MVVM application in winui?

汇编语言贪吃蛇、俄罗斯方块双任务设计实现详解(一)——整体系统设计

自定义代码模板

Tensorflow 2: use neural network to classify and compare fashion MNIST

NPDP|如何做好产品生命周期管理?

在 KubeSphere 上部署 Apache Pulsar
随机推荐
转发提醒 MetaMask小狐狸钱包安全公告 如何应对拓展程序潜在的私钥泄露
谷歌浏览器80版本以后,如何处理出现的问题SameSite跨域问题
A simple architecture design logic | acquisition technology
DataGear 使用坐标映射表制作地理坐标数据可视化看板
Jupyter Notebook 将ipynb文件编译成latex再转为pdf
论文解读(USIB)《Towards Explanation for Unsupervised Graph-Level Representation Learning》
The R language uses rbind The fill function vertically merges dataframe data of two different data columns
理财产品到期当日能赎回吗?
CloudCompare&PCL 根据匹配点计算变换矩阵
508. Most Frequent Subtree Sum
汇编语言贪吃蛇、俄罗斯方块双任务设计实现详解(一)——整体系统设计
Using fastjson to deserialize simplegrantedauthority in the security framework
Manjaro installs the downloaded TTF font file
6月25日PMP考前指南,你需要做好这些
508. Most Frequent Subtree Sum
JVM内存结构
RecycleView懒加载失效问题
【时序预测完整教程】以气温预测为例说明论文组成及PyTorch代码管道构建
简单使用JS
RestTemplate多个认证信息Authorization问题