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:
nanguaboss
2026-08-09 22:58:36 +08:00
parent 4ff4349ef5
commit 3a5cdcdd36
12 changed files with 112 additions and 1 deletions
+10
View File
@@ -253,6 +253,9 @@ $(function () {
if (name) fd[name] = $(this).val();
});
fd.source_type = $('#ha-type').val();
// 格式校验:手机 / 邮箱
if (fd.contact_phone && !validatePhoneCN(fd.contact_phone)) { Dialog.error('手机号码格式不正确(应为国内 11 位手机号,如 13812345678)'); return; }
if (fd.contact_email && !validateEmail(fd.contact_email)) { Dialog.error('邮箱格式不正确'); return; }
httpPost('fragment/hard_add.php', fd).then(function () {
Dialog.success('新增成功', function () {
Dialog.close(idx);
@@ -344,6 +347,9 @@ $(function () {
});
fd.id = id;
fd.target_type = $('#cv-type').val();
// 格式校验:手机 / 邮箱
if (fd.contact_phone && !validatePhoneCN(fd.contact_phone)) { Dialog.error('手机号码格式不正确(应为国内 11 位手机号,如 13812345678)'); return; }
if (fd.contact_email && !validateEmail(fd.contact_email)) { Dialog.error('邮箱格式不正确'); return; }
httpPost('fragment/hard_convert.php', fd).then(function () {
Dialog.success('转换成功', function () {
Dialog.close(idx);
@@ -404,6 +410,10 @@ $(function () {
var name = $(this).attr('name');
if (name) fd[name] = $(this).val();
});
// 格式校验:身份证 / 手机 / 邮箱
if (fd.id_number && !validateIdCard(fd.id_number)) { Dialog.error('身份证号码格式不正确(应为 15 或 18 位)'); return; }
if (fd.phone && !validatePhoneCN(fd.phone)) { Dialog.error('手机号码格式不正确(应为国内 11 位手机号,如 13812345678)'); return; }
if (fd.email && !validateEmail(fd.email)) { Dialog.error('邮箱格式不正确'); return; }
httpPost('fragment/soft_update.php', fd).then(function (res) {
Dialog.success(res && res.is_complete ? '补全完成' : '已保存(整体完整度 ' + (res && res.overall) + '%)', function () {
Dialog.close(idx);