修改注册手机号为工号
This commit is contained in:
@@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
</view>
|
</view>
|
||||||
<text style="color: dimgrey; margin-left:5rpx;">{{weChatName}}</text>
|
<text style="color: dimgrey; margin-left:5rpx;">{{weChatName}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view style="flex: 4; display: flex;justify-content: flex-end;">
|
<view style="flex: 4; display: flex;justify-content: flex-end;">
|
||||||
|
|
||||||
<scroll-view scroll-x class=" nav text-center">
|
<scroll-view scroll-x class=" nav text-center">
|
||||||
|
|||||||
@@ -39,7 +39,42 @@ if (typeof isAgree !== 'undefined'){
|
|||||||
inputName(e) {this.setData({'form.name': e.detail.value})},
|
inputName(e) {this.setData({'form.name': e.detail.value})},
|
||||||
inputPhone(e) {this.setData({'form.phone': e.detail.value})},
|
inputPhone(e) {this.setData({'form.phone': e.detail.value})},
|
||||||
async submitReg() {
|
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 {
|
try {
|
||||||
wx.showLoading({ title: '登录中...', mask: true });
|
wx.showLoading({ title: '登录中...', mask: true });
|
||||||
|
|
||||||
@@ -58,6 +93,8 @@ if (typeof isAgree !== 'undefined'){
|
|||||||
let form =this.data.form
|
let form =this.data.form
|
||||||
let openid =this.data.openid
|
let openid =this.data.openid
|
||||||
let avatarUrl =this.data.avatarUrl
|
let avatarUrl =this.data.avatarUrl
|
||||||
|
|
||||||
|
|
||||||
// 发送到后端
|
// 发送到后端
|
||||||
const apiRes = await new Promise((resolve, reject) => {
|
const apiRes = await new Promise((resolve, reject) => {
|
||||||
wx.request({
|
wx.request({
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
class="input"
|
class="input"
|
||||||
placeholder="联系电话"
|
placeholder="工号"
|
||||||
type="number"
|
type="number"
|
||||||
value="{{form.phone}}"
|
value="{{form.phone}}"
|
||||||
bindinput="inputPhone"
|
bindinput="inputPhone"
|
||||||
|
|||||||
Reference in New Issue
Block a user