v1.0.22: 手机号/邮箱录入自动清洗 - 手机号去所有空格(含中间)如138 1234 5678->13812345678,邮箱去首尾空格(人员表单/媒体账号)
This commit is contained in:
+14
-5
@@ -299,7 +299,7 @@ $(function () {
|
||||
' <div class="form-item"><label>手机</label>' +
|
||||
' <div><input type="text" name="phone" id="person-phone" value="' + escHtml(pPhone) + '" placeholder="常用手机号">' +
|
||||
' <div class="geo-hint" id="person-phone-geo" style="font-size:12px;color:#2f8f46;margin-top:4px;display:none;"></div></div></div>' +
|
||||
' <div class="form-item"><label>邮箱</label><input type="text" name="email" value="' + escHtml(pEmail) + '" placeholder="常用邮箱"></div>' +
|
||||
' <div class="form-item"><label>邮箱</label><input type="text" name="email" id="person-email" value="' + escHtml(pEmail) + '" placeholder="常用邮箱"></div>' +
|
||||
' <div class="form-item"><label>来源渠道</label><select name="source_channel" id="person-source-channel"><option value="">-</option></select></div>' +
|
||||
' <div class="form-item"><label>来源详情</label><input type="text" name="source_detail" value="' + escHtml(p.source_detail) + '" placeholder="如:华南工博会"></div>' +
|
||||
'</div>';
|
||||
@@ -344,6 +344,13 @@ $(function () {
|
||||
// 手机号归属地自动识别
|
||||
bindPhoneGeo($('#person-phone'), $('#person-phone-geo'));
|
||||
|
||||
// 录入自动清洗:手机号去所有空格(含中间),邮箱去首尾空格
|
||||
$('#person-phone').on('input', function () {
|
||||
var v = cleanPhone($(this).val());
|
||||
if ($(this).val() !== v) $(this).val(v);
|
||||
});
|
||||
$('#person-email').on('blur', function () { $(this).val(cleanEmail($(this).val())); });
|
||||
|
||||
// 加载国籍字典 + 行政区划字典(省-市两级) + 来源渠道字典 + 任职公司
|
||||
httpGet('common/dicts.php', { type: 'all' }).then(function (d) {
|
||||
var $dl = $('#person-country-list');
|
||||
@@ -410,12 +417,14 @@ $(function () {
|
||||
if (!data.full_name) { Dialog.error('姓名为必填项'); return; }
|
||||
|
||||
// 联系方式(手机/邮箱,均为常用)
|
||||
data.phone = cleanPhone(data.phone);
|
||||
data.email = cleanEmail(data.email);
|
||||
var contacts = [];
|
||||
if ($.trim(data.phone || '')) {
|
||||
contacts.push({ platform: 'phone', account_id: $.trim(data.phone), is_primary: 1, is_defult: 1 });
|
||||
if (data.phone) {
|
||||
contacts.push({ platform: 'phone', account_id: data.phone, is_primary: 1, is_defult: 1 });
|
||||
}
|
||||
if ($.trim(data.email || '')) {
|
||||
contacts.push({ platform: 'email', account_id: $.trim(data.email), is_primary: 1, is_defult: 1 });
|
||||
if (data.email) {
|
||||
contacts.push({ platform: 'email', account_id: data.email, is_primary: 1, is_defult: 1 });
|
||||
}
|
||||
data.contacts = JSON.stringify(contacts);
|
||||
delete data.phone;
|
||||
|
||||
Reference in New Issue
Block a user