fix: 优化小程序登录
parent
53917d32c0
commit
82810eb179
|
@ -92,17 +92,25 @@
|
|||
|
||||
|
||||
//获取用户信息
|
||||
async getUserProfile(e) {
|
||||
getUserProfile(e) {
|
||||
let that = this;
|
||||
//获取code
|
||||
await uni.login({
|
||||
uni.login({
|
||||
success: (res) => {
|
||||
if(res.errMsg == "login:ok") {
|
||||
that.code = res.code
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "系统异常,请联系管理员!"
|
||||
})
|
||||
}
|
||||
that.code = res.code;
|
||||
},
|
||||
});
|
||||
|
||||
if (this.code) {
|
||||
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
|
||||
await uni.getUserProfile({
|
||||
uni.getUserProfile({
|
||||
desc: "用于完善会员资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
||||
success: (res) => {
|
||||
that.nickName = res.userInfo.nickName;
|
||||
|
@ -150,6 +158,8 @@
|
|||
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//获取手机号授权
|
||||
|
|
Loading…
Reference in New Issue