mrzhssss
2021-12-07 591c676bdd4a3f016fe060e69ff3c1711043bdd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
    <title>系统登录</title>
    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
    <link rel="icon" type="image/x-icon" href="../../static/image/logo1.png" />
    <script type="text/javascript" src="../../static/layui/layui.js"></script>
    <script type="text/javascript" src="../../static/js/common.js"></script>
    <style>
        html{
            height: 100%;
            overflow: hidden;
        }
        body.login-bg {
            color: #777;
            height: 100%;
            background-image: linear-gradient(to right, #ff9569 0%, #e92758 100%);
            /*background-image: linear-gradient(-90deg, #29bdd9 0%, #276ace 100%);*/
            /*background: -webkit-linear-gradient(red, blue); !* Safari 5.1 - 6.0 *!;*/
            /*background-image: url("../static/image/login_bg.jpg");*/
            /*background-repeat: no-repeat;*/
            /*background-size: cover;*/
            /*background-position: top center;*/
        }
 
        #login-wrapper {
            box-sizing:border-box;
            background: #fff;
            height: 100%;
            padding: 100px 60px;
            text-align: center;
            overflow: hidden;
        }
        #login-wrapper h1 {
            font-weight: bolder;
            margin-bottom: 20px;
            letter-spacing: 5px;
            /*transform:scale(3);*/
            /*-webkit-transform:scale(3);*/
            /*-moz-transform:scale(3);*/
        }
        .layui-form-item {
            margin-bottom: 15px;
            position: relative;
        }
        .layui-form-item .layui-input {
            height: 40px;
            padding-left: 20px;
            font-size: 16px;
            border: 1px solid #767676;
            color: inherit;
            border-radius: 3px;
            transition: 0.3s;
        }
        .layui-input:hover, .layui-textarea:hover {
            border-color: #0767aa !important;
            border-width: 1.5px;
        }
        .login-submit {
            margin-top: 20px;
        }
        #login-button {
            background-color: #0767aa;
            width: 50%;
            font-size: 14px;
            font-weight: bolder;
            border-radius: 5px;
            height: 40px;
        }
    </style>
</head>
<body class="login-bg">
 
<div id="login-wrapper">
    <header>
        <h1>系统登录</h1>
    </header>
    <div class="layui-form layadmin-user-login-body">
        <div class="layui-form-item">
            <input id="mobile" class="layui-input" type="text" name="mobile" lay-verify="mobile" placeholder="账号" autocomplete="off">
        </div>
        <div class="layui-form-item">
            <input id="password" class="layui-input" type="password" name="password" lay-verify="password" placeholder="密码" autocomplete="off">
        </div>
<!--        <div class="layui-form-item" style="text-align: right;padding-left: 3px;">-->
<!--            <input id="rememberPwd" style="vertical-align: middle" type="checkbox" lay-skin='primary' lay-filter="remPwd" title="记住密码" checked="checked">-->
<!--        </div>-->
    </div>
    <div class="layui-form-item login-submit">
        <button id="login-button" class="layui-btn layui-btn-fluid layui-btn-normal" lay-submit="" lay-filter="login">登 录</button>
    </div>
</div>
 
</body>
<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">
 
    layui.use(['form','layer'],function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.jquery;
 
        form.on('submit(login)', function (data) {
            var mobile = $("#mobile").val();
            if (mobile === "") {
                layer.msg("请输入账号", {icon: 2})
                $("#mobile").focus();
                return;
            }
            var password = $("#password").val();
            if (password === "") {
                layer.msg("请输入密码", {icon: 2})
                $("#password").focus();
                return;
            }
 
            var user = {
                username: mobile,
                password: hex_md5(password)
            };
            $.ajax({
                url: baseUrl+"/login.action",
                data: user,
                method: 'POST',
                success: function (res) {
                    if (res.code === 200){
                        layer.msg("登录成功", {icon: 1})
                        localStorage.setItem("token", res.data.token);
                        localStorage.setItem("username", res.data.username);
                        window.location.href = "index.html";
                    } else {
                        layer.msg(res.msg, {icon: 2})
                    }
                }
            });
            return false;
        });
 
        $('body').keydown(function () {
            if (event.keyCode === 13) {
                $("#login-button").click();
            } else if (event.keyCode === 115) {
                $("#login-button").click();
            }
        });
 
    });
</script>
</html>