config.blade.php
4.1 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<div class="fields-group">
<div class="fields-group">
<div class="form-group col-md-6 row ">
<label for="mobile" class="col-sm-2 col-form-label">参数值</label>
<div class="col-sm-8">
<div class="input-group">
<input type="checkbox" name="type{{$option}}[]" value="{{$option}}" class="minimal type"/> {{$label}}
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
$(".type").iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '100%' // optional
});
$(".short_term_time").iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '100%' // optional
});
// $("input:radio[name='short_term_time']").iCheck({
// checkboxClass: 'icheckbox_square-blue',
// radioClass: 'iradio_square-blue',
// increaseArea: '100%' // optional
// });
// $("input:radio[name='type']").eq(2).iCheck('check');
// 设置长期的选中
$("input[name='type'][value='2']").iCheck("check");
$("input:radio[name='type']").on('ifChecked', function () {
if($(this).val()=="1"){
// 短期密码
$(this).closest('.fields-group').find('.long-div').hide();
$(this).closest('.fields-group').find('.short-div').show();
$(this).closest('.fields-group').find('.password').val("{{optional($short_term)->password}}");
var short_term_time= "{{$short_term_time}}";
$(this).closest('.fields-group').find("input[name='short_term_time'][value='" + short_term_time+ "']").iCheck("check");
// var date = new Date();
// $('.enabled_at_short').datetimepicker({
// "format":"YYYY-MM-DD HH:mm","locale":"zh-CN","allowInputToggle":true,
// // minDate: date,
// });
//
// $('.expired_at_short').datetimepicker({
// "format":"YYYY-MM-DD HH:m","locale":"zh-CN","allowInputToggle":true,
// // minDate: date,
// });
// 设置选中
}if($(this).val()=="2"){
// 长期密码
$(this).closest('.fields-group').find('.long-div').show();
$(this).closest('.fields-group').find('.short-div').hide();
$(this).closest('.fields-group').find('.password').val("{{optional($long_term)->password}}");
}
// $(this).attr("checked",false);
$(this).iCheck('update');
});
$('.enabled_at').datetimepicker({
"format":"YYYY-MM-DD","locale":"zh-CN","allowInputToggle":true,
});
$('.expired_at').datetimepicker({
"format":"YYYY-MM-DD","locale":"zh-CN","allowInputToggle":true
});
});
function check() {
let $form = $("form");
let ok = true;
let msg = '';
// 获取密码
let password = $("#password").val();
if (!password) {
swal_error('请输入密码!');
return false;
}
// 获取选中的状态
var type = $("input[name='type']:checked").val();
let password_id = $("#long_term_id").val();
if (type==1) {
password_id = $("#short_term_id").val();
var short_term_time = $("input[name='short_term_time']:checked").val();
if (!short_term_time) {
swal_error('请选择有效期!');
return false;
}
} else {
let enabled_at = $("#enabled_at").val();
let expired_at = $("#expired_at").val();
if (!enabled_at) {
swal_error('请选择生效日期!');
return false;
}
if (!expired_at) {
swal_error('请选择失效日期!');
return false;
}
}
}
</script>