index.jsp 4.2 KB

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