parent
b79f46c8d4
commit
601f9f96f7
9 changed files with 19749 additions and 1 deletions
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,60 @@ |
||||
{% load static %} |
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<title>用户登录</title> |
||||
<link rel="stylesheet" href="{% static 'dist/css/adminlte.min.css' %}"> |
||||
<script src="{% static '/plugins/jquery/jquery.min.js' %}"></script> |
||||
</head> |
||||
<body class="hold-transition register-page"> |
||||
<div class="register-box"> |
||||
<div class="register-logo"> |
||||
<b>用户登录</b> |
||||
</div> |
||||
<div class="card"> |
||||
<div class="card-body register-card-body"> |
||||
<form action="" method="post"> |
||||
{% csrf_token %} |
||||
<div class="input-group mb-3"> |
||||
<input type="text" class="form-control" id="username" name="username" placeholder="用户名"> |
||||
</div> |
||||
<div class="input-group mb-3"> |
||||
<input type="password" class="form-control" id="password" name="password" placeholder="密码"> |
||||
</div> |
||||
<div class="row"> |
||||
<div class="col-8"> |
||||
<label id="info"></label> |
||||
</div> |
||||
<div class="col-4"> |
||||
<input type="button" id="register" class="btn btn-success" value="登录"> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<script> |
||||
$("#register").click(function () { |
||||
console.log('ajax'); |
||||
$.ajax({ |
||||
url: "/user/ajax_login_data/", // 后端地址 |
||||
type: "POST", // 请求方式 |
||||
data: { |
||||
username: $("#username").val(), |
||||
password: $("#password").val(), |
||||
"csrfmiddlewaretoken": $("[name = 'csrfmiddlewaretoken']").val() |
||||
}, |
||||
// 请求成功后的处理 |
||||
success: function (data) { |
||||
$("#info").html(data.msg) |
||||
}, |
||||
// 请求失败后的处理 |
||||
error: function (jqXHR, textStatus, err) { |
||||
console.log(arguments); |
||||
}, |
||||
}) |
||||
}) |
||||
</script> |
||||
</body> |
||||
</html> |
Loading…
Reference in new issue