index.jsp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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+"res/extjs/locale/ext-lang-zh_CN.js" %>"></script>
  22. <title>智慧消防管理平台</title>
  23. </head>
  24. <body onload="webInit();" style="overflow:hidden;">
  25. <form id="my_login">
  26. <div id="particles-js">
  27. <div class="bdy-login">
  28. <div id="frm-login" autocomplete="off">
  29. <p>
  30. <img src="res/img/login_title.png" alt="">
  31. </p>
  32. <p>
  33. <span>用户名</span>
  34. <input type="text" placeholder="请输入用户名" id="username" name="username" autocomplete="off">
  35. </p>
  36. <p>
  37. <span>密 码</span>
  38. <input type="password" placeholder="请输入密码" id="password" name="password" autocomplete="off">
  39. </p>
  40. <p id="btn-submit" onclick="loginSubmit()">
  41. 登 录
  42. </p>
  43. </div>
  44. </div>
  45. </div>
  46. </form>
  47. <script src="res/particles/js/app.js"></script>
  48. <script>
  49. $(function () {
  50. particlesJS.load('div-particles', 'https://iot.usky.cn/jdxf/Public/vendor/particles/assets/particles.json', function () {
  51. console.log('callback - particles.js config loaded')
  52. });
  53. $("#btn-submit").hover(function () {
  54. $(this).css({
  55. color: '#5cc7ff',
  56. border: '1px solid #5cc7ff',
  57. })
  58. });
  59. $("#btn-submit").mouseleave(function () {
  60. $(this).css({
  61. color: '#1EB2FF',
  62. border: '1px solid #009FFF',
  63. })
  64. });
  65. $("input").focus(function () {
  66. $(this).parent().css({
  67. border: '1px solid #009fff',
  68. })
  69. });
  70. $("input").blur(function () {
  71. $(this).parent().css({
  72. border: '1px solid #06538a',
  73. })
  74. })
  75. });
  76. $(function () {
  77. var w = $(document).width();
  78. var l = (w - 380) / 2;
  79. $("#btn-submit").click(function () {
  80. $("#frm-login").submit()
  81. });
  82. $(".bdy-login").css({
  83. "left": l
  84. }).animate({
  85. top: '300px',
  86. opacity: 1,
  87. filter: "alpha(opacity=" + 100 + ")"
  88. }, 1000);
  89. $(document).keydown(function (e) {
  90. if (e.which == 13) {
  91. $("#frm-login").submit()
  92. }
  93. })
  94. });
  95. var webInit = function () {
  96. sessionStorage.setItem('V_LOGINNAME', '');
  97. sessionStorage.setItem('V_PASSWORD', '');
  98. }
  99. var loginSubmit = function () {
  100. var basePath = $("#basePath").val();
  101. var queryJson = new Object();
  102. queryJson.V_LOGINNAME = $("#username").val();
  103. queryJson.V_PASSWORD = $("#password").val();
  104. queryJson.V_COMMAND = "LOGIN";
  105. var qdata = "queryJson=" + JSON.stringify(queryJson);
  106. var qurl = basePath + '/cgi-bin/WebAction.cgi';
  107. if ((basePath.indexOf('localhost') >= 0) || (basePath.indexOf('127.0.0.1') >= 0))
  108. qurl = 'http://47.103.74.123:8080/YtIoT/cgi-bin/WebAction.cgi';
  109. $.ajax({
  110. type: 'POST',
  111. url: qurl,
  112. data: qdata,
  113. success: function (result) {
  114. var json = eval('(' + result + ')');
  115. if (json.login == 'true') {
  116. sessionStorage.setItem('V_LOGINNAME', $("#username").val());
  117. sessionStorage.setItem('V_PASSWORD', $("#password").val());
  118. if ($("#username").val() == "wjzn") {
  119. location.href = basePath + "view/frontpage/index.html"
  120. } else {
  121. location.href = basePath + json.href
  122. }
  123. } else {
  124. if (json.login == 'false') {
  125. Ext.Msg.show({
  126. title: '错误信息',
  127. msg: json.Msg
  128. });
  129. }
  130. }
  131. }
  132. });
  133. };
  134. $("#my_login").submit(function (e) {
  135. loginSubmit();
  136. });
  137. </script>
  138. <input type="hidden" id="basePath" name="basePath" value="<%=basePath %>"/>
  139. </body>
  140. </html>