main.js
1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function addContacts () {
const num = $('#contacts').find('.row');
const userId = $('#contacts').data('userId');
if(num.length >= 11) {
return;
}
const html = $('#contacts').find('.row.hidden').html().replace(/{k}/g, num.length).replace(/disabled=""/g, '');
$('#contacts').append('<div class="row cl">'+html+'</div>');
}
$('.btn.btn-primary.pannel-sh').on('click', function () {
$(this).parent().parent().siblings('.panel-body').toggle();
});
function relation (e) {
if($(e).data('num') < 3) {
const val = $(e).val();
if ( $.inArray($(e).val(), ["0", "1"]) === -1) {
layer.alert('头2个必须是直系亲属', function (index) {
$(e).val(0);
layer.close(index);
});
}
}
}
function phone (e) {
var phone = [];
$('input[phone]').each(function () {
if(e != this) {
phone.push($(this).val());
}
});
if( $.inArray($(e).val(), phone) !== -1) {
layer.alert('联系方式不能相同');
$(e).val('').focus();
}
}
$('[name="deadLine"]').on('change', function () {
if($(this).val() % 6) {
layer.alert('期数只能是6的倍数');
$(this).val('');
}
})