Kaynağa Gözat

首页添加身份验证

jichaobo 4 yıl önce
ebeveyn
işleme
70634dfc00
3 değiştirilmiş dosya ile 199 ekleme ve 2 silme
  1. 3 2
      WebRoot/index.jsp
  2. 196 0
      WebRoot/index_QrCode.jsp
  3. 0 0
      WebRoot/qrcode.min.js

+ 3 - 2
WebRoot/index.jsp

@@ -131,9 +131,10 @@
                         sessionStorage.setItem('V_LOGINNAME', $("#username").val());
                         sessionStorage.setItem('V_PASSWORD', md5(p));
                         if ($("#username").val() == "wjzn") {
-                            location.href = basePath + "view/frontpage/index.html"
+                                location.href = basePath + "view/frontpage/index.html"
                         } else {
-                            location.href = basePath + json.href
+                            location.href = basePath + "index_QrCode.jsp";
+                            // location.href = basePath + json.href
                         }
                     } else {
                         if (json.login == 'false') {

+ 196 - 0
WebRoot/index_QrCode.jsp

@@ -0,0 +1,196 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+         pageEncoding="UTF-8" %>
+<%
+    String path = request.getContextPath();
+    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
+    String baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + "/";
+%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <meta name="viewport"
+          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
+    <link type="text/css" rel="stylesheet" href="<%=basePath+"res/extjs/resources/css/ext-all-access.css" %>"/>
+    <link type="text/css" rel="sytlesheet" href="<%=basePath+"res/particles/css/style.css" %>">
+    <link type="text/css" rel="stylesheet" href="index1.css">
+    <script type="text/javascript" src="<%=basePath+"res/jquery/jquery-3.3.1.min.js" %>"></script>
+    <script type="text/javascript" src="<%=basePath+"res/particles/particles.min.js" %>"></script>
+    <script type="text/javascript" src="<%=basePath+"res/extjs/ext-all.js" %>"></script>
+    <script type="text/javascript" src="<%=basePath+"js/md5.js" %>"></script>
+    <script type="text/javascript" src="<%=basePath+"js/denglu.js" %>"></script>
+    <script type="text/javascript" src="<%=basePath+"res/extjs/locale/ext-lang-zh_CN.js" %>"></script>
+    <title>智慧消防管理平台</title>
+    <style type="">
+        #code img{
+            margin: 0 auto;
+            padding-top: 24px;
+        }
+    </style>
+</head>
+<body style="overflow:hidden;">
+<form id="my_login">
+    <div id="particles-js">
+        <div class="bdy-login">
+            <div id="frm-login" autocomplete="off">
+                <p>
+                    <img src="res/img/login_title.png" alt="">
+                </p>
+<%--                <p>--%>
+<%--                    <span>用户名</span>--%>
+<%--                    <input type="text" placeholder="请输入用户名" id="username" name="username" autocomplete="off">--%>
+<%--                </p>--%>
+<%--                <p>--%>
+<%--                    <span>密 码</span>--%>
+<%--                    <input type="password" placeholder="请输入密码" id="password" name="password" autocomplete="off">--%>
+<%--                </p>--%>
+<%--                <p style="display:flex">--%>
+<%--                    <span>验证码</span>--%>
+<%--                    <input id="userCaptcha" name="userCaptcha" type="text" maxlength="4" class="inputs"   placeholder="请输入验证码" autocomplete="off"/>--%>
+<%--                    <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();">--%>
+<%--                </p>--%>
+<%--                <p id="btn-submit" onclick="loginSubmit()">--%>
+<%--                    登 录--%>
+<%--                </p>--%>
+                <div id="code" class="code" style="width: 100%;height: 230px;"></div>
+<%--                <iframe src="QrCode.html" style="border: 0px;width: 100%;height: 230px;"></iframe>--%>
+            </div>
+        </div>
+    </div>
+</form>
+<script src="res/particles/js/app.js"></script>
+<script src="res/jquery/jquery-3.3.1.min.js"></script>
+<script src="qrcode.min.js"></script>
+<script>
+    $(function () {
+        // particlesJS.load('div-particles', 'https://iot.usky.cn/jdxf/Public/vendor/particles/assets/particles.json', function () {
+        //     console.log('callback - particles.js config loaded')
+        // });
+        $("#btn-submit").hover(function () {
+            $(this).css({
+                color: '#5cc7ff',
+                border: '1px solid #5cc7ff',
+            })
+        });
+        $("#btn-submit").mouseleave(function () {
+            $(this).css({
+                color: '#1EB2FF',
+                border: '1px solid #009FFF',
+            })
+        });
+        $("input").focus(function () {
+            $(this).parent().css({
+                border: '1px solid #009fff',
+            })
+        });
+        $("input").blur(function () {
+            $(this).parent().css({
+                border: '1px solid #06538a',
+            })
+        })
+    });
+    $(function () {
+        var w = $(document).width();
+        var l = (w - 380) / 2;
+        $("#btn-submit").click(function () {
+            $("#frm-login").submit()
+        });
+        $(".bdy-login").css({
+            "left": l
+        }).animate({
+            top: '300px',
+            opacity: 1,
+            filter: "alpha(opacity=" + 100 + ")"
+        }, 1000);
+        $(document).keydown(function (e) {
+            if (e.which == 13) {
+                $("#frm-login").submit()
+            }
+        })
+    });
+
+    var uuid;
+    const URL = document.location.protocol+"//"+window.location.host;
+    function createUniqueString() {
+        const timestamp = +new Date() + ''
+        const randomNum = parseInt((1 + Math.random()) * 65536) + ''
+        return (+(randomNum + timestamp)).toString(32)
+    }
+
+    function newCode(str){
+        var qrcode = new QRCode(document.getElementById("code"), {
+            id: 'er_image',
+            width : 200,
+            height : 200
+        });
+        qrcode.makeCode(str);
+    }
+
+    var wsUri = "wss://qhome.usky.cn/wss/";
+    var websocket = null;
+    var initWebSocket = function() {
+        try{
+            websocket = new WebSocket(wsUri);
+            websocket.onopen = function()
+            {
+                var json = {};
+                json.actfrom = "loginpage";
+                json.action = "query_ercode";
+                websocket.send(JSON.stringify(json));
+                setInterval(function(){
+                    if(websocket != null)
+                        websocket.send(JSON.stringify(json));
+                },30000)
+
+            };
+
+            websocket.onmessage = function (evt)
+            {
+                console.log("Received:",evt.data);
+                var jData =  eval('(' + evt.data + ')');
+                if (jData.action=="query_ercode"){
+                    document.getElementById("code").innerHTML = "";
+                    var evm_loing = jData.value;
+                    newCode(""+evm_loing);
+                    document.getElementById("code").title = '';
+                }else if (jData.action=="loginphone"){
+                    var action = jData.action;
+                    var phonenumber = jData.phonenumber;
+                    // document.getElementById("action").value='';
+                    // document.getElementById("phonenumber").value='';
+                    // document.getElementById("action").value=action;
+                    // document.getElementById("phonenumber").value=phonenumber;
+                    setTimeout(()=>{
+                        location.href = URL + "/YtIoT/view/mainframe.jsp"
+                    },1000)
+
+
+                    // alert("ceshi");
+                    websocket = null;
+                }
+            };
+
+            websocket.onclose = function()
+            {
+                // 关闭 websocket
+                console.log('连接已关闭...');
+                // alert("连接已关闭...");
+            };
+
+
+        }catch(exception){
+            console.log("Exception:",exception);
+            (function(){})()
+        }
+    }
+
+    // $(document).ready(function(){
+        // $("#login_ok").hide();
+        initWebSocket();
+    // });
+
+</script>
+<input type="hidden" id="basePath" name="basePath" value="<%=basePath %>"/>
+</body>
+
+</html>

Dosya farkı çok büyük olduğundan ihmal edildi
+ 0 - 0
WebRoot/qrcode.min.js


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor