Administrator
2018-11-05 2d950dce7919a2bc39464f9d264f7b96b69f6d1e
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
<!DOCTYPE html>
<html lang="zh-cn">
 
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>布心街后台管理系统</title>
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/main.css" rel="stylesheet">
        <!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
    </head>
 
    <body background="image/airlift-bg.png">
        <h1>后台管理系统</h1>
        <div class="shurukuang">
            <h2>管理员登录</h2>
            <div class="auth-form-body mt-3">
                <form role="form" class="form-horizontal">
                    <label for="login_field">用户名</label>
                    <input autocapitalize="off" autocorrect="off" autofocus class="form-control input-block input-lg" id="account" name="account" tabindex="1" type="text" /></br>
                    <label for="password">密码</label>
                    <input class="form-control form-control input-block input-lg" id="password" name="password" tabindex="2" type="password" />
 
                    <div class="form-group">
                        <div class="col-xs-12">
                            <div class="col-xs-7" style="padding-left: 0;">
                                <input class="form-control input-lg" type="text" name="verifycode" id="verifycode" placeholder="请输入验证码">
                            </div>
                            <div class="col-xs-5" style="padding-right: 0;">
                                <img class="codeimg" style="width: 100px;height: 48px;border-radius: 5px;" src="#" />
                            </div>
                        </div>
                    </div>
 
                </form>
                <input class="btn btn-primary btn-block btn-lg submit" data-disable-with="Signing in…" name="commit" tabindex="3" type="button" value="登&nbsp;&nbsp;&nbsp;&nbsp;录" />
            </div>
 
        </div>
        <script src="./js/jquery.min.js"></script>
        <script src="./js/bootstrap.min.js"></script>
        <script src="./layer/layer.js"></script>
        <script>
            $(function() {
                $(".codeimg").attr("src",getSrc());
                $(".codeimg").click(function() {
                    $(".codeimg").attr("src", getSrc());
                });
                
                
                $("body").keydown(function(){
                    if(event.keyCode==13){
                        login();
                    }
                })
                
                $(".submit").click(function(e) {
                    login();
                });
            });
        </script>
<script>
    
    function login(){
        if($("#account").val().length < 1) {
            layer.msg("请输入正确的账号");
            return false;
        }
 
        if($("#password").val().length < 1) {
            layer.msg("请输入正确的密码");
            return false;
        }
 
        if($("#verifycode").val().length < 4) {
            layer.msg("请输入正确的验证码");
            return false;
        }
 
        $.post('api/login/adminLogin', {
            'username': $("#account").val(),
            'pwd': $("#password").val(),
            'code': $("#verifycode").val()
        }, function(data) {
            if(data.code == 0) { //登录成功
                window.location.href = "shuju.html";
            } else {
                layer.msg(data.msg);
            }
        }, "json");
        return true;
                
    }
    
    function getSrc(){
        return "api/validate/imgcode?temp="+new Date().getTime();
    }
    
    $(function(){
        $.ajax({
            url : '../../client/html/api/v1/config/getSystemName',
            type : 'GET',
            dataType : 'json',
            // timeout : 3000, // 设定超时
            cache : false, // 禁用缓存
            error : function(request, textStatus, errorThrown) {
            },
            success : function(data) {
                $("body h1").eq(0).html(data.data);
                $("title").html(data.data);
            }
        });
    });
    
</script>
    </body>
 
</html>