Ver Fonte

登录页前端代码

jichaobo há 4 anos atrás
pai
commit
3f8dd1ae6f
2 ficheiros alterados com 136 adições e 36 exclusões
  1. 44 36
      WebRoot/index.jsp
  2. 92 0
      WebRoot/index1.css

+ 44 - 36
WebRoot/index.jsp

@@ -9,12 +9,11 @@
 <html lang="en">
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> -->
     <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="index.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>
@@ -39,8 +38,11 @@
                     <span>密 码</span>
                     <input type="password" placeholder="请输入密码" id="password" name="password" autocomplete="off">
                 </p>
-                <input id="userCaptcha" name="userCaptcha" type="text" placeholder="请输入验证码"/>
-                <img id="kaptchaImage" src="./login/getCheckNumber" onclick="change();">
+                <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>
@@ -100,44 +102,50 @@
     var webInit = function () {
         sessionStorage.setItem('V_LOGINNAME', '');
         sessionStorage.setItem('V_PASSWORD', '');
-
     }
     var loginSubmit = function () {
-        var p = $("#password").val()
-        var basePath = $("#basePath").val();
-        var queryJson = new Object();
-        queryJson.V_LOGINNAME = $("#username").val();
-        queryJson.V_PASSWORD = md5(p);
-        queryJson.V_COMMAND = "LOGIN";
-        var qdata = "queryJson=" + JSON.stringify(queryJson);
-        var qurl = basePath + '/cgi-bin/WebAction.cgi';
-        if ((basePath.indexOf('localhost') >= 0) || (basePath.indexOf('127.0.0.1') >= 0))
-            // qurl = 'http://47.103.74.123:8080/YtIoT/cgi-bin/WebAction.cgi';
+        var code=document.getElementById("userCaptcha").value;
+        if(code=='') {
+            Ext.Msg.show({
+                title: '错误信息',
+                msg: '请输入验证码!'
+            });
+        }else {
+            var p = $("#password").val()
+            var basePath = $("#basePath").val();
+            var queryJson = new Object();
+            queryJson.V_LOGINNAME = $("#username").val();
+            queryJson.V_PASSWORD = md5(p);
+            queryJson.V_COMMAND = "LOGIN";
+            queryJson.code =code;
+            var qdata = "queryJson=" + JSON.stringify(queryJson);
             var qurl = basePath + "login/tolgin";
-        $.ajax({
-            type: 'POST',
-            url: qurl,
-            data: qdata,
-            success: function (result) {
-                var json = eval('(' + result + ')');
-                if (json.login == 'true') {
-                    sessionStorage.setItem('V_LOGINNAME', $("#username").val());
-                    sessionStorage.setItem('V_PASSWORD', md5(p));
-                    if ($("#username").val() == "wjzn") {
-                        location.href = basePath + "view/frontpage/index.html"
+            $.ajax({
+                type: 'POST',
+                url: qurl,
+                data: qdata,
+                success: function (result) {
+                    var json = eval('(' + result + ')');
+                    // alert('ceshi')
+                    if (json.login == 'true') {
+                        sessionStorage.setItem('V_LOGINNAME', $("#username").val());
+                        sessionStorage.setItem('V_PASSWORD', md5(p));
+                        if ($("#username").val() == "wjzn") {
+                            location.href = basePath + "view/frontpage/index.html"
+                        } else {
+                            location.href = basePath + json.href
+                        }
                     } else {
-                        location.href = basePath + json.href
-                    }
-                } else {
-                    if (json.login == 'false') {
-                        Ext.Msg.show({
-                            title: '错误信息',
-                            msg: json.Msg
-                        });
+                        if (json.login == 'false') {
+                            Ext.Msg.show({
+                                title: '错误信息',
+                                msg: json.Msg
+                            });
+                        }
                     }
                 }
-            }
-        });
+            });
+        }
     };
     $("#my_login").submit(function (e) {
         loginSubmit();

+ 92 - 0
WebRoot/index1.css

@@ -0,0 +1,92 @@
+@charset "UTF-8";
+body {
+    width: 100%;
+    height: 100%;
+    background: rgba(11, 22, 53, .9);
+    margin: 0 auto;
+}
+
+#div-particles {
+    position: relative;
+    top: 0;
+}
+
+.bdy-login {
+    width: 385px;
+    border: 0px solid red;
+    position: absolute;
+    top: 600px;
+    left: 200px;
+    opacity: 0.1;
+}
+
+#frm-login {
+    width: 380px;
+    margin: 100 auto;
+    border: 0px solid orange;
+}
+
+#frm-login p {
+    width: 360px;
+    height: 40px;
+    line-height: 40px;
+    color: #fff;
+    margin: 20px auto 0 auto;
+    border: 1px solid #06538a;
+    font-size: 14px;
+    user-select: none;
+}
+
+#frm-login p:nth-child(1) {
+    border: 0px solid #fff;
+    text-align: center;
+}
+
+#frm-login p:nth-child(2) {
+    margin-top: 60px;
+    background: rgba(147, 157, 220, 0.2) url("res/img/login_account.png") no-repeat 320px 8px;
+}
+
+#frm-login p:nth-child(3) {
+    background: rgba(147, 157, 220, 0.2) url("res/img/login_password.png") no-repeat 320px 8px;
+}
+
+#frm-login p:nth-child(4) {
+    background: rgba(147, 157, 220, 0.2) no-repeat 320px 8px;
+}
+
+#frm-login p:nth-child(5) {
+    color: #1EB2FF;
+    border: 1px solid #009FFF;
+    cursor: pointer;
+    font-size: 18px;
+    text-align: center;
+}
+
+#frm-login span {
+    width: 80px;
+    display: inline-block;
+    text-align: center;
+}
+
+#frm-login input {
+    width: 228px;
+    height: 38px;
+    outline: none;
+    border: none;
+    background: transparent;
+    background: none;
+    color: #eee;
+}
+
+#frm-login input:-webkit-autofill {
+    transition: color 9999s, background-color 9999s ease-in-out;
+}
+
+#ver {
+    position: fixed;
+    bottom: 8px;
+    right: 8px;
+    color: #424a61;
+    font-size: 8px;
+}