login.html 4.5 KB
Newer Older
H
hjdhnx 已提交
1
<html lang="en">
H
hjdhnx 已提交
2

H
hjdhnx 已提交
3 4 5 6
<head>
  <meta charset="utf-8">
  <title>管理员登录</title>
  <meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
H
hjdhnx 已提交
7 8 9
  <meta name="author" content="道长">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
H
hjdhnx 已提交
10
  <link rel="stylesheet" media="screen" href="/static/css/login.css">
H
hjdhnx 已提交
11 12 13 14 15
  <!-- 引入layui css -->
  <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui-v2.5.6/css/layui.css" />
  <!-- 引入layui js -->
  <script src="https://www.layuicdn.com/layui-v2.5.6/layui.js"></script>

H
hjdhnx 已提交
16 17
  <link rel="icon" href="/static/img/logo.png" type="image/x-icon">
</head>
H
hjdhnx 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

<body style>
  <!-- particles.js container -->
  <div id="particles-js" style="display: flex;align-items: center;justify-content: center">

    <canvas class="particles-js-canvas-el" width="1920" height="2792" style="width: 100%; height: 100%;"></canvas>
  </div>
  <div class="login-page">
    <div class="login-content">
      <img src="https://s1.ax1x.com/2023/03/08/ppmmiNj.jpg" alt="DRPY">
      <div class="login-tit"><span>DRPY</span>用户登录</div>
      <div class="login-input">
        <div class="layui-form-item">
          <label class="layui-icon layui-icon-username"></label>
          <input type="text" id="username" placeholder="账号">
        </div>
          <div class="layui-form-item1">
          <label class="layui-icon layui-icon-password"></label>
          <input type="password" id="password" placeholder="密码">
        </div>
H
hjdhnx 已提交
38
      </div>
H
hjdhnx 已提交
39 40 41 42 43 44 45 46 47 48 49 50
        <div class="login-btn">
          <div class="login-btn-left" onclick="login()">
            <span>登录</span>
          </div>

          <div class="login-btn-right" onclick="changeImg('autologin')">
            <input type="checkbox" name="zd" id="picture_autologin">7天内自动登录
          </div>
          <div class="login-btn-right" onclick="changeImg('remember')">
            <input type="checkbox" name="mm" id="picture_remember">记住密码
          </div>
        </div>
H
hjdhnx 已提交
51 52 53 54
      </div>
    </div>


H
hjdhnx 已提交
55 56 57 58 59 60 61
    <!-- scripts -->
    <script src="/static/js/particles.js"></script>
    <script src="/static/js/app.js"></script>
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/grey.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/sweetalert/sweetalert.css">
    <script type="text/javascript" src="/static/sweetalert/sweetalert-dev.js"></script>
H
hjdhnx 已提交
62

H
hjdhnx 已提交
63 64 65 66 67 68 69 70 71 72
    <script>
      $('#picture_autologin').attr('src', "/static/img/checked.png");
      function changeImg(id) {
        let pic = $('#picture_' + id);
        if (pic.attr('src') === "/static/img/check.png") {
          pic.attr('src', "/static/img/checked.png")
        } else {
          pic.attr('src', "/static/img/check.png")
        }
      }
H
hjdhnx 已提交
73

H
hjdhnx 已提交
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
      function login() {
        var username = $('#username').val();
        var password = $('#password').val();
        var autologin = "no";
        let pic = $('#picture_autologin');
        if (pic.attr("src") === "/static/img/checked.png") {
          autologin = "yes";
        }
        console.log(username + "--" + password + '--' + autologin);
        if (username !== "" && password !== "") {
          var json = { "username": username, "password": password, "autologin": autologin, "login": "1" };
          // ajax_post("login.php",json,backmsg);
          console.log(json);
          $.post("/admin/login", json, function (result) {
            console.log(result);
            if (result.code === 200) {
              console.log('登录成功');
              swal({
                title: "登录提示",
                text: "登录成功!\n是否重载页面?",
                type: "success",
                showCancelButton: true,
                confirmButtonColor: '#DD6B55',
                confirmButtonText: '确定',
                cancelButtonText: "取消",
                closeOnConfirm: false
              },
                function (isConfirm) {
                  if (isConfirm) {
                    location.reload();
                  }
H
hjdhnx 已提交
105
                }
H
hjdhnx 已提交
106 107 108 109 110 111 112 113 114 115 116 117 118
              );
              // swal("登录提示","登录成功!\n正在进入个人中心","success");
              // location.href = '/admin'
            } else {
              swal("登录失败!\n用户名或密码错误,请重试!", "", "error");
            }
          });
        } else {
          alert('用户密码必填!');
        }
      }

    </script>
H
hjdhnx 已提交
119 120

</body>
H
hjdhnx 已提交
121

H
hjdhnx 已提交
122
</html>