完善手机号校验和验证码发送限制
This commit is contained in:
@@ -220,6 +220,11 @@ Page({
|
||||
async saveProfile() {
|
||||
const form = this.data.profileForm
|
||||
const nickname = String(form.nickname || '').trim()
|
||||
const contactPhone = String(form.contactPhone || '').trim()
|
||||
if (contactPhone && !/^1[3-9]\d{9}$/.test(contactPhone)) {
|
||||
wx.showToast({ title: '请输入正确联系电话', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!nickname) {
|
||||
wx.showToast({ title: '请填写昵称', icon: 'none' })
|
||||
return
|
||||
@@ -229,7 +234,7 @@ Page({
|
||||
await userApi.updateInfo({
|
||||
nickname,
|
||||
avatar: form.avatar || '',
|
||||
contactPhone: String(form.contactPhone || '').trim(),
|
||||
contactPhone,
|
||||
wechatId: String(form.wechatId || '').trim(),
|
||||
signature: String(form.signature || '').trim()
|
||||
})
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text>联系电话</text>
|
||||
<input value="{{profileForm.contactPhone}}" data-field="contactPhone" bindinput="onProfileInput" type="number" placeholder="请输入联系电话" />
|
||||
<input value="{{profileForm.contactPhone}}" data-field="contactPhone" bindinput="onProfileInput" type="number" maxlength="11" placeholder="请输入联系电话" />
|
||||
</view>
|
||||
<view class="modal-field">
|
||||
<text>微信号</text>
|
||||
|
||||
Reference in New Issue
Block a user