修改注册手机号为工号

This commit is contained in:
2025-12-30 15:23:41 +08:00
parent 5d85ddfa83
commit da56d6adf1
3 changed files with 41 additions and 3 deletions

View File

@@ -9,7 +9,8 @@
</view>
<text style="color: dimgrey; margin-left:5rpx;">{{weChatName}}</text>
</view>
</view>
<view style="flex: 4; display: flex;justify-content: flex-end;">
<scroll-view scroll-x class=" nav text-center">

View File

@@ -39,7 +39,42 @@ if (typeof isAgree !== 'undefined'){
inputName(e) {this.setData({'form.name': e.detail.value})},
inputPhone(e) {this.setData({'form.phone': e.detail.value})},
async submitReg() {
// 校验注册信息
const { form, nickName } = this.data;
if (!form.name.trim()) {
wx.showToast({
title: '姓名不能为空',
icon: 'none'
});
return;
}
if (!form.phone.trim()) {
wx.showToast({
title: '工号不能为空',
icon: 'none'
});
return;
}
// 校验电话号码格式11位数字以1开头
const phoneReg = /^1\d{10}$/;
if (!phoneReg.test(form.phone.trim())) {
wx.showToast({
title: '请输入有效的工号',
icon: 'none'
});
return;
}
if (!nickName.trim()) {
wx.showToast({
title: '微信昵称不能为空',
icon: 'none'
});
return;
}
try {
wx.showLoading({ title: '登录中...', mask: true });
@@ -58,6 +93,8 @@ if (typeof isAgree !== 'undefined'){
let form =this.data.form
let openid =this.data.openid
let avatarUrl =this.data.avatarUrl
// 发送到后端
const apiRes = await new Promise((resolve, reject) => {
wx.request({

View File

@@ -40,7 +40,7 @@
/>
<input
class="input"
placeholder="联系电话"
placeholder="工号"
type="number"
value="{{form.phone}}"
bindinput="inputPhone"