index.jsp 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> -->
  13. <meta name="viewport"
  14. content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  15. <link type="text/css" rel="stylesheet" href="<%=basePath+"res/extjs/resources/css/ext-all-access.css" %>"/>
  16. <link type="text/css" rel="sytlesheet" href="<%=basePath+"res/particles/css/style.css" %>">
  17. <link type="text/css" rel="stylesheet" href="index.css">
  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. <input id="userCaptcha" name="userCaptcha" type="text" placeholder="请输入验证码"/>
  43. <img id="kaptchaImage" src="./login/getCheckNumber" onclick="change();">
  44. <p id="btn-submit" onclick="loginSubmit()">
  45. 登 录
  46. </p>
  47. </div>
  48. </div>
  49. </div>
  50. </form>
  51. <script src="res/particles/js/app.js"></script>
  52. <script>
  53. $(function () {
  54. particlesJS.load('div-particles', 'https://iot.usky.cn/jdxf/Public/vendor/particles/assets/particles.json', function () {
  55. console.log('callback - particles.js config loaded')
  56. });
  57. $("#btn-submit").hover(function () {
  58. $(this).css({
  59. color: '#5cc7ff',
  60. border: '1px solid #5cc7ff',
  61. })
  62. });
  63. $("#btn-submit").mouseleave(function () {
  64. $(this).css({
  65. color: '#1EB2FF',
  66. border: '1px solid #009FFF',
  67. })
  68. });
  69. $("input").focus(function () {
  70. $(this).parent().css({
  71. border: '1px solid #009fff',
  72. })
  73. });
  74. $("input").blur(function () {
  75. $(this).parent().css({
  76. border: '1px solid #06538a',
  77. })
  78. })
  79. });
  80. $(function () {
  81. var w = $(document).width();
  82. var l = (w - 380) / 2;
  83. $("#btn-submit").click(function () {
  84. $("#frm-login").submit()
  85. });
  86. $(".bdy-login").css({
  87. "left": l
  88. }).animate({
  89. top: '300px',
  90. opacity: 1,
  91. filter: "alpha(opacity=" + 100 + ")"
  92. }, 1000);
  93. $(document).keydown(function (e) {
  94. if (e.which == 13) {
  95. $("#frm-login").submit()
  96. }
  97. })
  98. });
  99. var webInit = function () {
  100. sessionStorage.setItem('V_LOGINNAME', '');
  101. sessionStorage.setItem('V_PASSWORD', '');
  102. }
  103. var loginSubmit = function () {
  104. var p = $("#password").val()
  105. var basePath = $("#basePath").val();
  106. var queryJson = new Object();
  107. queryJson.V_LOGINNAME = $("#username").val();
  108. queryJson.V_PASSWORD = md5(p);
  109. queryJson.V_COMMAND = "LOGIN";
  110. var qdata = "queryJson=" + JSON.stringify(queryJson);
  111. var qurl = basePath + '/cgi-bin/WebAction.cgi';
  112. if ((basePath.indexOf('localhost') >= 0) || (basePath.indexOf('127.0.0.1') >= 0))
  113. // qurl = 'http://47.103.74.123:8080/YtIoT/cgi-bin/WebAction.cgi';
  114. var qurl = basePath + "login/tolgin";
  115. $.ajax({
  116. type: 'POST',
  117. url: qurl,
  118. data: qdata,
  119. success: function (result) {
  120. var json = eval('(' + result + ')');
  121. if (json.login == 'true') {
  122. sessionStorage.setItem('V_LOGINNAME', $("#username").val());
  123. sessionStorage.setItem('V_PASSWORD', md5(p));
  124. if ($("#username").val() == "wjzn") {
  125. location.href = basePath + "view/frontpage/index.html"
  126. } else {
  127. location.href = basePath + json.href
  128. }
  129. } else {
  130. if (json.login == 'false') {
  131. Ext.Msg.show({
  132. title: '错误信息',
  133. msg: json.Msg
  134. });
  135. }
  136. }
  137. }
  138. });
  139. };
  140. $("#my_login").submit(function (e) {
  141. loginSubmit();
  142. });
  143. </script>
  144. <input type="hidden" id="basePath" name="basePath" value="<%=basePath %>"/>
  145. </body>
  146. </html>