完善手机号校验和验证码发送限制

This commit is contained in:
2026-09-16 09:22:30 +08:00
parent 0c827782ff
commit e8e8e5a404
12 changed files with 44 additions and 12 deletions
+6 -1
View File
@@ -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()
})