index_QrCode.jsp 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. <style type="">
  25. #code img {
  26. margin: 0 auto;
  27. padding-top: 24px;
  28. }
  29. </style>
  30. </head>
  31. <body style="overflow:hidden;">
  32. <form id="my_login">
  33. <div id="particles-js">
  34. <div class="bdy-login">
  35. <div id="frm-login" autocomplete="off">
  36. <p>
  37. <img src="res/img/login_title.png" alt="">
  38. </p>
  39. <%-- <p>--%>
  40. <%-- <span>用户名</span>--%>
  41. <%-- <input type="text" placeholder="请输入用户名" id="username" name="username" autocomplete="off">--%>
  42. <%-- </p>--%>
  43. <%-- <p>--%>
  44. <%-- <span>密 码</span>--%>
  45. <%-- <input type="password" placeholder="请输入密码" id="password" name="password" autocomplete="off">--%>
  46. <%-- </p>--%>
  47. <%-- <p style="display:flex">--%>
  48. <%-- <span>验证码</span>--%>
  49. <%-- <input id="userCaptcha" name="userCaptcha" type="text" maxlength="4" class="inputs" placeholder="请输入验证码" autocomplete="off"/>--%>
  50. <%-- <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();">--%>
  51. <%-- </p>--%>
  52. <%-- <p id="btn-submit" onclick="loginSubmit()">--%>
  53. <%-- 登 录--%>
  54. <%-- </p>--%>
  55. <div id="code" class="code" style="width: 100%;height: 230px;"></div>
  56. <span>
  57. <p>使用永天智慧云智慧消防公众号“扫一扫”完成登录</p>
  58. </span>
  59. <%-- <iframe src="QrCode.html" style="border: 0px;width: 100%;height: 230px;"></iframe>--%>
  60. </div>
  61. </div>
  62. </div>
  63. </form>
  64. <script src="res/particles/js/app.js"></script>
  65. <script src="res/jquery/jquery-3.3.1.min.js"></script>
  66. <script src="qrcode.min.js"></script>
  67. <script>
  68. $(function () {
  69. // particlesJS.load('div-particles', 'https://iot.usky.cn/jdxf/Public/vendor/particles/assets/particles.json', function () {
  70. // console.log('callback - particles.js config loaded')
  71. // });
  72. $("#btn-submit").hover(function () {
  73. $(this).css({
  74. color: '#5cc7ff',
  75. border: '1px solid #5cc7ff',
  76. })
  77. });
  78. $("#btn-submit").mouseleave(function () {
  79. $(this).css({
  80. color: '#1EB2FF',
  81. border: '1px solid #009FFF',
  82. })
  83. });
  84. $("input").focus(function () {
  85. $(this).parent().css({
  86. border: '1px solid #009fff',
  87. })
  88. });
  89. $("input").blur(function () {
  90. $(this).parent().css({
  91. border: '1px solid #06538a',
  92. })
  93. })
  94. });
  95. $(function () {
  96. var w = $(document).width();
  97. var l = (w - 380) / 2;
  98. $("#btn-submit").click(function () {
  99. $("#frm-login").submit()
  100. });
  101. $(".bdy-login").css({
  102. "left": l
  103. }).animate({
  104. top: '300px',
  105. opacity: 1,
  106. filter: "alpha(opacity=" + 100 + ")"
  107. }, 1000);
  108. $(document).keydown(function (e) {
  109. if (e.which == 13) {
  110. $("#frm-login").submit()
  111. }
  112. })
  113. });
  114. var uuid;
  115. const URL = document.location.protocol + "//" + window.location.host;
  116. function createUniqueString() {
  117. const timestamp = +new Date() + ''
  118. const randomNum = parseInt((1 + Math.random()) * 65536) + ''
  119. return (+(randomNum + timestamp)).toString(32)
  120. }
  121. function newCode(str) {
  122. var qrcode = new QRCode(document.getElementById("code"), {
  123. id: 'er_image',
  124. width: 200,
  125. height: 200
  126. });
  127. qrcode.makeCode(str);
  128. }
  129. var wsUri = "wss://qhome.usky.cn/wss/";
  130. var websocket = null;
  131. var initWebSocket = function () {
  132. try {
  133. websocket = new WebSocket(wsUri);
  134. websocket.onopen = function () {
  135. var json = {};
  136. json.actfrom = "loginpage";
  137. json.action = "query_ercode";
  138. websocket.send(JSON.stringify(json));
  139. setInterval(function () {
  140. if (websocket != null)
  141. websocket.send(JSON.stringify(json));
  142. }, 30000)
  143. };
  144. websocket.onmessage = function (evt) {
  145. console.log("Received:", evt.data);
  146. var jData = eval('(' + evt.data + ')');
  147. if (jData.action == "query_ercode") {
  148. document.getElementById("code").innerHTML = "";
  149. var evm_loing = jData.value;
  150. newCode("" + evm_loing);
  151. document.getElementById("code").title = '';
  152. } else if (jData.action == "loginphone") {
  153. var action = jData.action;
  154. var phonenumber = jData.phonenumber;
  155. // document.getElementById("action").value='';
  156. // document.getElementById("phonenumber").value='';
  157. // document.getElementById("action").value=action;
  158. // document.getElementById("phonenumber").value=phonenumber;
  159. sessionStorage.setItem('V_LOGINNAME', localStorage.getItem('V_LOGINNAME'));
  160. sessionStorage.setItem('V_PASSWORD', localStorage.getItem('V_PASSWORD'));
  161. setTimeout(() => {
  162. // location.href = URL + "/unnamed/view/mainframe.jsp"
  163. location.href = URL + "/YtIoT/view/mainframe.jsp"
  164. }, 1000)
  165. // var basePath = $("#basePath").val();
  166. // var queryJson = new Object();
  167. // queryJson.V_LOGINNAME = localStorage.getItem('V_LOGINNAME');
  168. // queryJson.V_PASSWORD = localStorage.getItem('V_PASSWORD');
  169. // queryJson.V_COMMAND = "LOGIN";
  170. // queryJson.code =code;
  171. // var qdata = "queryJson=" + JSON.stringify(queryJson);
  172. // var qurl = basePath + "login/tolgin";
  173. // $.ajax({
  174. // type: 'POST',
  175. // url: qurl,
  176. // data: qdata,
  177. // success: function (result) {
  178. // var json = eval('(' + result + ')');
  179. // // alert('ceshi')
  180. // if (json.login == 'true') {
  181. // sessionStorage.setItem('V_LOGINNAME', queryJson.V_LOGINNAME);
  182. // sessionStorage.setItem('V_PASSWORD', queryJson.V_PASSWORD);
  183. //
  184. // } else {
  185. // if (json.login == 'false') {
  186. // Ext.Msg.show({
  187. // title: '错误信息',
  188. // msg: json.Msg
  189. // });
  190. // }
  191. // }
  192. // }
  193. // });
  194. // alert("ceshi");
  195. websocket = null;
  196. }
  197. };
  198. websocket.onclose = function () {
  199. // 关闭 websocket
  200. console.log('连接已关闭...');
  201. // alert("连接已关闭...");
  202. };
  203. } catch (exception) {
  204. console.log("Exception:", exception);
  205. (function () {
  206. })()
  207. }
  208. }
  209. // $(document).ready(function(){
  210. // $("#login_ok").hide();
  211. initWebSocket();
  212. // });
  213. </script>
  214. <input type="hidden" id="basePath" name="basePath" value="<%=basePath %>"/>
  215. </body>
  216. </html>