feat: implement mobile number binding via WeChat and enforce phone verification for venue entry, booking, and card purchases
This commit is contained in:
@@ -93,6 +93,37 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
// 绑定手机号
|
||||
onBindPhone(e) {
|
||||
if (e.detail.errMsg === 'getPhoneNumber:fail user deny') {
|
||||
wx.showToast({ title: '已取消绑定', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
let that = this;
|
||||
wx.login({
|
||||
success: function (r) {
|
||||
wx.showLoading({ title: '绑定中...', mask: true });
|
||||
// 复用微信授权一键登录/绑定接口
|
||||
app.$api.memberLoginWXPhone({
|
||||
loginCode: r.code,
|
||||
phoneCode: e.detail.code
|
||||
}).then(res => {
|
||||
wx.hideLoading();
|
||||
if (res.authorization) {
|
||||
wx.setStorageSync('accessToken', res.authorization.accessToken);
|
||||
}
|
||||
if (res.information) {
|
||||
wx.setStorageSync('information', res.information);
|
||||
}
|
||||
wx.showToast({ title: '绑定成功', icon: 'success' });
|
||||
that.getData(); // 重新加载信息刷新页面
|
||||
}).catch(err => {
|
||||
wx.hideLoading();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 没有修改次数时点击头像
|
||||
onAvatarNoCount() {
|
||||
wx.showToast({
|
||||
|
||||
Reference in New Issue
Block a user