Commit 81d76fc77139d2184d5dadb3de2d54ed37e90f31
Merge branch 'branch' of http://192.168.1.195:9998/web_developers/javaplatform into branch
Showing
7 changed files
with
436 additions
and
6 deletions
css/login.css
1 | +html,body{ | |
2 | + height: 100%; | |
3 | + width: 100%; | |
4 | +} | |
5 | +body{ | |
6 | + min-width: 580px; | |
7 | + overflow: scroll; | |
8 | +} | |
9 | +.login-model { | |
10 | + height: 100%; | |
11 | + min-height: 700px; | |
12 | + width: 100%; | |
13 | + overflow: scroll; | |
14 | + /*min-width: 814px;*/ | |
15 | + background: url("../image/syslogin_bgIcon.png") no-repeat; | |
16 | + background-size: 100% 100%; | |
17 | + position: relative; | |
18 | +} | |
19 | +.top-tit{ | |
20 | + padding-top: 102px; | |
21 | + height: 140px; | |
22 | + /*line-height: 62px;*/ | |
23 | + text-align: center; | |
24 | + color: #fff; | |
25 | + font-size: 32px; | |
26 | +} | |
27 | +.float-left{ | |
28 | + float: left; | |
29 | +} | |
30 | +.login-content{ | |
31 | + height: 412px; | |
32 | + width: 580px; | |
33 | + margin: 100px auto 0; | |
34 | + background: #fff; | |
35 | + border-radius: 20px; | |
36 | +} | |
37 | +.posrel{ | |
38 | + position: relative; | |
39 | +} | |
40 | +.posabl{ | |
41 | + position: absolute; | |
42 | +} | |
43 | +.boxshadow { | |
44 | + box-shadow: 1px 3px 10px 6px rgba(50, 50, 50, 0.2); | |
45 | +} | |
46 | +.login-contop{ | |
47 | + height: 100px; | |
48 | + width: 100px; | |
49 | + border-radius: 50%; | |
50 | + background-color: #fff; | |
51 | + top:-50px; | |
52 | + left: 50%; | |
53 | + margin-left: -50px; | |
54 | + background-image: url("../image/logo-loginGreen.png"); | |
55 | + background-repeat: no-repeat; | |
56 | + background-position: 21px 24.5px; | |
57 | + background-size: 58px 51px; | |
58 | +} | |
59 | +.user-cont{ | |
60 | + margin: 0 auto; | |
61 | + padding-top: 95px; | |
62 | + width: 332px; | |
63 | + height: 136px; | |
64 | + /*border: 1px solid #ddd;*/ | |
65 | +} | |
66 | +.psw-cont{ | |
67 | + margin: 0 auto; | |
68 | + width: 332px; | |
69 | + height: 40px; | |
70 | + margin-top: 24px; | |
71 | + margin-bottom: 24px; | |
72 | +} | |
73 | +.cont-user,.cont-psw{ | |
74 | + height: 42px; | |
75 | + line-height: 40px; | |
76 | + width: 332px; | |
77 | + border: 1px solid #ddd; | |
78 | + border-radius: 4px; | |
79 | +} | |
80 | +.user-bg{ | |
81 | + height: 40px; | |
82 | + width: 40px; | |
83 | + background-color: #ddd; | |
84 | + background-image: url("../image/login_usericon.png"); | |
85 | + background-size: 19px 17px; | |
86 | + background-repeat: no-repeat; | |
87 | + background-position: 10px 11.5px; | |
88 | + float: left; | |
89 | +} | |
90 | +.psw-bg{ | |
91 | + height: 40px; | |
92 | + width: 40px; | |
93 | + background-color: #ddd; | |
94 | + background-image: url("../image/login_pwsicon.png"); | |
95 | + background-size: 16px 20px; | |
96 | + background-repeat: no-repeat; | |
97 | + background-position: 12px 10px; | |
98 | + float: left; | |
99 | +} | |
100 | +.login-control{ | |
101 | + height: 40px; | |
102 | + line-height: 40px; | |
103 | + width: 290px; | |
104 | + outline: none; | |
105 | + border: none !important; | |
106 | + border-top-right-radius:4px; | |
107 | + border-bottom-right-radius:4px; | |
108 | + padding-left: 12px; | |
109 | +} | |
110 | +.ver-cont{ | |
111 | + width: 222px; | |
112 | + height: 42px; | |
113 | + margin-left: 124px; | |
114 | + border: 1px solid #ddd; | |
115 | + border-radius: 4px; | |
116 | + margin-bottom: 10px; | |
117 | +} | |
118 | +.ver-bg{ | |
119 | + height: 40px; | |
120 | + width: 40px; | |
121 | + background-color: #ddd; | |
122 | + background-image: url("../image/login_vericon.png"); | |
123 | + background-size: 16px 16px; | |
124 | + background-repeat: no-repeat; | |
125 | + background-position: 12px 12px; | |
126 | + float: left; | |
127 | +} | |
128 | +.ver-control{ | |
129 | + height: 40px; | |
130 | + line-height: 40px; | |
131 | + width: 180px; | |
132 | + outline: none; | |
133 | + border: none !important; | |
134 | + border-top-right-radius:4px; | |
135 | + border-bottom-right-radius:4px; | |
136 | + padding-left: 12px; | |
137 | +} | |
138 | +.imgWrap{ | |
139 | + height: 42px; | |
140 | + width: 98px; | |
141 | + background: #ddd; | |
142 | + border-radius: 4px; | |
143 | + margin-left: 10px; | |
144 | +} | |
145 | +.imgWrap img { | |
146 | + width: 100%; | |
147 | + height: 100%; | |
148 | +} | |
149 | +.login_error_ifo{ | |
150 | + height: 30px; | |
151 | + line-height: 30px; | |
152 | + font-size: 14px; | |
153 | + color: #f00; | |
154 | + text-align: center; | |
155 | + margin-bottom: 8px; | |
156 | +} | |
157 | +.login-foot{ | |
158 | + width: 100%; | |
159 | + height: 40px; | |
160 | +} | |
161 | +.login-foot .btn{ | |
162 | + height: 40px; | |
163 | + width: 148px; | |
164 | + background: #26be96; | |
165 | + border-radius: 20px; | |
166 | + color: #fff; | |
167 | + font-size:18px; | |
168 | + margin: 0 auto; | |
169 | + display: block; | |
170 | +} | |
0 | 171 | \ No newline at end of file | ... | ... |
image/login_pwsicon.png
0 → 100644
431 Bytes
image/login_usericon.png
0 → 100644
371 Bytes
image/login_vericon.png
0 → 100644
382 Bytes
image/logo-loginGreen.png
0 → 100644
1.75 KB
js/login.js
1 | 1 | /** |
2 | 2 | * Created by chenbiao on 2017/11/20. |
3 | 3 | */ |
4 | + | |
5 | +/** | |
6 | + * 输入框内容检测插件 | |
7 | + */ | |
8 | +var $imageCodeValue = $('#login_imgCode_value'); | |
9 | +var $imageCode = $('#login_imgCode'); | |
10 | +var flagAjax = false; | |
11 | +jQuery.fn.inputCheck = function(properties){ | |
12 | + var defaults = { | |
13 | + callback:function(){} | |
14 | + } | |
15 | + jQuery.extend(defaults,properties); | |
16 | + var result = new Object(),realLength = 0, len = this.val().length, charCode = -1; | |
17 | + var regexp = { | |
18 | + china: /[\u4E00-\u9FA5]/, // 中文 | |
19 | + decimal: /^\d+(\.\d+)?$/, // 小数 | |
20 | + number: /^[0-9]*[1-9][0-9]*$/, | |
21 | + password:/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,20}$/, | |
22 | + phone: /^1[3,5,7,8]\d{9}$/, // 手机号码 | |
23 | + tel: /^0\d{2,3}-?\d{7,8}$/, // 电话号码 | |
24 | + specialPhone: /^(10086|10000|10010)$/, //特殊的电话号码 | |
25 | + businessPhone: /^(((400)-(\d{3})-(\d{4}))|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{3,7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)$/, //400的号码验证 | |
26 | + email: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/, | |
27 | + | |
28 | + peopleId: /\d{17}[\d|x]|\d{15}/, | |
29 | + username: /^[a-zA-Z\u4e00-\u9fa5][a-zA-Z0-9_\u4E00-\u9FA5]{5,15}$/, | |
30 | + date: /^((((19|20)\d{2})-(0?(1|[3-9])|1[012])-(0?[1-9]|[12]\d|30))|(((19|20)\d{2})-(0?[13578]|1[02])-31)|(((19|20)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))-0?2-29))$/, | |
31 | + nbsp: /\s/ //判断空格 | |
32 | + } | |
33 | + | |
34 | + //计算输入框内容的长度,一个中文等于两个字符 | |
35 | + for (var i = 0; i < len; i++) { | |
36 | + charCode = this.val().charCodeAt(i); | |
37 | + if (charCode >= 0 && charCode <= 128) realLength += 1; | |
38 | + else realLength += 2; | |
39 | + } | |
40 | + | |
41 | + result.china = regexp.china.test(this.val()) ? true : false; | |
42 | + result.decimal = regexp.decimal.test(this.val()) ? true : false; | |
43 | + result.password = regexp.password.test(this.val()) ? true : false; | |
44 | + result.number = regexp.number.test(this.val()) ? true : false; | |
45 | + result.phone = regexp.phone.test(this.val()) || regexp.tel.test(this.val()) || regexp.specialPhone.test(this.val()) || regexp.businessPhone.test(this.val()) ? true : false; | |
46 | + result.email = regexp.email.test(this.val()) ? true : false; | |
47 | + | |
48 | + result.nbsp = regexp.nbsp.test(this.val()) ? true : false; | |
49 | + result.peopleId = regexp.peopleId.test(this.val()) ? true : false; | |
50 | + result.username = regexp.username.test(this.val()) ? true : false; | |
51 | + result.date = regexp.date.test(this.val()) ? true : false; | |
52 | + result.length = realLength/2; | |
53 | + defaults.callback(result); | |
54 | +}; | |
55 | +//邮箱验证 | |
56 | +function username(obj) { | |
57 | + var _this = obj; | |
58 | + _this.inputCheck({ | |
59 | + callback : function(result){ | |
60 | + if(!result.email){ | |
61 | + _this.next().removeClass('display-hide'); | |
62 | + flagAjax = false; | |
63 | + }else{ | |
64 | + _this.next().addClass('display-hide'); | |
65 | + flagAjax = true; | |
66 | + } | |
67 | + } | |
68 | + }); | |
69 | +} | |
70 | +$('#userName').on("blur", function() { //验证邮箱地址 | |
71 | + username($(this)); | |
72 | +}); | |
73 | +//密码验证 | |
74 | +function password(obj){ | |
75 | + var _this = obj; | |
76 | + _this.inputCheck({ | |
77 | + callback : function(result){ | |
78 | + if(!result.password){ | |
79 | + _this.next().removeClass('display-hide'); | |
80 | + flagAjax = false; | |
81 | + }else{ | |
82 | + _this.next().addClass('display-hide'); | |
83 | + flagAjax = true; | |
84 | + } | |
85 | + } | |
86 | + }); | |
87 | +} | |
88 | +$('#password').on("blur", function() { //验证邮箱地址 | |
89 | + password($(this)); | |
90 | +}); | |
91 | +//验证码验证 | |
92 | +//function verification(obj) { | |
93 | +// var _this = obj; | |
94 | +// if(_this.val() !== '1234'){ | |
95 | +// _this.prev().addClass('glyphicon glyphicon-remove'); | |
96 | +// return false; | |
97 | +// }else{ | |
98 | +// _this.prev().removeClass('glyphicon glyphicon-remove').addClass('glyphicon glyphicon-ok'); | |
99 | +// } | |
100 | +//} | |
101 | +//$('#login_imgCode_value').on("input blur", function() { //验证邮箱地址 | |
102 | +// verification($(this)); | |
103 | +//}); | |
104 | +//点击登陆 | |
105 | +$('#login-btn').on('click',function () { | |
106 | + var obj1 = $('#userName'); | |
107 | + var obj2 = $('#password'); | |
108 | + username(obj1); | |
109 | + password(obj2); | |
110 | + //verification($('#login_imgCode_value')); | |
111 | + if(flagAjax){ | |
112 | + var Username= $('#userName').val(); | |
113 | + var Password= $('#password').val(); | |
114 | + var imageCode = $imageCodeValue.val(); | |
115 | + // alert("username is "+username+"password is"+password+"code is "+imageCode); | |
116 | + | |
117 | + | |
118 | + var opts = {}; | |
119 | + opts.method = "POST"; | |
120 | + opts.url = dataUrl.util.getLogin(); | |
121 | + opts.success = loginSuccess; | |
122 | + | |
123 | + var data = {}; | |
124 | + data.clientType = sysComm.clientType; | |
125 | + data.sysCode = sysComm.sysCode; | |
126 | + data.grantType = sysComm.grantType; | |
127 | + data.username = Username; | |
128 | + data.password = Password; | |
129 | + data.imgCode = imageCode; | |
130 | + data.expiresIn = 60 * 60 * 12;//默认12小时 | |
131 | + opts.data = JSON.stringify(data); | |
132 | + sysAjax(opts); | |
133 | + | |
134 | + } | |
135 | + | |
136 | + // window.location.href='index.html'; | |
137 | +}); | |
138 | +//回车事件 | |
139 | +$('#login_imgCode_value').keyup(function(event){ | |
140 | + if(event.keyCode ==13){ | |
141 | + // $('#login-btn').onClick() | |
142 | + $('#login-btn').trigger("click"); | |
143 | + } | |
144 | +}); | |
145 | +$('#login_imgCode_value').on('input',function () { | |
146 | + var val = $('#login_imgCode_value').val(); | |
147 | + if(val){ | |
148 | + $('.verification-logo').addClass('glyphicon glyphicon-remove'); | |
149 | + }else{ | |
150 | + $('.verification-logo').removeClass('glyphicon glyphicon-remove'); | |
151 | + } | |
152 | + | |
153 | +}); | |
154 | +$('.verification-logo').on('click',function () { | |
155 | + $("#login_imgCode_value").val(""); | |
156 | + $('.verification-logo').removeClass('glyphicon glyphicon-remove'); | |
157 | +}); | |
158 | +getImgCode(); | |
159 | + | |
160 | +//点击换验证码 | |
161 | +$('#login_imgCode').on('click', function () { | |
162 | + getImgCode(); | |
163 | +}); | |
164 | +function getImgCode() { | |
165 | + var opt = { | |
166 | + method: "get", | |
167 | + url: dataUrl.util.getLoginImageCode(), | |
168 | + success: imgCodeSuccess | |
169 | + } | |
170 | + sysAjax(opt); | |
171 | +} | |
172 | +function imgCodeSuccess(res) { | |
173 | + if (res.code === '8888') { | |
174 | + var imageCodeStr = res.data.imageCodeStr; | |
175 | + var base64ImgStr = 'data:image/jpeg;base64,' + imageCodeStr; | |
176 | + fn.setToken(res.data.authTokenid); | |
177 | + $imageCode.attr('src', base64ImgStr); | |
178 | + } | |
179 | + | |
180 | +} | |
181 | +//登录成功的函数 | |
182 | +function loginSuccess(res) { | |
183 | + if (res.code === '8888') { | |
184 | + // var data = JSON.parse(res.data); | |
185 | + fn.setToken(res.data.accessToken); | |
186 | + fn.setUserName(res.data.userName); | |
187 | + fn.setUserId(res.data.userId); | |
188 | + fn.setOpImgPath(res.data.imgPath); | |
189 | + /**将系统编码及名称放入session.*/ | |
190 | + sessionStorage.setItem("sysCode", res.data.sysCode); | |
191 | + sessionStorage.setItem("sysName", res.data.sysName); | |
192 | + //alert("success"); | |
193 | + fn.setUserAccount(res.data.userName); | |
194 | + window.location.href = "index.html"; | |
195 | + } else if (res.code == "2000" || res.code === '1004') { | |
196 | + //账号密码不匹配 | |
197 | + $('#login_error_ifo').text("账号密码不匹配"); | |
198 | + //$error.text("账号或密码错误!"); | |
199 | + getImgCode(); | |
200 | + } else if (res.code == "2001") { | |
201 | + //账号无有效角色,非有效用户 | |
202 | + $('#login_error_ifo').text("账号无效"); | |
203 | + //$error.text("账号无有效角色,非有效用户!"); | |
204 | + getImgCode(); | |
205 | + } else if (res.code == "2002") { | |
206 | + //验证码错误 | |
207 | + // $('.verification-logo').addClass('glyphicon glyphicon-remove'); | |
208 | + $('#login_error_ifo').text("验证码错误"); | |
209 | + //return false; | |
210 | + // $imageCodeValue.focus(); | |
211 | + getImgCode(); | |
212 | + } else if(res.code == "2010"){ | |
213 | + $('#login_error_ifo').text("用户没有关联停车场"); | |
214 | + getImgCode(); | |
215 | + } | |
216 | + else { | |
217 | + console.log(res.code); | |
218 | + $('.verification-logo').removeClass('glyphicon glyphicon-remove').addClass('glyphicon glyphicon-ok'); | |
219 | + $('#login_error_ifo').text("系统错误"); | |
220 | + // $error.text(res.msg); | |
221 | + getImgCode(); | |
222 | + } | |
223 | + | |
224 | +} | |
4 | 225 | \ No newline at end of file | ... | ... |
login.html
... | ... | @@ -6,21 +6,60 @@ |
6 | 6 | <meta name="renderer" content="ie-comp"> |
7 | 7 | <meta name="renderer" content="ie-stand"> |
8 | 8 | <meta name="google" content="notranslate" /> |
9 | - <title>首页</title> | |
9 | + <meta http-equiv="pragma" content="no-cache"> | |
10 | + <meta http-equiv="cache-control" content="no-cache"> | |
11 | + <meta http-equiv="expires" content="0"> | |
12 | + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> | |
13 | + <title>登录</title> | |
10 | 14 | <link rel="stylesheet" href="css/libCss/common.css"> |
11 | 15 | <link rel="stylesheet" href="css/libCss/bootstrap.min.css"> |
12 | 16 | <link rel="stylesheet" href="css/login.css"> |
13 | 17 | <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> </head> |
14 | 18 | </head> |
15 | 19 | <body> |
16 | -<header>header</header> | |
17 | -<nav>nav</nav> | |
18 | -<section>header</section> | |
19 | - | |
20 | +<div class="login-model"> | |
21 | +<!-- top-tit --> | |
22 | + <div class="top-tit">欢迎登录企业云接口平台</div> | |
23 | +<!-- content sta--> | |
24 | + <div class="login-content boxshadow posrel clearfix"> | |
25 | + <div class="login-contop posabl"></div> | |
26 | + <!-- user --> | |
27 | + <div class="user-cont"> | |
28 | + <div class="cont-user clearfix"> | |
29 | + <span class="user-bg"></span> | |
30 | + <input class="login-control" type="text" autocomplete="off" placeholder="请输入用户名" name="username" id="userName" maxlength="25"> | |
31 | + </div> | |
32 | + </div> | |
33 | + <!-- psw --> | |
34 | + <div class="psw-cont"> | |
35 | + <div class="cont-psw clearfix"> | |
36 | + <span class="psw-bg"></span> | |
37 | + <input class="login-control" type="text" autocomplete="off" placeholder="请输入6-20位字母和数字组成的密码" name="password" id="password" maxlength="25"> | |
38 | + </div> | |
39 | + </div> | |
40 | + <!-- yanzhengma --> | |
41 | + <div class="clearfix"> | |
42 | + <div class="ver-cont posrel float-left"> | |
43 | + <i class="verification-logo"></i> | |
44 | + <span class="ver-bg float-left"></span> | |
45 | + <input class="ver-control verification-input float-left" type="text" autocomplete="off" placeholder="请输入验证码" name="" maxlength="4" id="login_imgCode_value"> | |
46 | + </div> | |
47 | + <span class="imgWrap float-left"> | |
48 | + <img src="" id="login_imgCode"> | |
49 | + </span> | |
50 | + </div> | |
51 | + <!--error --> | |
52 | + <div class="login_error_ifo"></div> | |
53 | + <!--btn login--> | |
54 | + <div class="login-foot"> | |
55 | + <button type="button" class="btn uppercase" id="login-btn">登录</button> | |
56 | + </div> | |
57 | + </div> | |
58 | +</div> | |
20 | 59 | <script type="text/javascript" src="js/libJs/jquery.min.js"></script> |
21 | 60 | <script type="text/javascript" src="js/libJs/bootstrap.min.js"></script> |
22 | 61 | <script type="text/javascript"> |
23 | - document.write("<s" + "cript type='text/javascript' src='../assets/pages/scripts/login.js?ver" + Math.random() + "'></s" + "cript>"); | |
62 | + document.write("<s" + "cript type='text/javascript' src='js/login.js?ver" + Math.random() + "'></s" + "cript>"); | |
24 | 63 | </script> |
25 | 64 | </body> |
26 | 65 | </html> |
27 | 66 | \ No newline at end of file | ... | ... |