自动化立体仓库 - WMS系统
skyouc
昨天 9e6d4880ca1ce6ae5cb9b9dc1b865f0ee9f65fe8
src/main/webapp/views/login.html
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en">
  <head>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>中扬 │ login of zoneyung wms</title>
@@ -10,190 +10,193 @@
    <meta name="theme-color" content="#111111">
    <meta name="msapplication-TileImage" content="/sketch-threejs/img/common/ms_tileimage.png">
    <meta name="msapplication-TileColor" content="#111111">
    <link rel="icon" type="image/x-icon" href="../static/image/favicon.ico" />
    <link rel="icon" type="image/x-icon" href="../static/image/favicon.ico"/>
    <link rel="stylesheet" href="../static/css/font/font-awesome-4.7.0/css/font-awesome.css">
    <link rel="stylesheet" href="../static/css/main.min.css">
    <link rel="stylesheet" href="../static/css/login.css">
    <style>
      #sidebar{
        /*定位*/
        position: absolute;
        top: 50%;
        right: 1%;
        transform: translateY(-50%);
        width: 20%;
        height: 95%;
        /*特效*/
        background: rgba(255,255,255,0.6);
        border-radius: 5px;
        color: #ffffff;
        z-index: 99;
        box-shadow: 3px 3px 6px 3px rgba(0, 0, 0, .3);
      }
        #sidebar {
            /*定位*/
            position: absolute;
            top: 50%;
            right: 1%;
            transform: translateY(-50%);
            width: 20%;
            height: 95%;
            /*特效*/
            background: rgba(255, 255, 255, 0.6);
            border-radius: 5px;
            color: #ffffff;
            z-index: 99;
            box-shadow: 3px 3px 6px 3px rgba(0, 0, 0, .3);
        }
      .login-contain {
        position: relative;
        width: 100%;
        height: 100%;
      }
      .login-box {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        text-align: center;
      }
        .login-contain {
            position: relative;
            width: 100%;
            height: 100%;
        }
        .login-box {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 100%;
            text-align: center;
        }
    </style>
  </head>
  <body>
    <div class="l-page l-page--white" data-id="instancing">
      <div style="position: fixed;
</head>
<body>
<div class="l-page l-page--white" data-id="instancing">
    <div style="position: fixed;
                    z-index: 100;
                    top: 22px;
                    left: 20px;">
        <img src="../static/image/logo_light_colour.png" alt="" style="width: 20%">
      </div>
      <div class="p-sketch-outline">
    </div>
    <div class="p-sketch-outline">
        <h2 class="p-sketch-outline__title">Automatic Storage and Retrieval System</h2>
        <p class="p-sketch-outline__date">posted: 2018.01.01 / update: 2022.09.21
        </p>
        <p class="p-sketch-outline__description">wms made with various simple objects.</p>
      </div>
      <canvas class="p-canvas-webgl" id="canvas-webgl"></canvas>
    </div>
    <!-- 侧边栏 -->
    <div id="sidebar">
      <div class="login-contain">
    <canvas class="p-canvas-webgl" id="canvas-webgl"></canvas>
</div>
<!-- 侧边栏 -->
<div id="sidebar">
    <div class="login-contain">
        <div class="login-box">
          <img src="../static/image/zy_logo_dark_color.png" alt="" style="width: 80%">
<!--          <span class="login100-form-title p-t-20 p-b-45">中扬立库</span>-->
<!--          <span class="login100-form-title p-t-20 p-b-45" style="margin: 15px 0;color: #868686;font-size: 24px">WMS</span>-->
          <div class="wrap-input100 validate-input m-b-10" data-validate="请输入用户名">
            <input id="username" class="input100" type="text" name="username" placeholder="username" autocomplete="off">
            <span class="focus-input100"></span>
            <span class="symbol-input100">
            <img src="../static/image/zy_logo_dark_color.png" alt="" style="width: 80%">
            <!--          <span class="login100-form-title p-t-20 p-b-45">中扬立库</span>-->
            <!--          <span class="login100-form-title p-t-20 p-b-45" style="margin: 15px 0;color: #868686;font-size: 24px">WMS</span>-->
            <div class="wrap-input100 validate-input m-b-10" data-validate="请输入用户名">
                <input id="username" class="input100" type="text" name="username" placeholder="username"
                       autocomplete="off">
                <span class="focus-input100"></span>
                <span class="symbol-input100">
              <i class="fa fa-user"></i>
            </span>
          </div>
          <div class="wrap-input100 validate-input m-b-10" data-validate="请输入密码">
            <input id="password" class="input100" type="password" name="pass" placeholder="password">
            <span class="focus-input100"></span>
            <span class="symbol-input100">
            </div>
            <div class="wrap-input100 validate-input m-b-10" data-validate="请输入密码">
                <input id="password" class="input100" type="password" name="pass" placeholder="password">
                <span class="focus-input100"></span>
                <span class="symbol-input100">
              <i class="fa fa-lock"></i>
            </span>
          </div>
          <div class="container-login100-form-btn p-t-10">
            <button class="login100-form-btn login-btn">Login</button>
          </div>
          <div class="container-login100-form-btn p-t-10" style="display: none;margin-top: 50px;" id="updateLicense">
            <form enctype="multipart/form-data" style="display: none;">
              <input id="license" type="file" name="file" >
            </form>
            <button class="login100-form-btn" id="submitLicense">更新许可证</button>
          </div>
            </div>
            <div class="container-login100-form-btn p-t-10">
                <button class="login100-form-btn login-btn">Login</button>
            </div>
            <div class="container-login100-form-btn p-t-10" style="display: none;margin-top: 50px;" id="updateLicense">
                <form enctype="multipart/form-data" style="display: none;">
                    <input id="license" type="file" name="file">
                </form>
                <button class="login100-form-btn" id="submitLicense">更新许可证</button>
            </div>
        </div>
      </div>
    </div>
</div>
    <script type="text/javascript" src="../static/js/tools/main.min.js"></script>
    <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" src="../static/layer/layer.js"></script>
    <script type="text/javascript" src="../static/js/common.js"></script>
    <script>
      // remember pwd
      $(function () {
<script type="text/javascript" src="../static/js/tools/main.min.js"></script>
<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" src="../static/layer/layer.js"></script>
<script type="text/javascript" src="../static/js/common.js"></script>
<script>
    // remember pwd
    $(function () {
        var oldUserName = localStorage.getItem('oldUserName');
        var oldPass = localStorage.getItem('oldPass');
        if(oldUserName){
          $('#username').val(oldUserName);
        if (oldUserName) {
            $('#username').val(oldUserName);
        }
        if(oldPass){
          $('#password').val(oldPass);
        if (oldPass) {
            $('#password').val(oldPass);
        }
      })
    })
      window.onload = function(){document.getElementById("username").focus();}
    window.onload = function () {
        document.getElementById("username").focus();
    }
      $(document).on('click','.login-btn', function () {
    $(document).on('click', '.login-btn', function () {
        let username = $("#username").val();
        if (username === "") {
          layer.tips('请输入登录账号', '#username', {tips: [4, '#ff0000']});
          return;
            layer.tips('请输入登录账号', '#username', {tips: [4, '#ff0000']});
            return;
        }
        let password = $("#password").val();
        if (password === "") {
          layer.tips('请输入密码', '#password', {tips: [4, '#ff0000']});
          return;
            layer.tips('请输入密码', '#password', {tips: [4, '#ff0000']});
            return;
        }
        let params = {username: username, password: hex_md5(password)}
        $.ajax({
          url: baseUrl+"/login.action",
          data: {
            username: username,
            password: hex_md5(password)
          },
          method: 'POST',
          success: function (res) {
            if (res.code === 200){
              localStorage.setItem("token", res.data.token);
              localStorage.setItem("username", res.data.username);
              window.location.href = "index.html";
            } else if (res.code === 10001) {
              layer.tips(res.msg, '#username', {tips: [4, '#ff0000']});
            } else if (res.code === 10002) {
              layer.tips(res.msg, '#username', {tips: [4, '#ff0000']});
            } else if (res.code === 10003) {
              layer.tips(res.msg, '#password', {tips: [4, '#ff0000']});
            } else if (res.code == 20001) {
              layer.tips(res.msg, '.login-btn', {tips: [3, '#ff0000']});
              $("#updateLicense").show()
            } else {
              layer.tips(res.msg, '.login-btn', {tips: [3, '#ff0000']});
            url: baseUrl + "/login.action",
            headers: {'Content-Type': 'application/json'},
            data: JSON.stringify(params),
            method: 'POST',
            success: function (res) {
                if (res.code === 200) {
                    localStorage.setItem("token", res.data.token);
                    localStorage.setItem("username", res.data.username);
                    window.location.href = "index.html";
                } else if (res.code === 10001) {
                    layer.tips(res.msg, '#username', {tips: [4, '#ff0000']});
                } else if (res.code === 10002) {
                    layer.tips(res.msg, '#username', {tips: [4, '#ff0000']});
                } else if (res.code === 10003) {
                    layer.tips(res.msg, '#password', {tips: [4, '#ff0000']});
                } else if (res.code == 20001) {
                    layer.tips(res.msg, '.login-btn', {tips: [3, '#ff0000']});
                    $("#updateLicense").show()
                } else {
                    layer.tips(res.msg, '.login-btn', {tips: [3, '#ff0000']});
                }
            }
          }
        });
      });
    });
      $('body').keydown(function () {
    $('body').keydown(function () {
        if (event.keyCode === 13) {
          $(".login-btn").click();
            $(".login-btn").click();
        }
      });
    });
      //更新许可证
      $("#submitLicense").on("click",() => {
    //更新许可证
    $("#submitLicense").on("click", () => {
        $("#license").click()
      })
    })
      //上传并更新许可证
      $("#license").on("change",(evt) => {
    //上传并更新许可证
    $("#license").on("change", (evt) => {
        var files = evt.target.files;
        let formData = new FormData();
        formData.append("file", files[0])
        $.ajax({
          url: baseUrl+"/license/updateLicense",
          headers: {'token': localStorage.getItem('token')},
          data: formData,
          method: 'POST',
          cache: false,
          processData: false,
          contentType: false,
          success: function (res) {
            if (res.code == 200) {
              layer.msg('更新成功', {time: 1000}, () => {
                parent.location.reload()
              });
            }else{
              layer.msg(res.msg,{time:2000},() => {
                parent.location.reload()
              })
            url: baseUrl + "/license/updateLicense",
            headers: {'token': localStorage.getItem('token')},
            data: formData,
            method: 'POST',
            cache: false,
            processData: false,
            contentType: false,
            success: function (res) {
                if (res.code == 200) {
                    layer.msg('更新成功', {time: 1000}, () => {
                        parent.location.reload()
                    });
                } else {
                    layer.msg(res.msg, {time: 2000}, () => {
                        parent.location.reload()
                    })
                }
            }
          }
        })
      })
    </script>
  </body>
    })
</script>
</body>
</html>