注册修改为绑定
This commit is contained in:
@@ -61,7 +61,7 @@ Page({
|
||||
|
||||
if (result.success) {
|
||||
wx.showToast({
|
||||
title: '申请提交成功',
|
||||
title: '绑定成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
@@ -79,13 +79,27 @@ Page({
|
||||
}
|
||||
|
||||
// 延迟返回并刷新首页
|
||||
setTimeout(() => {
|
||||
setTimeout(async () => {
|
||||
// 获取当前页面栈
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length >= 2) {
|
||||
// 获取首页实例并调用刷新方法
|
||||
const indexPage = pages[pages.length - 2];
|
||||
if (indexPage && indexPage.refreshPageAfterLogin) {
|
||||
// 重新获取用户状态,确保绑定成功后状态正确更新
|
||||
if (indexPage.data.mainPageModule) {
|
||||
const loginModule = indexPage.data.mainPageModule.getLoginModule();
|
||||
const app = getApp<any>();
|
||||
const userStatus = await loginModule.determineUserStatus(app.globalData.userInfo);
|
||||
|
||||
// 更新页面状态
|
||||
indexPage.setData({
|
||||
'authStatus.userStatus': userStatus
|
||||
});
|
||||
|
||||
console.log('✅ 绑定成功后重新获取用户状态:', userStatus);
|
||||
}
|
||||
|
||||
indexPage.refreshPageAfterLogin();
|
||||
}
|
||||
}
|
||||
@@ -125,16 +139,6 @@ Page({
|
||||
return false;
|
||||
}
|
||||
|
||||
// 手机号验证
|
||||
if (!/^1[3-9]\d{9}$/.test(phone)) {
|
||||
wx.showToast({
|
||||
title: '请输入正确的手机号',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -150,13 +154,13 @@ Page({
|
||||
throw new Error('微信登录失败,请重试');
|
||||
}
|
||||
|
||||
// 调用实际的注册接口
|
||||
// 调用实际的绑定接口
|
||||
return await userService.register({
|
||||
name: data.name,
|
||||
phone: data.phone
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('注册流程失败:', error);
|
||||
console.error('绑定流程失败:', error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user