From ce6b5be6c0e1544bcc66f9fce9efec3ced724d95 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 11 七月 2020 15:46:29 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/pdaCe/login.html |   61 +++++++++++++++++++++++++++---
 1 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/src/main/webapp/views/pdaCe/login.html b/src/main/webapp/views/pdaCe/login.html
index ebc3270..3dd8476 100644
--- a/src/main/webapp/views/pdaCe/login.html
+++ b/src/main/webapp/views/pdaCe/login.html
@@ -3,9 +3,20 @@
 <head>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, target-densitydpi=high-dpi, initial-scale=1.0, user-scalable=no"/>
-    <title>绯荤粺鐧诲綍</title>
+    <title>娴欐睙涓壃鍌ㄥ瓨璁惧鏈夐檺鍏徃</title>
     <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
     <style>
+        html {
+            background-color: #fff;
+        }
+        body {
+            text-align: center;
+            padding: 10px 30px;
+        }
+        .login-form {
+            text-align: left;
+        }
+
         .login-form input {
             display: block;
         }
@@ -15,18 +26,18 @@
     </style>
 </head>
 <body>
-    <h1>涓壃鐗╂祦</h1>
+    <h2>绯荤粺鐧诲綍</h2>
     <div class="login-form">
         <div>
             <span>璐﹀彿</span>
             <input type="text" id="mobile" value="super">
         </div>
-        <div>
+        <div style="margin-top: 5px">
             <span>瀵嗙爜</span>
             <input type="password" id="password" value="xltys1995">
         </div>
-        <div>
-            <button onclick="login()">鐧诲綍</button>
+        <div style="margin-top: 8px;height: 20px;">
+            <button id="login" onclick="login()" style="padding: 5px 3px 0 3px">鐧诲綍</button>
         </div>
 
     </div>
@@ -34,7 +45,22 @@
 <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
 <script type="text/javascript" src="../../static/js/tools/md5.js"></script>
 <script type="text/javascript">
-
+    document.onkeyup = function (e) {
+        if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯
+            e = window.event;
+        var code = e.charCode || e.keyCode;
+        if (code === 13) {
+            login()
+        }
+    }
+    document.onkeydown = function (e) {
+        if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯
+            e = window.event;
+        var code = e.charCode || e.keyCode;
+        if (code === 13) {
+            document.getElementById("login");
+        }
+    }
     function login(){
         httpRequest({
             httpUrl: baseUrl+"/login.action",
@@ -44,10 +70,31 @@
                 password: hex_md5(document.getElementById('password').value)
             }
         }, function (res) {
-            window.location.href = "index.html";
+            if (res.code === 200) {
+                // localStorage.setItem("token", res.data.token);
+                // localStorage.setItem("username", res.data.username);
+                setCookie("token", res.data.token);
+                window.location.href = "index.html";
+            } else {
+                alert(res.msg);
+            }
+
         })
     }
 
+    // 璁剧疆cookie
+    function setCookie(objName, objValue){//娣诲姞cookie
+        var str = objName + "=" + encodeURIComponent(objValue);
+        // if (objHours > 0) {//涓�0鏃朵笉璁惧畾杩囨湡鏃堕棿锛屾祻瑙堝櫒鍏抽棴鏃禼ookie鑷姩娑堝け
+        //     var date = new Date();
+        //     var ms = objHours * 3600 * 1000;
+        //     date.setTime(date.getTime() + ms);
+        //     str += "; expires=" + date.toUTCString();
+        // }
+        str += "; path=/";
+        document.cookie = str;
+    }
+
     function httpRequest(paramObj,fun,errFun) {
         var xmlhttp = null;
         /*鍒涘缓XMLHttpRequest瀵硅薄锛�

--
Gitblit v1.9.1