From ab5f513d865f3458b3721f352138d245fc1a4fe1 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期四, 09 七月 2020 13:50:38 +0800 Subject: [PATCH] # --- src/main/webapp/views/pdaCe/login.html | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/views/pdaCe/login.html b/src/main/webapp/views/pdaCe/login.html index ebc3270..ae52528 100644 --- a/src/main/webapp/views/pdaCe/login.html +++ b/src/main/webapp/views/pdaCe/login.html @@ -34,7 +34,21 @@ <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.onkeydown = function(e) { + //鎹曟崏鍥炶溅浜嬩欢 + var ev = (typeof event!= 'undefined') ? window.event : e; + if(ev.keyCode === 13 && document.activeElement.id === "key") { + login() + } + } + document.onkeyup = function (e) { + if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯 + e = window.event; + var code = e.charCode || e.keyCode; + if (code === 13) { + login() + } + } function login(){ httpRequest({ httpUrl: baseUrl+"/login.action", @@ -44,7 +58,12 @@ password: hex_md5(document.getElementById('password').value) } }, function (res) { - window.location.href = "index.html"; + if (res.code === 200) { + window.location.href = "index.html"; + } else { + alert(res.msg); + } + }) } -- Gitblit v1.9.1