index.jsp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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(code=='') {
  108. Ext.Msg.show({
  109. title: '错误信息',
  110. msg: '请输入验证码!'
  111. });
  112. }else {
  113. var p = $("#password").val()
  114. var basePath = $("#basePath").val();
  115. localStorage.setItem('V_LOGINNAME', $("#username").val() );
  116. localStorage.setItem('V_PASSWORD', md5(p));
  117. var queryJson = new Object();
  118. queryJson.V_LOGINNAME = $("#username").val();
  119. queryJson.V_PASSWORD = md5(p);
  120. queryJson.V_COMMAND = "LOGIN";
  121. queryJson.code =code;
  122. var qdata = "queryJson=" + JSON.stringify(queryJson);
  123. var qurl = basePath + "login/tolgin"
  124. $.ajax({
  125. type: 'POST',
  126. url: qurl,
  127. data: qdata,
  128. success: function (result) {
  129. var json = eval('(' + result + ')');
  130. // alert('ceshi')
  131. if (json.login == 'true') {
  132. if ($("#username").val() == "wjzn") {
  133. location.href = basePath + "view/frontpage/index.html"
  134. } else {
  135. location.href = basePath + "index_QrCode.jsp";
  136. // location.href = basePath + json.href
  137. }
  138. } else {
  139. if (json.login == 'false') {
  140. CheckNumber();
  141. Ext.Msg.show({
  142. title: '错误信息',
  143. msg: json.Msg === 'CODE WRONG' ? '验证码错误!'
  144. : json.Msg === 'WRONG PASSWORD!!!' ? '密码输入错误!'
  145. : json.Msg === 'LOGIN NAME WRONG' ? '用户名输入错误!'
  146. : json.Msg
  147. });
  148. }
  149. }
  150. }
  151. });
  152. }
  153. };
  154. $("#my_login").submit(function (e) {
  155. loginSubmit();
  156. });
  157. function CheckNumber(){
  158. $('#userCaptcha').val('')
  159. $('#kaptchaImage').attr('src', './login/getCheckNumber?' + Math.floor(Math.random() * 100));
  160. }
  161. </script>
  162. <input type="hidden" id="basePath" name="basePath" value="<%=basePath %>"/>
  163. </body>
  164. </html>