From cf43493d7aa9c1a83cb1551c102f501f1dfde9b0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 06 六月 2020 13:23:39 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/login.html |   47 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/src/main/webapp/views/login.html b/src/main/webapp/views/login.html
index 9449100..d8442c9 100644
--- a/src/main/webapp/views/login.html
+++ b/src/main/webapp/views/login.html
@@ -5,7 +5,7 @@
     <title>绯荤粺鐧诲綍</title>
     <link rel="stylesheet" href="../static/layui/css/layui.css" media="all">
     <script type="text/javascript" src="../static/layui/layui.js"></script>
-
+    <script type="text/javascript" src="../static/js/common.js"></script>
     <style>
         html{
             height: 100%;
@@ -115,7 +115,7 @@
             <label class="layui-icon layui-icon-password layadmin-user-login-icon"></label>
             <input id="password" class="layui-input" type="password" name="password" lay-verify="password" placeholder="瀵嗙爜">
         </div>
-        <div id="code-box" class="layui-form-item">
+        <div id="code-box" class="layui-form-item" style="">
             <label id="code-label" class="layui-icon layui-icon-vercode layadmin-user-login-icon"></label>
             <input id="code" class="layui-input" type="text" name="password" lay-verify="code" placeholder="楠岃瘉鐮�">
             <img id="codeImg" title="鐪嬩笉娓咃紵鐐瑰嚮鎹竴寮犮��">
@@ -135,13 +135,30 @@
 <script type="text/javascript" src="../static/js/tools/md5.js"></script>
 <script type="text/javascript">
 
+    // 楠岃瘉鐮佸紑鍏�
+    var codeSwitch = 'Y';
+    $.ajax({
+        url: baseUrl+"/code/switch.action",
+        async: false,
+        success: function (res) {
+            if (res.data === 'N'){
+                codeSwitch = res.data;
+                $('#code-box').css("display", "none");
+            }
+        }
+    });
+
     // 鍒濆鍖栭獙璇佺爜
+    initCode();
+    $('#codeImg').click(function () {
+        initCode();
+    });
     function initCode() {
         var random = Math.random();
-        $('#codeImg').attr("src", "/code.action?sd="+random);
+        $('#codeImg').attr("src", baseUrl+"/code.action?sd="+random);
         setTimeout(function () {
             $.ajax({
-                url: "/code.do",
+                url: baseUrl+"/code.do",
                 data: {sd: random},
                 method: 'POST',
                 async: false,
@@ -151,10 +168,6 @@
             });
         }, 100);
     }
-    initCode();
-    $('#codeImg').click(function () {
-        initCode();
-    });
 
     layui.use(['form','layer'],function () {
         var form = layui.form,
@@ -173,21 +186,21 @@
                 return;
             }
             var code = $("#code").val();
-            // if (code === "") {
-            //     layer.msg("璇疯緭鍏ラ獙璇佺爜", {offset: '150px'});
-            //     return;
-            // }
-            // if (sessionStorage.getItem("code").toUpperCase() !== code.toUpperCase()){
-            //     layer.msg("楠岃瘉鐮侀敊璇�", {offset: '150px'});
-            //     return;
-            // }
+            if (code === "" && codeSwitch === 'Y') {
+                layer.msg("璇疯緭鍏ラ獙璇佺爜", {offset: '150px'});
+                return;
+            }
+            if (sessionStorage.getItem("code").toUpperCase() !== code.toUpperCase()&&codeSwitch==='Y'){
+                layer.msg("楠岃瘉鐮侀敊璇�", {offset: '150px'});
+                return;
+            }
 
             var user = {
                 mobile: mobile,
                 password: hex_md5(password)
             };
             $.ajax({
-                url: "/login.action",
+                url: baseUrl+"/login.action",
                 data: user,
                 method: 'POST',
                 success: function (res) {

--
Gitblit v1.9.1