v1.0.38: 邮箱/国内手机号/身份证正则格式校验 - 后端validate.php(接入person add/update、duplicate_check账号校验、soft_update、hard_add/convert)前端common.js三函数+person/media/fragment表单提交校验
This commit is contained in:
@@ -203,6 +203,9 @@ $(function () {
|
||||
}
|
||||
});
|
||||
if (!data.platform || !data.account_id) { Dialog.error('平台和账号为必填项'); return; }
|
||||
// 格式校验:平台为手机/邮箱时校验账号格式
|
||||
if (data.platform === 'phone' && !validatePhoneCN(data.account_id)) { Dialog.error('手机号码格式不正确(应为国内 11 位手机号,如 13812345678)'); return; }
|
||||
if (data.platform === 'email' && !validateEmail(data.account_id)) { Dialog.error('邮箱格式不正确'); return; }
|
||||
if (!isEdit && (!data.owner_type || !data.owner_id)) { Dialog.error('归属类型和归属ID为必填项'); return; }
|
||||
// 录入清洗:手机号去所有空格(含中间),邮箱去首尾空格
|
||||
if (data.platform === 'phone') data.account_id = cleanPhone(data.account_id);
|
||||
|
||||
Reference in New Issue
Block a user