<!DOCTYPE html> 
 | 
<html lang="en"> 
 | 
<head> 
 | 
    <script>if (window !== top) top.location.replace(location.href);</script> 
 | 
    <meta charset="utf-8"/> 
 | 
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
 | 
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 
 | 
    <link rel="icon" type="image/x-icon" href="../static/image/logo1.png" /> 
 | 
    <title>宏挺紧固件 WMS - 用户登录</title> 
 | 
    <link rel="stylesheet" href="../static/layui/css/layui.css" media="all"> 
 | 
    <link rel="stylesheet" href="../static/css/admin.css?v=318"> 
 | 
    <!--[if lt IE 9]> 
 | 
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> 
 | 
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> 
 | 
    <![endif]--> 
 | 
    <style> 
 | 
        body { 
 | 
            background-image: url("../static/image/bg-img.jpg"); 
 | 
            background-repeat: no-repeat; 
 | 
            background-size: cover; 
 | 
            min-height: 100vh; 
 | 
        } 
 | 
  
 | 
        body:before { 
 | 
            content: ""; 
 | 
            background-color: rgba(0, 0, 0, .2); 
 | 
            position: fixed; 
 | 
            top: 0; 
 | 
            left: 0; 
 | 
            right: 0; 
 | 
            bottom: 0; 
 | 
        } 
 | 
  
 | 
        .login-wrapper { 
 | 
            max-width: 420px; 
 | 
            padding: 20px; 
 | 
            margin: 0 auto; 
 | 
            position: relative; 
 | 
            box-sizing: border-box; 
 | 
            z-index: 2; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form { 
 | 
            padding: 25px 30px; 
 | 
            background-color: #fff; 
 | 
            box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.19); 
 | 
            box-sizing: border-box; 
 | 
            border-radius: 4px; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form > h2 { 
 | 
            color: #333; 
 | 
            font-size: 18px; 
 | 
            text-align: center; 
 | 
            margin-bottom: 25px; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form > .layui-form-item { 
 | 
            margin-bottom: 25px; 
 | 
            position: relative; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form > .layui-form-item:last-child { 
 | 
            margin-bottom: 0; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form > .layui-form-item > .layui-input { 
 | 
            height: 46px; 
 | 
            line-height: 46px; 
 | 
            border-radius: 2px !important; 
 | 
        } 
 | 
  
 | 
        .login-wrapper .layui-input-icon-group > .layui-input { 
 | 
            padding-left: 46px; 
 | 
        } 
 | 
  
 | 
        .login-wrapper .layui-input-icon-group > .layui-icon { 
 | 
            width: 46px; 
 | 
            height: 46px; 
 | 
            line-height: 46px; 
 | 
            font-size: 20px; 
 | 
            color: #909399; 
 | 
            position: absolute; 
 | 
            left: 0; 
 | 
            top: 0; 
 | 
            text-align: center; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form > .layui-form-item.login-captcha-group { 
 | 
            padding-right: 135px; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form > .layui-form-item.login-captcha-group > .login-captcha { 
 | 
            height: 46px; 
 | 
            width: 120px; 
 | 
            cursor: pointer; 
 | 
            box-sizing: border-box; 
 | 
            border: 1px solid #e6e6e6; 
 | 
            border-radius: 2px !important; 
 | 
            position: absolute; 
 | 
            right: 0; 
 | 
            top: 0; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form > .layui-form-item > .layui-form-checkbox { 
 | 
            margin: 0 !important; 
 | 
            padding-left: 25px; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form > .layui-form-item > .layui-form-checkbox > .layui-icon { 
 | 
            width: 15px !important; 
 | 
            height: 15px !important; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form .layui-btn-fluid { 
 | 
            height: 48px; 
 | 
            line-height: 48px; 
 | 
            font-size: 16px; 
 | 
            border-radius: 2px !important; 
 | 
        } 
 | 
  
 | 
        .login-wrapper > .layui-form > .layui-form-item.login-oauth-group > a > .layui-icon { 
 | 
            font-size: 26px; 
 | 
        } 
 | 
  
 | 
        .login-copyright { 
 | 
            color: #eee; 
 | 
            padding-bottom: 20px; 
 | 
            text-align: center; 
 | 
            position: relative; 
 | 
            z-index: 1; 
 | 
        } 
 | 
  
 | 
        @media screen and (min-height: 550px) { 
 | 
            .login-wrapper { 
 | 
                margin: -250px auto 0; 
 | 
                position: absolute; 
 | 
                top: 50%; 
 | 
                left: 0; 
 | 
                right: 0; 
 | 
                width: 100%; 
 | 
            } 
 | 
  
 | 
            .login-copyright { 
 | 
                position: absolute; 
 | 
                bottom: 0; 
 | 
                right: 0; 
 | 
                left: 0; 
 | 
            } 
 | 
        } 
 | 
  
 | 
        .layui-btn { 
 | 
            /*background-color: #5FB878;*/ 
 | 
            /*border-color: #5FB878;*/ 
 | 
        } 
 | 
        .layui-form-checked[lay-skin=primary] i { 
 | 
            border-color: #009688!important; 
 | 
            background-color: #009688; 
 | 
            color: #fff; 
 | 
        } 
 | 
        .layui-link { 
 | 
            /*color: #5FB878 !important;*/ 
 | 
        } 
 | 
    </style> 
 | 
</head> 
 | 
<body> 
 | 
<div class="login-wrapper layui-anim layui-anim-scale layui-hide"> 
 | 
    <form class="layui-form"> 
 | 
        <h2>用户登录</h2> 
 | 
        <div class="layui-form-item layui-input-icon-group"> 
 | 
            <i class="layui-icon layui-icon-username"></i> 
 | 
            <input class="layui-input" id="username" name="username" placeholder="请输入登录账号" autocomplete="off" 
 | 
                   lay-verType="tips" lay-verify="required" required/> 
 | 
        </div> 
 | 
        <div class="layui-form-item layui-input-icon-group"> 
 | 
            <i class="layui-icon layui-icon-password"></i> 
 | 
            <input class="layui-input" id="password" name="password" placeholder="请输入登录密码" type="password" 
 | 
                   lay-verType="tips" lay-verify="required" required/> 
 | 
        </div> 
 | 
        <div id="code-box" class="layui-form-item layui-input-icon-group login-captcha-group"> 
 | 
            <i class="layui-icon layui-icon-auz"></i> 
 | 
            <input id="code" class="layui-input" type="text" name="password" lay-verify="code" placeholder="验证码"> 
 | 
            <img class="login-captcha" id="codeImg" title="看不清?点击换一张。"> 
 | 
        </div> 
 | 
        <div class="layui-form-item"> 
 | 
            <input type="checkbox" name="remember" title="记住密码" lay-skin="primary" checked> 
 | 
        </div> 
 | 
        <div class="layui-form-item"> 
 | 
            <button class="layui-btn layui-btn-fluid" lay-filter="login" lay-submit>登录</button> 
 | 
        </div> 
 | 
    </form> 
 | 
</div> 
 | 
<div class="login-copyright">copyright © 2020 上海宏挺紧固件制造有限公司 all rights reserved.</div> 
 | 
  
 | 
</body> 
 | 
<script type="text/javascript" src="../static/layui/layui.js"></script> 
 | 
<script type="text/javascript" src="../static/js/common.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"> 
 | 
  
 | 
    $(function () { 
 | 
        var oldUserName = localStorage.getItem('oldUserName'); 
 | 
        var oldPass = localStorage.getItem('oldPass'); 
 | 
        if(oldUserName){ 
 | 
            $('#username').val(oldUserName); 
 | 
        } 
 | 
        if(oldPass){ 
 | 
            $('#password').val(oldPass); 
 | 
        } 
 | 
    }) 
 | 
  
 | 
    // 验证码开关 
 | 
    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", baseUrl+"/code.action?sd="+random); 
 | 
        setTimeout(function () { 
 | 
            $.ajax({ 
 | 
                url: baseUrl+"/code.do", 
 | 
                data: {sd: random}, 
 | 
                method: 'POST', 
 | 
                async: false, 
 | 
                success: function (code) { 
 | 
                    sessionStorage.setItem("code", code); 
 | 
                } 
 | 
            }); 
 | 
        }, 100); 
 | 
    } 
 | 
  
 | 
    layui.config({ 
 | 
        base: baseUrl + "/static/layui/lay/modules/" 
 | 
    }).extend({ 
 | 
        notice: 'notice/notice', 
 | 
    }).use(['form','layer', 'notice'],function () { 
 | 
        var $ = layui.jquery; 
 | 
        var layer = layui.layer; 
 | 
        var form = layui.form; 
 | 
        var notice = layui.notice; 
 | 
        $('.login-wrapper').removeClass('layui-hide'); 
 | 
  
 | 
        form.on('submit(login)', function (data) { 
 | 
            var username = $("#username").val(); 
 | 
            if (username === "") { 
 | 
                layer.msg("请输入账号", {offset: '150px'}); 
 | 
                return false; 
 | 
            } 
 | 
            var password = $("#password").val(); 
 | 
            // if (password === "") { 
 | 
            //     layer.msg("请输入密码", {offset: '150px'}); 
 | 
            //     return; 
 | 
            // } 
 | 
            var code = $("#code").val(); 
 | 
            if (code === "" && codeSwitch === 'Y') { 
 | 
                notice.msg('请输入验证码', {icon: 2}); 
 | 
                return false; 
 | 
            } 
 | 
            if (sessionStorage.getItem("code").toUpperCase() !== code.toUpperCase()&&codeSwitch==='Y'){ 
 | 
                notice.msg('验证码错误', {icon: 2}); 
 | 
                return false; 
 | 
            } 
 | 
  
 | 
            var user = { 
 | 
                username: username, 
 | 
                password: hex_md5(password) 
 | 
            }; 
 | 
            $.ajax({ 
 | 
                url: baseUrl+"/login.action", 
 | 
                data: user, 
 | 
                method: 'POST', 
 | 
                success: function (res) { 
 | 
                    if (res.code === 200){ 
 | 
                        // 记住密码 
 | 
                        if($('#rememberPwd').is(':checked')){ 
 | 
                            localStorage.setItem('oldUserName',user.username); 
 | 
                            localStorage.setItem('oldPass',password); 
 | 
                        } else { 
 | 
                            localStorage.removeItem('oldUserName'); 
 | 
                            localStorage.removeItem('oldPass'); 
 | 
                        } 
 | 
                        localStorage.setItem("token", res.data.token); 
 | 
                        localStorage.setItem("nickname", res.data.nickname); 
 | 
                        window.location.href = "index.html"; 
 | 
                    } else { 
 | 
                        notice.msg(res.msg, {icon: 2}); 
 | 
                    } 
 | 
                } 
 | 
            }); 
 | 
            return false; 
 | 
        }); 
 | 
  
 | 
        $('body').keydown(function () { 
 | 
            if (event.keyCode === 13) { 
 | 
                $("#login-button").click(); 
 | 
            } 
 | 
        }); 
 | 
  
 | 
    }); 
 | 
</script> 
 | 
</html> 
 |