index.jsp 4.4 KB

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