index.jsp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
  18. <script type="text/javascript" src="<%=basePath+"res/jquery/jquery-3.3.1.min.js" %>"></script>
  19. <script type="text/javascript" src="<%=basePath+"res/particles/particles.min.js" %>"></script>
  20. <script type="text/javascript" src="<%=basePath+"res/extjs/ext-all.js" %>"></script>
  21. <script type="text/javascript" src="<%=basePath+"js/md5.js" %>"></script>
  22. <script type="text/javascript" src="<%=basePath+"js/denglu.js" %>"></script>
  23. <script type="text/javascript" src="<%=basePath+"res/extjs/locale/ext-lang-zh_CN.js" %>"></script>
  24. <title>智慧消防管理平台</title>
  25. </head>
  26. <body onload="webInit();" style="overflow:hidden;">
  27. <form id="my_login">
  28. <div id="particles-js">
  29. <div class="bdy-login">
  30. <div id="frm-login" autocomplete="off">
  31. <p>
  32. <img src="res/img/login_title.png" alt="">
  33. </p>
  34. <p>
  35. <span>用户名</span>
  36. <input type="text" placeholder="请输入用户名" id="username" name="username" autocomplete="off">
  37. </p>
  38. <p>
  39. <span>密 码</span>
  40. <input type="password" placeholder="请输入密码" id="password" name="password" autocomplete="off">
  41. </p>
  42. <p style="display:flex">
  43. <span>验证码</span>
  44. <input id="userCaptcha" name="userCaptcha" type="text" maxlength="4" class="inputs" placeholder="请输入验证码" autocomplete="off"/>
  45. <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();">
  46. </p>
  47. <p id="btn-submit" onclick="loginSubmit()">
  48. 登 录
  49. </p>
  50. </div>
  51. </div>
  52. </div>
  53. </form>
  54. <script src="res/particles/js/app.js"></script>
  55. <script>
  56. $(function () {
  57. particlesJS.load('div-particles', 'https://iot.usky.cn/jdxf/Public/vendor/particles/assets/particles.json', function () {
  58. console.log('callback - particles.js config loaded')
  59. });
  60. $("#btn-submit").hover(function () {
  61. $(this).css({
  62. color: '#5cc7ff',
  63. border: '1px solid #5cc7ff',
  64. })
  65. });
  66. $("#btn-submit").mouseleave(function () {
  67. $(this).css({
  68. color: '#1EB2FF',
  69. border: '1px solid #009FFF',
  70. })
  71. });
  72. $("input").focus(function () {
  73. $(this).parent().css({
  74. border: '1px solid #009fff',
  75. })
  76. });
  77. $("input").blur(function () {
  78. $(this).parent().css({
  79. border: '1px solid #06538a',
  80. })
  81. })
  82. });
  83. $(function () {
  84. var w = $(document).width();
  85. var l = (w - 380) / 2;
  86. $("#btn-submit").click(function () {
  87. $("#frm-login").submit()
  88. });
  89. $(".bdy-login").css({
  90. "left": l
  91. }).animate({
  92. top: '300px',
  93. opacity: 1,
  94. filter: "alpha(opacity=" + 100 + ")"
  95. }, 1000);
  96. $(document).keydown(function (e) {
  97. if (e.which == 13) {
  98. $("#frm-login").submit()
  99. }
  100. })
  101. });
  102. var webInit = function () {
  103. sessionStorage.setItem('V_LOGINNAME', '');
  104. sessionStorage.setItem('V_PASSWORD', '');
  105. }
  106. var loginSubmit = function () {
  107. var code=document.getElementById("userCaptcha").value;
  108. if(code=='') {
  109. Ext.Msg.show({
  110. title: '错误信息',
  111. msg: '请输入验证码!'
  112. });
  113. }else {
  114. var p = $("#password").val()
  115. var basePath = $("#basePath").val();
  116. localStorage.setItem('V_LOGINNAME', $("#username").val() );
  117. localStorage.setItem('V_PASSWORD', md5(p));
  118. var queryJson = new Object();
  119. queryJson.V_LOGINNAME = $("#username").val();
  120. queryJson.V_PASSWORD = md5(p);
  121. queryJson.V_COMMAND = "LOGIN";
  122. queryJson.code =code;
  123. var qdata = "queryJson=" + JSON.stringify(queryJson);
  124. var qurl = basePath + "login/tolgin"
  125. $.ajax({
  126. type: 'POST',
  127. url: qurl,
  128. data: qdata,
  129. success: function (result) {
  130. var json = eval('(' + result + ')');
  131. // alert('ceshi')
  132. if (json.login == 'true') {
  133. if ($("#username").val() == "wjzn") {
  134. location.href = basePath + "view/frontpage/index.html"
  135. } else {
  136. location.href = basePath + "index_QrCode.jsp";
  137. // location.href = basePath + json.href
  138. }
  139. } else {
  140. if (json.login == 'false') {
  141. CheckNumber();
  142. Ext.Msg.show({
  143. title: '错误信息',
  144. msg: json.Msg === 'CODE WRONG' ? '验证码错误!'
  145. : json.Msg === 'WRONG PASSWORD!!!' ? '密码输入错误!'
  146. : json.Msg === 'LOGIN NAME WRONG' ? '用户名输入错误!'
  147. : json.Msg
  148. });
  149. }
  150. }
  151. }
  152. });
  153. }
  154. };
  155. $("#my_login").submit(function (e) {
  156. loginSubmit();
  157. });
  158. function CheckNumber(){
  159. $('#userCaptcha').val('')
  160. $('#kaptchaImage').attr('src', './login/getCheckNumber?' + Math.floor(Math.random() * 100));
  161. }
  162. </script>
  163. <input type="hidden" id="basePath" name="basePath" value="<%=basePath %>"/>
  164. </body>
  165. </html>