index.jsp 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8"%>
  3. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4. <% String basePath = request.getScheme()+ "://" + request.getServerName() + ":" +request.getServerPort() + request.getContextPath(); %>
  5. <% String contextPath = request.getContextPath() ;%>
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  7. <html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  10. <title>淮安市住房保障管理系统</title>
  11. <link href="<%=basePath %>/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
  12. <script type="text/javascript" src="<%=basePath %>/js/jquery-1.8.0.min.js"></script>
  13. <script type="text/javascript" src="<%=basePath %>/js/md5.js"></script>
  14. <script src="<%=basePath %>/js/sm2/crypto-js.js"></script>
  15. <script src="<%=basePath %>/js/sm2/sm2.js"></script>
  16. <style type="text/css">
  17. .login_body{
  18. background: url(images/login.png) no-repeat 0 -1px;
  19. width: 1340px;
  20. height: 746px;
  21. margin: 0 auto;
  22. *margin-top:-1px;
  23. border:1px solid transparent;
  24. }
  25. .login_form{
  26. width:350px;
  27. height: 180px;
  28. margin-top:270px;
  29. margin-left:820px;
  30. border:1px solid transparent;
  31. }
  32. .login_btn{
  33. width: 240px;
  34. height: 40px;
  35. background: url(images/login_btn.png);
  36. border: 0px;
  37. margin-left: 60px;
  38. }
  39. .error{
  40. color: red;
  41. height:16px;
  42. font-size: 12px;
  43. padding-left: 16px;
  44. }
  45. .label{
  46. float: left;
  47. position: absolute;
  48. margin-left: 38px;
  49. margin-top:11px;
  50. color: #999;
  51. font-size: 12px;
  52. line-height: 18px;
  53. cursor: text;
  54. }
  55. .text {
  56. width: 230px;
  57. height: 16px;
  58. border: 1px solid #B0B0B0;
  59. line-height: 14px;
  60. padding: 11px 16px 11px 45px;
  61. color: #333;
  62. font-size: 12px;
  63. margin-left: 30px;
  64. }
  65. </style>
  66. <style type="text/css">
  67. .yzm{
  68. cursor:pointer;
  69. background-position:center;
  70. background-image:url(<%=basePath %>/userAction_checkCode);
  71. background-repeat:no-repeat;
  72. font-size:20px;
  73. line-height:35px;
  74. width:80px;
  75. height:35px;
  76. float:right;
  77. }
  78. </style>
  79. <jsp:include page="../common/include.jsp"></jsp:include>
  80. <script type="text/javascript">
  81. const pubkeyHex = '04997d6804e85932b7adcf9c10641b3cee749d79fb7460c9e37431f3b27aa8a1b65d43aaa98dcf564562bab2538a187d6a334436e124d41c7bcd5b2384ca76146a';
  82. const cipherMode = 1;
  83. function auto_login(){
  84. if(event.keyCode==13) {
  85. login();
  86. }
  87. }
  88. function login(){
  89. if($("#userName").val() == ""){
  90. $("#login_error").text("");
  91. $("#error").text("账户不能为空");
  92. $("#error").show();
  93. return ;
  94. }else{
  95. $("#error").hide();
  96. }
  97. if($("#userPassword").val() == ""){
  98. $("#login_error").text("");
  99. $("#error").text("密码不能为空");
  100. $("#error").show();
  101. return ;
  102. }else{
  103. $("#error").hide();
  104. }
  105. if($("#yzm").val() == ""){
  106. $("#login_error").text("");
  107. $("#error").text("验证码不能为空");
  108. $("#error").show();
  109. return ;
  110. }else{
  111. $("#error").hide();
  112. }
  113. //$("#userName").val(sm2Encrypt($("#userName").val(), pubkeyHex, cipherMode));
  114. //$("#userPassword").val(sm2Encrypt($("#userPassword").val(), pubkeyHex, cipherMode));
  115. var password = $("#userPassword").val();
  116. var passwordMd5 = hex_md5(password);
  117. //console.log(passwordMd5);
  118. $("#userPassword").val(passwordMd5)
  119. $.messager.progress({
  120. text : '登录中,请稍后....'
  121. });
  122. $("#loginForm").submit();
  123. }
  124. var t ;
  125. function getPWD(){
  126. if($("#userName").val() == ""){
  127. $("#login_error").text("");
  128. $("#error").text("账户不能为空");
  129. $("#error").show();
  130. return ;
  131. }else{
  132. var count = $("#pwd").text();
  133. if("获取密码" == count){
  134. $("#pwd").text(60);
  135. t=setTimeout("countSecond()",1000);
  136. //工作任务状态
  137. $.ajax({
  138. type: "post",//使用post方法访问后台
  139. dataType: "json",//返回json格式的数据
  140. url: "userAction_sms",//要访问的后台地址
  141. data:{"user.phone":$("#userName").val()},
  142. success: function(msg){//msg为返回的数据,在这里做数据绑定
  143. if(msg.success){
  144. }else{
  145. $.messager.alert('提示',msg.message);
  146. //stopCount();
  147. }
  148. }
  149. });
  150. }
  151. }
  152. }
  153. function countSecond(){
  154. var count = $("#pwd").text();
  155. count = count - 1;
  156. if(count == 0){
  157. $("#pwd").text("获取密码");
  158. }else{
  159. $("#pwd").text(count);
  160. t = setTimeout("countSecond()",1000);
  161. }
  162. }
  163. function stopCount(){
  164. clearTimeout(t);
  165. $("#pwd").text("获取密码");
  166. }
  167. </script>
  168. </head>
  169. <body style="margin:0px; background-color: #e7fbff;background: url(images/bg_01.png) repeat-x;"" onkeydown="auto_login()">
  170. <div class="login_body">
  171. <div class="login_form">
  172. <form id="loginForm" action="userAction_login" method="post">
  173. <div style="height: 20px; width: 100%; margin-left:auto;margin-right:auto;text-align:center; border:1px solid transparent;margin-top: 5px;">
  174. <c:if test="${loginError != null }">
  175. <span id="login_error" class="error">${loginError}</span>
  176. </c:if>
  177. <span class="error" style="display:none;" id="error"></span>
  178. </div>
  179. <div style="height: 40px; width: 100%;border:1px solid transparent;margin-top: 5px;">
  180. <label class="label" for="userName">账号</label>
  181. <input type="text" id="userName" name="user.name" class="text" autocomplete="off" tabindex="1">
  182. </div>
  183. <div style="height: 40px; width: 100%;border:1px solid transparent;margin-top: 5px;">
  184. <label style="position: absolute; margin-left:38px; height:40px;line-height:40px; color: #999;font-size: 12px;" for="userPassword">密码</label>
  185. <input type="password" id="userPassword" name="user.password" class="text" style="width: 160px;border-right: 0px;" autocomplete="off" tabindex="1">
  186. <div id="pwd" onclick="getPWD()" style="cursor:pointer; float: right; text-align:center; margin-right:28px; width:69px;border-right:1px solid #b0b0b0;border-top:1px solid #b0b0b0; border-bottom:1px solid #b0b0b0; height: 38px;line-height: 38px;color: #999;background-color: #fff;font-size: 12px;">获取密码</div>
  187. </div>
  188. <div style="height: 40px; width: 100%;border:1px solid transparent;margin-top: 5px;">
  189. <label class="label" for="yzm">验证码</label>
  190. <input type="text" id="yzm" name="yzm" style="width:50%" class="text" autocomplete="off" tabindex="1">
  191. <div id="jc" class="yzm" title="看不清?点击更换" onclick="this.style.backgroundImage='url(<%=basePath %>/userAction_checkCode?ts=' + new Date().getTime() + ')'"></div>
  192. </div>
  193. <div style="margin-top: 5px;">
  194. <input type="button" onclick="login()" class="login_btn" value="">
  195. </div>
  196. </form>
  197. </div>
  198. </div>
  199. </body>
  200. <script type="text/javascript">
  201. <!--
  202. $(function(){
  203. parent.$.messager.progress('close');
  204. });
  205. //-->
  206. </script>
  207. </html>