更新于 07-06 02:09

This commit is contained in:
root
2021-07-06 02:09:19 -04:00
parent 6f2f237599
commit 8eb1fee0e7

View File

@ -3,16 +3,20 @@
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>控制面板</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<meta name="description" content="JSTOOL">
<meta name="keywords" content="JSTOOL">
<title>控制面板</title>
<link rel="icon" type="image/ico" href="https://pic.baixiongz.com/uploads/2021/01/15/c4337817da14a.ico">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/5.12.1/css/all.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/cjl0372/cjl0372.github.io@master/style.css">
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/sweetalert2.js"></script>
<link rel="icon" type="image/x-icon" href="https://gitee.com/favicon.ico" />
<style type="text/css">
body,
html {
@ -161,12 +165,12 @@
<div class="col-lg-8 card">
<h1 align="center">JS-TOOL面板</h1>
<div class="login-form">
<form action="auth" method="POST">
<form action="login" method="POST">
<input type="text" name="username" placeholder="用户名" required>
<br>
<input type="password" name="password" placeholder="密码" required>
<br>
<input class="btn btn-primary col-lg-4" type="submit" id="auth" value="登录">
<input class="btn btn-primary col-lg-4" type="submit" id="login" value="登录">
</form>
<a id="jumpapp" class="btn btn-secondary col-lg-4" href="/">返回主页</a>
</div>
@ -198,12 +202,12 @@
cache: false
});
$("#auth").click(function () {
$("#login").click(function () {
$user = $(".username").val();
$password = $(".password").val();
if (!$user || !$password) return;
$.post('./auth', {
$.post('./login', {
username: $user,
password: $password
}, function (data) {
@ -218,6 +222,23 @@
});
return false;
});
function ajax(options) {
var url = options.url;
var method = options.method;
var data = options.data;
var success = options.success;
var ajax = new XMLHttpRequest();
ajax.open(method, url);
if (method == 'post') {
ajax.setRequestHeader('Content-type', 'application/json');
}
ajax.send(JSON.stringify(data));
ajax.onreadystatechange = function () {
if (ajax.readyState == 4 && ajax.status == 200) {
success(JSON.parse(ajax.responseText));
}
};
</script>
</html>