ソースを参照

添加验证及微信样式修改

liuzhen 5 年 前
コミット
87b0914dab

+ 49 - 0
CallCenterWeb.UI/ArchivesManagement/js/addOrEditAdminInformation.js

@@ -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
 }

+ 3 - 0
CallCenterWeb.UI/Script/Common/regexs.js

@@ -170,5 +170,8 @@ var regexs = {
170 170
 	 * 金额: 匹配中文、英文、 (正数 一次或多次)
171 171
 	 * */
172 172
 	amountMoneys: /^([0-9]*[.]?[0-9]+)+[A-Za-z\u4e00-\u9fa5]*$/,
173
+	
174
+	userAdmin: /^[a-zA-Z]{3}\d{4,7}$/,
175
+	userPassword: /^[0-9a-zA-Z]{4,10}$/,
173 176
 
174 177
 }

+ 10 - 3
CallCenterWeb.UI/commonTpl/addOrEditAdminInformation.html

@@ -9,6 +9,8 @@
9 9
 		<script src="../Script/Common/huayi.load.js"></script>
10 10
 		<script src="../Script/Common/huayi.config.js"></script>
11 11
 		<link rel="stylesheet" href="../css/customer.css" />
12
+		<link href="../css/login.min.css" rel="stylesheet">
13
+		<script src="../Script/Common/regexs.js"></script>
12 14
 	</head>
13 15
 
14 16
 	<body>
@@ -18,20 +20,25 @@
18 20
 					<li class="form-group">
19 21
 						<label for="customer_code" class="col-md-2"><b class="text_require">*</b>用户名</label>
20 22
 						<div class="col-md-4">
21
-							<input id="username" class="form-control" type="text" autocomplete="off" />
23
+							<input id="username" class="form-control" type="text"  autocomplete="off" />
22 24
 						</div>
23 25
 						<ul class="OA_task_2"></ul>
24 26
 					</li>
25 27
 					<li class="form-group">
26 28
 						<label for="customer_name" class="col-md-2"><b class="text_require">*</b>密码</label>
27 29
 						<div class="col-md-4">
28
-							<input id="userpassword" class="form-control" type="text" />
30
+							<input id="userpassword" class="form-control" type="text"  autocomplete="off"/>
29 31
 						</div>
30 32
 					</li>
31 33
 				</ul>
34
+				<div class="alert alert-danger" id="login_tips" role="alert">
35
+					<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
36
+					<span class="sr-only">Error:</span>
37
+					<span id="login_msg"></span>
38
+				</div>
32 39
 				<div class="form-group clearfix">
33 40
 					<div class="col-md-offset-3 col-md-10">
34
-						<button class="project_save btn btn-primary" id="btn_save" type="button">保存</button>
41
+						<button class="project_save btn btn-primary" id="btn_save" class="btns" type="button" disabled="disabled">保存</button>
35 42
 					</div>
36 43
 				</div>
37 44
 			</div>

+ 1 - 1
WeChat/content/AdminList.html

@@ -49,7 +49,7 @@
49 49
 					
50 50
 				</ul>
51 51
 			</div>
52
-			<div class="noinfor" style="text-align: center; font-size: 16px;">
52
+			<div class="noinfor" style="text-align: center; font-size: 16px;margin-top:20px;">
53 53
 		</div>
54 54
 	</body>
55 55
 	<script src="../js/mui.min.js"></script>

+ 2 - 2
WeChat/content/js/AdminList.js

@@ -64,11 +64,11 @@ function Ajax() {
64 64
 				$(".noinfor").text("");
65 65
 				$(data.data).each(function(i, n) {
66 66
 					$('<li class="mui-table-view-cell order">' +
67
-						'<div class="mui-table-cell mui-col-xs-8" data-index="' + n.id + '">' +
67
+						'<div class="mui-table-cell mui-col-xs-8" data-index="' + n.id + '" style="float:left">' +
68 68
 						'<h4 class="mui-ellipsis">' + n.F_CompanyName +
69 69
 						'</h4><h5>' + n.F_CustomerCode +
70 70
 						'</h5></div>'+
71
-						'<div class="mui-table-cell mui-col-xs-4 mui-text-right">'+
71
+						'<div class="mui-table-cell mui-col-xs-4 mui-text-right" style="float:right;">'+
72 72
 						'<span class="mui-h5">'+n.username+
73 73
 						'</span></div></div></li>').appendTo('#OA_task');
74 74
 				});