|
|
@@ -2,6 +2,15 @@
|
|
2
|
2
|
* 修改增加管理员信息
|
|
3
|
3
|
* */
|
|
4
|
4
|
$(function() {
|
|
|
5
|
+
|
|
|
6
|
+ /*输入框绑定验证*/
|
|
|
7
|
+ $('#tab_user_contents').find("input[class='form-control']").on('focus input propertychange', valideInput);
|
|
|
8
|
+ $('#username').trigger('propertychange');
|
|
|
9
|
+ $('#username').trigger('focus');
|
|
|
10
|
+ $('#username').trigger('input');
|
|
|
11
|
+ $('#userpassword').trigger('propertychange');
|
|
|
12
|
+ $('#userpassword').trigger('focus');
|
|
|
13
|
+ $('#userpassword').trigger('input');
|
|
5
|
14
|
var editId = helper.request.queryString("edit_id");
|
|
6
|
15
|
if(editId){
|
|
7
|
16
|
getAdminInformationDetail(editId);
|
|
|
@@ -64,4 +73,44 @@ function getAdminInformationDetail(editId) {
|
|
64
|
73
|
$('#userpassword').val(data.data.userpower);
|
|
65
|
74
|
}
|
|
66
|
75
|
})
|
|
|
76
|
+}
|
|
|
77
|
+
|
|
|
78
|
+
|
|
|
79
|
+
|
|
|
80
|
+//验证
|
|
|
81
|
+function valideInput() {
|
|
|
82
|
+ var _that = $(this);
|
|
|
83
|
+ var ele = $(this).attr('id');
|
|
|
84
|
+ if(ele === 'username') {
|
|
|
85
|
+ valideMethods(_that, regexs.userAdmin, '前三位字母,后几位数字');
|
|
|
86
|
+ } else if(ele === 'userpassword') {
|
|
|
87
|
+ valideMethods(_that, regexs.userPassword, '4~10位的字母、数字');
|
|
|
88
|
+ }
|
|
|
89
|
+
|
|
|
90
|
+ if(regexs.userAdmin.test($.trim($('#username').val())) && regexs.userPassword.test($.trim($("#userpassword").val()))) {
|
|
|
91
|
+ $('#btn_save').attr("disabled", false);
|
|
|
92
|
+ }else{
|
|
|
93
|
+ $('#btn_save').attr("disabled", true);
|
|
|
94
|
+ }
|
|
|
95
|
+}
|
|
|
96
|
+/**
|
|
|
97
|
+ * 验证方法
|
|
|
98
|
+ * _this :传递的this
|
|
|
99
|
+ * regRlues: 验证的规则
|
|
|
100
|
+ * msg: 提示信息
|
|
|
101
|
+ * */
|
|
|
102
|
+function valideMethods(_this, regRlues, msg) {
|
|
|
103
|
+ $('#login_tips').hide();
|
|
|
104
|
+ $('#login_msg').text('');
|
|
|
105
|
+ if(!regRlues.test($.trim(_this.val()))) {
|
|
|
106
|
+ _this.parent().removeClass('has-success has-feedback').addClass('has-error has-feedback');
|
|
|
107
|
+ _this.parent().find('.glyphicon').remove();
|
|
|
108
|
+ $('<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"></span>').appendTo(_this.parent());
|
|
|
109
|
+ $('#login_tips').show();
|
|
|
110
|
+ $('#login_msg').text(msg);
|
|
|
111
|
+ } else {
|
|
|
112
|
+ _this.parent().removeClass('has-error has-feedback').addClass('has-success has-feedback');
|
|
|
113
|
+ _this.parent().find('.glyphicon').remove();
|
|
|
114
|
+ $('<span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>').appendTo(_this.parent());
|
|
|
115
|
+ }
|
|
67
|
116
|
}
|