fix: 优化小程序登录

master
misworga831 2023-08-10 14:19:23 +08:00
parent 53917d32c0
commit 82810eb179
1 changed files with 58 additions and 48 deletions

View File

@ -92,17 +92,25 @@
// //
async getUserProfile(e) { getUserProfile(e) {
let that = this; let that = this;
//code //code
await uni.login({ uni.login({
success: (res) => { success: (res) => {
if(res.errMsg == "login:ok") {
that.code = res.code
} else {
uni.showToast({
title: "系统异常,请联系管理员!"
})
}
that.code = res.code; that.code = res.code;
}, },
}); });
if (this.code) {
// 使wx.getUserProfile // 使wx.getUserProfile
await uni.getUserProfile({ uni.getUserProfile({
desc: "用于完善会员资料", // desc: "用于完善会员资料", //
success: (res) => { success: (res) => {
that.nickName = res.userInfo.nickName; that.nickName = res.userInfo.nickName;
@ -150,6 +158,8 @@
}, },
}); });
}
}, },
// //