commission--yt-commit
This commit is contained in:
@ -92,6 +92,7 @@ Page({
|
|||||||
|
|
||||||
// 注册按钮点击
|
// 注册按钮点击
|
||||||
async onRegister() {
|
async onRegister() {
|
||||||
|
const { nickname, phone, captcha, inviteCode, password } = this.data;
|
||||||
// 调用通用校验,失败时已提示并 return
|
// 调用通用校验,失败时已提示并 return
|
||||||
if (!validate(this.data, {
|
if (!validate(this.data, {
|
||||||
nickname: '昵称不能为空',
|
nickname: '昵称不能为空',
|
||||||
@ -102,17 +103,38 @@ Page({
|
|||||||
})) {
|
})) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 手机号必须为11位
|
||||||
|
const phoneReg = /^\d{11}$/;
|
||||||
|
if (!phoneReg.test(phone)) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '请输入11位手机号',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 密码
|
||||||
|
const pwdReg = /^(?!^\d+$)^.{6,13}$/;
|
||||||
|
if (!pwdReg.test(password)) {
|
||||||
|
wx.showToast({
|
||||||
|
title: '密码不能为纯数字,6-13位',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 2. 再单独校验协议勾选
|
// 2. 再单独校验协议勾选
|
||||||
if (!this.data.agree) {
|
if (!this.data.agree) {
|
||||||
wx.showToast({ title: '请先同意用户协议', icon: 'none' });
|
wx.showToast({ title: '请先同意用户协议', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { nickname, phone, captcha, inviteCode, password } = this.data;
|
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加载中',
|
title: '加载中',
|
||||||
mask: true
|
mask: true
|
||||||
})
|
})
|
||||||
const res = await requestAsync({
|
|
||||||
|
const res = await requestAsync({
|
||||||
url: baseUrl + '/userInfo/register',
|
url: baseUrl + '/userInfo/register',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
header: { 'content-type': 'application/json' },
|
header: { 'content-type': 'application/json' },
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
<view class="flex-col justify-start relative section">
|
<view class="flex-col justify-start relative section">
|
||||||
<input class="flex-col justify-start items-start text-wrapper_5 view input"
|
<input class="flex-col justify-start items-start text-wrapper_5 view input"
|
||||||
placeholder="请输入昵称"
|
placeholder="请输入昵称"
|
||||||
|
maxlength="6"
|
||||||
bindinput="onInput" data-field="nickname" value="{{nickname}}"
|
bindinput="onInput" data-field="nickname" value="{{nickname}}"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
Reference in New Issue
Block a user