注册修改为绑定

This commit is contained in:
2025-10-21 21:51:51 +08:00
parent 5ee4e077fb
commit be2323074b
28 changed files with 729 additions and 211 deletions

View File

@@ -1,5 +1,5 @@
{
"navigationBarTitleText": "申请加入货运团队",
"navigationBarTitleText": "员工账号绑定",
"navigationBarBackgroundColor": "#1aad19",
"navigationBarTextStyle": "white",
"usingComponents": {}

View File

@@ -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;
}
},

View File

@@ -2,16 +2,16 @@
<view class="apply-container">
<!-- 页面头部 -->
<view class="apply-header">
<text class="apply-title">加入货运团队</text>
<text class="apply-subtitle">请填写您的个人信息</text>
<text class="apply-title">员工账号绑定</text>
<text class="apply-subtitle">请填写您的员工信息</text>
</view>
<!-- 表单内容 -->
<scroll-view class="apply-content" scroll-y>
<view class="apply-form">
<!-- 姓名输入 -->
<!-- 员工姓名输入 -->
<view class="apply-form-group">
<text class="apply-form-label">姓名</text>
<text class="apply-form-label">员工姓名</text>
<input
class="apply-form-input"
type="text"
@@ -27,27 +27,33 @@
<!-- 手机号输入 -->
<!-- 员工工号输入 -->
<view class="apply-form-group">
<text class="apply-form-label">手机号</text>
<text class="apply-form-label">员工工号</text>
<input
class="apply-form-input"
type="number"
value="{{applyForm.phone}}"
data-field="phone"
bindinput="onApplyFormInput"
placeholder="请输入11位手机号码"
placeholder="请输入您的员工工号"
placeholder-class="apply-form-placeholder"
maxlength="11"
maxlength="20"
/>
<view class="apply-form-underline"></view>
</view>
</view>
</scroll-view>
<!-- 提示信息 -->
<view class="apply-tips">
<text class="tips-text">请正确输入自己的姓名和工号,忘记请联系管理员</text>
<text class="tips-warning">未分属于本公司用户请勿绑定(绑定不会保留个人信息)</text>
</view>
<!-- 底部操作按钮 -->
<view class="apply-footer">
<button class="apply-btn-cancel" bindtap="onCancel">取消</button>
<button class="apply-btn-confirm" bindtap="onSubmit" form-type="submit">提交申请</button>
<button class="apply-btn-confirm" bindtap="onSubmit" form-type="submit">绑定账号</button>
</view>
</view>

View File

@@ -84,6 +84,29 @@
opacity: 0.5;
}
/* 提示信息 */
.apply-tips {
padding: 30rpx;
background-color: #f8f9fa;
border-top: 1rpx solid #eee;
border-bottom: 1rpx solid #eee;
}
.tips-text {
display: block;
font-size: 26rpx;
color: #666;
line-height: 1.6;
margin-bottom: 10rpx;
}
.tips-warning {
display: block;
font-size: 24rpx;
color: #ff6b35;
line-height: 1.6;
}
/* 底部操作按钮 */
.apply-footer {
padding: 30rpx;