|
|
@@ -318,7 +318,8 @@ const submitForm = async () => {
|
|
|
if (submitData.type === 'single') {
|
|
|
// 校验单个手机号格式
|
|
|
if (submitData.mobile && !/^1[3-9]\d{9}$/.test(submitData.mobile)) {
|
|
|
- throw new Error('手机号格式不正确')
|
|
|
+ message.error('手机号格式不正确')
|
|
|
+ return // 停止提交
|
|
|
}
|
|
|
delete submitData.batchMobiles
|
|
|
}
|
|
|
@@ -333,11 +334,15 @@ const submitForm = async () => {
|
|
|
if (submitData.batchMobiles && submitData.batchMobiles.length > 0) {
|
|
|
const invalidMobiles = submitData.batchMobiles.filter(mobile => !/^1[3-9]\d{9}$/.test(mobile))
|
|
|
if (invalidMobiles.length > 0) {
|
|
|
- throw new Error(`以下手机号格式不正确: ${invalidMobiles.join(', ')}`)
|
|
|
+ message.error(`以下手机号格式不正确: ${invalidMobiles.join(', ')}`)
|
|
|
+ return // 停止提交
|
|
|
}
|
|
|
|
|
|
+ // 批量模式下使用第一个手机号作为主手机号
|
|
|
+ submitData.mobile = submitData.batchMobiles[0]
|
|
|
} else {
|
|
|
- throw new Error('请输入有效的手机号')
|
|
|
+ message.error('请输入有效的手机号')
|
|
|
+ return // 停止提交
|
|
|
}
|
|
|
|
|
|
// 清理批量模式下的默认值,避免提交给后端
|