Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop-uniapp

master
Yer 2023-09-04 10:27:12 +08:00
commit bb4435fab4
1 changed files with 23 additions and 19 deletions

View File

@ -20,7 +20,7 @@
<view>您的公开信息昵称头像</view>
</view>
<view class="btns">
<button type="primary" bindtap="getUserProfile" @click="getUserProfile()"
<button type="primary" :disabled="logingFlag" bindtap="getUserProfile" @click="getUserProfile()"
class="btn-auth">登录</button>
<div @click="backToHome" class="btn-callback">暂不登录</div>
</view>
@ -54,6 +54,7 @@
code: "",
//
nickName: "",
logingFlag: false,
//
image: "",
};
@ -66,7 +67,19 @@
withShareTicket: true
});
let that = this;
//code
uni.login({
success: (res) => {
if(res.errMsg === "login:ok") {
this.code = res.code
} else {
uni.showToast({
title: "系统异常,请联系管理员!"
})
}
},
});
},
methods: {
@ -93,27 +106,16 @@
//
getUserProfile(e) {
let that = this;
//code
uni.login({
success: (res) => {
if(res.errMsg === "login:ok") {
that.code = res.code
} else {
uni.showToast({
title: "系统异常,请联系管理员!"
})
}
},
});
this.logingFlag = true;
if (this.code) {
// 使wx.getUserProfile
uni.getUserProfile({
desc: "用于完善会员资料", //
success: (res) => {
that.nickName = res.userInfo.nickName;
that.image = res.userInfo.avatarUrl;
console.log("success", res)
this.nickName = res.userInfo.nickName;
this.image = res.userInfo.avatarUrl;
/**
* 根据公有的配置设置登录方式
@ -152,13 +154,15 @@
});
});
});
},
fail: (res) => {
console.log("fail", res)
},
});
}
this.logingFlag = false;
}
},
//