index.jsp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8" %>
  3. <%
  4. String path = request.getContextPath();
  5. String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
  6. String baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/";
  7. %>
  8. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  9. <html lang="en">
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  12. <meta name="viewport"
  13. content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  14. <link type="text/css" rel="stylesheet" href="<%=basePath+"res/extjs/resources/css/ext-all-access.css" %>"/>
  15. <link type="text/css" rel="sytlesheet" href="<%=basePath+"res/particles/css/style.css" %>">
  16. <link type="text/css" rel="stylesheet" href="index1.css">
  17. <script type="text/javascript" src="<%=basePath+"res/jquery/jquery-3.3.1.min.js" %>"></script>
  18. <script type="text/javascript" src="<%=basePath+"res/particles/particles.min.js" %>"></script>
  19. <script type="text/javascript" src="<%=basePath+"res/extjs/ext-all.js" %>"></script>
  20. <script type="text/javascript" src="<%=basePath+"js/md5.js" %>"></script>
  21. <script type="text/javascript" src="<%=basePath+"js/denglu.js" %>"></script>
  22. <script type="text/javascript" src="<%=basePath+"res/extjs/locale/ext-lang-zh_CN.js" %>"></script>
  23. <title>智慧消防管理平台</title>
  24. </head>
  25. <body onload="webInit();" style="overflow:hidden;">
  26. <form id="my_login">
  27. <div id="particles-js">
  28. <div class="bdy-login">
  29. <div id="frm-login" autocomplete="off">
  30. <p>
  31. <img src="res/img/login_title.png" alt="">
  32. </p>
  33. <p>
  34. <span>用户名</span>
  35. <input type="text" placeholder="请输入用户名" id="username" name="username" autocomplete="off">
  36. </p>
  37. <p>
  38. <span>密 码</span>
  39. <input type="password" placeholder="请输入密码" id="password" name="password" autocomplete="off">
  40. </p>
  41. <p style="display:flex">
  42. <span>验证码</span>
  43. <input id="userCaptcha" name="userCaptcha" type="text" maxlength="4" class="inputs" placeholder="请输入验证码" autocomplete="off"/>
  44. <img id="kaptchaImage" src="./login/getCheckNumber" width="130" height="37" style="border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 5px; " onclick="change();">
  45. </p>
  46. <p id="btn-submit" onclick="loginSubmit()">
  47. 登 录
  48. </p>
  49. </div>
  50. </div>
  51. </div>
  52. </form>
  53. <script src="res/particles/js/app.js"></script>
  54. <script>
  55. $(function () {
  56. particlesJS.load('div-particles', 'https://iot.usky.cn/jdxf/Public/vendor/particles/assets/particles.json', function () {
  57. console.log('callback - particles.js config loaded')
  58. });
  59. $("#btn-submit").hover(function () {
  60. $(this).css({
  61. color: '#5cc7ff',
  62. border: '1px solid #5cc7ff',
  63. })
  64. });
  65. $("#btn-submit").mouseleave(function () {
  66. $(this).css({
  67. color: '#1EB2FF',
  68. border: '1px solid #009FFF',
  69. })
  70. });
  71. $("input").focus(function () {
  72. $(this).parent().css({
  73. border: '1px solid #009fff',
  74. })
  75. });
  76. $("input").blur(function () {
  77. $(this).parent().css({
  78. border: '1px solid #06538a',
  79. })
  80. })
  81. });
  82. $(function () {
  83. var w = $(document).width();
  84. var l = (w - 380) / 2;
  85. $("#btn-submit").click(function () {
  86. $("#frm-login").submit()
  87. });
  88. $(".bdy-login").css({
  89. "left": l
  90. }).animate({
  91. top: '300px',
  92. opacity: 1,
  93. filter: "alpha(opacity=" + 100 + ")"
  94. }, 1000);
  95. $(document).keydown(function (e) {
  96. if (e.which == 13) {
  97. $("#frm-login").submit()
  98. }
  99. })
  100. });
  101. var webInit = function () {
  102. sessionStorage.setItem('V_LOGINNAME', '');
  103. sessionStorage.setItem('V_PASSWORD', '');
  104. }
  105. var loginSubmit = function () {
  106. var code=document.getElementById("userCaptcha").value;
  107. if(window.localStorage.getItem('userCode')){
  108. var userCode = window.localStorage.getItem('userCode')
  109. if (userCode>=5){
  110. var userTime = window.localStorage.getItem('userTime')
  111. var nowTime1 = parseInt(new Date().getTime()/1000)
  112. var timeDiff1 = nowTime1-userTime
  113. var timeDiff = 10-timeDiff1
  114. if (timeDiff>0){
  115. window.alert("登录失败超过5次,请"+timeDiff+"秒后再重新登录!");
  116. }else {
  117. window.localStorage.setItem('userCode','0')
  118. window.localStorage.setItem('userTime',0)
  119. if(code=='') {
  120. Ext.Msg.show({
  121. title: '错误信息',
  122. msg: '请输入验证码!'
  123. });
  124. }else {
  125. var basePath = $("#basePath").val();
  126. var queryJson = new Object();
  127. queryJson.V_LOGINNAME = $("#username").val();
  128. queryJson.V_PASSWORD = md5($("#password").val());
  129. queryJson.V_COMMAND = "LOGIN";
  130. queryJson.code =code;
  131. var qdata = "queryJson=" + JSON.stringify(queryJson);
  132. var qurl = basePath + "login/tolgin"
  133. $.ajax({
  134. type: 'POST',
  135. url: qurl,
  136. data: qdata,
  137. success: function (result) {
  138. var json = eval('(' + result + ')');
  139. // alert('ceshi')
  140. sessionStorage.setItem('V_LOGINNAME',$("#username").val());
  141. sessionStorage.setItem('V_PASSWORD',$("#password").val());
  142. if (json.login == 'true') {
  143. if ($("#username").val() == "wjzn") {
  144. location.href = basePath + "view/frontpage/index.html"
  145. } else {
  146. // location.href = basePath + "index_QrCode.jsp";
  147. location.href = basePath + json.href
  148. }
  149. } else {
  150. if (json.login == 'false') {
  151. CheckNumber();
  152. Ext.Msg.show({
  153. title: '错误信息',
  154. msg: json.Msg === 'CODE WRONG' ? '验证码错误!'
  155. : json.Msg === 'WRONG PASSWORD!!!' ? '密码输入错误!'
  156. : json.Msg === 'LOGIN NAME WRONG' ? '用户名输入错误!'
  157. : json.Msg === 'WRONG TIME' ? '密码已超过90天未修改,请及时修改!'
  158. : json.Msg
  159. });
  160. if(window.localStorage.getItem('userCode')){
  161. var error_times = window.localStorage.getItem('userCode')
  162. error_times++;
  163. window.localStorage.setItem('userCode',error_times)
  164. if (error_times==5){
  165. var nowTime = parseInt(new Date().getTime()/1000)
  166. window.localStorage.setItem('userTime',nowTime)
  167. }
  168. }else {
  169. window.localStorage.setItem('userCode','1')
  170. }
  171. }
  172. }
  173. }
  174. });
  175. }
  176. }
  177. }else {
  178. if(code=='') {
  179. Ext.Msg.show({
  180. title: '错误信息',
  181. msg: '请输入验证码!'
  182. });
  183. }else {
  184. var basePath = $("#basePath").val();
  185. var queryJson = new Object();
  186. queryJson.V_LOGINNAME = $("#username").val();
  187. queryJson.V_PASSWORD = md5($("#password").val());
  188. queryJson.V_COMMAND = "LOGIN";
  189. queryJson.code =code;
  190. var qdata = "queryJson=" + JSON.stringify(queryJson);
  191. var qurl = basePath + "login/tolgin"
  192. $.ajax({
  193. type: 'POST',
  194. url: qurl,
  195. data: qdata,
  196. success: function (result) {
  197. var json = eval('(' + result + ')');
  198. // alert('ceshi')
  199. sessionStorage.setItem('V_LOGINNAME',$("#username").val());
  200. sessionStorage.setItem('V_PASSWORD',$("#password").val());
  201. if (json.login == 'true') {
  202. if ($("#username").val() == "wjzn") {
  203. location.href = basePath + "view/frontpage/index.html"
  204. } else {
  205. // location.href = basePath + "index_QrCode.jsp";
  206. location.href = basePath + json.href
  207. }
  208. } else {
  209. if (json.login == 'false') {
  210. CheckNumber();
  211. Ext.Msg.show({
  212. title: '错误信息',
  213. msg: json.Msg === 'CODE WRONG' ? '验证码错误!'
  214. : json.Msg === 'WRONG PASSWORD!!!' ? '密码输入错误!'
  215. : json.Msg === 'LOGIN NAME WRONG' ? '用户名输入错误!'
  216. : json.Msg === 'WRONG TIME' ? '密码已超过90天未修改,请及时修改!'
  217. : json.Msg
  218. });
  219. if(window.localStorage.getItem('userCode')){
  220. var error_times = window.localStorage.getItem('userCode')
  221. error_times++;
  222. window.localStorage.setItem('userCode',error_times)
  223. if (error_times==5){
  224. var nowTime = parseInt(new Date().getTime()/1000)
  225. window.localStorage.setItem('userTime',nowTime)
  226. }
  227. }else {
  228. window.localStorage.setItem('userCode','1')
  229. }
  230. }
  231. }
  232. }
  233. });
  234. }
  235. }
  236. }else {
  237. if(code=='') {
  238. Ext.Msg.show({
  239. title: '错误信息',
  240. msg: '请输入验证码!'
  241. });
  242. }else {
  243. var basePath = $("#basePath").val();
  244. var queryJson = new Object();
  245. queryJson.V_LOGINNAME = $("#username").val();
  246. queryJson.V_PASSWORD = md5($("#password").val());
  247. queryJson.V_COMMAND = "LOGIN";
  248. queryJson.code =code;
  249. var qdata = "queryJson=" + JSON.stringify(queryJson);
  250. var qurl = basePath + "login/tolgin"
  251. $.ajax({
  252. type: 'POST',
  253. url: qurl,
  254. data: qdata,
  255. success: function (result) {
  256. var json = eval('(' + result + ')');
  257. // alert('ceshi')
  258. sessionStorage.setItem('V_LOGINNAME',$("#username").val());
  259. sessionStorage.setItem('V_PASSWORD',$("#password").val());
  260. if (json.login == 'true') {
  261. if ($("#username").val() == "wjzn") {
  262. location.href = basePath + "view/frontpage/index.html"
  263. } else {
  264. // location.href = basePath + "index_QrCode.jsp";
  265. location.href = basePath + json.href
  266. }
  267. } else {
  268. if (json.login == 'false') {
  269. CheckNumber();
  270. Ext.Msg.show({
  271. title: '错误信息',
  272. msg: json.Msg === 'CODE WRONG' ? '验证码错误!'
  273. : json.Msg === 'WRONG PASSWORD!!!' ? '密码输入错误!'
  274. : json.Msg === 'LOGIN NAME WRONG' ? '用户名输入错误!'
  275. : json.Msg === 'WRONG TIME' ? '密码已超过90天未修改,请及时修改!'
  276. : json.Msg
  277. });
  278. if(window.localStorage.getItem('userCode')){
  279. var error_times = window.localStorage.getItem('userCode')
  280. error_times++;
  281. window.localStorage.setItem('userCode',error_times)
  282. if (error_times==5){
  283. var nowTime = parseInt(new Date().getTime()/1000)
  284. window.localStorage.setItem('userTime',nowTime)
  285. }
  286. }else {
  287. window.localStorage.setItem('userCode','1')
  288. }
  289. }
  290. }
  291. }
  292. });
  293. }
  294. }
  295. };
  296. // $("#my_login").submit(function (e) {
  297. // loginSubmit();
  298. // });
  299. function CheckNumber(){
  300. $('#userCaptcha').val('')
  301. $('#kaptchaImage').attr('src', './login/getCheckNumber?' + Math.floor(Math.random() * 100));
  302. }
  303. </script>
  304. <input type="hidden" id="basePath" name="basePath" value="<%=basePath %>"/>
  305. </body>
  306. </html>