文件
mashangyoujiu/_ai_archive/scripts/login_test.html

102 行
3.0 KiB
HTML
可执行文件

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>登录测试</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f5f5f5;
}
.container {
max-width: 400px;
margin: 0 auto;
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 {
text-align: center;
color: #333;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"],
input[type="password"] {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 3px;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 15px;
border-radius: 3px;
cursor: pointer;
width: 100%;
}
button:hover {
background-color: #45a049;
}
#result {
margin-top: 20px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 3px;
background-color: #f9f9f9;
display: none;
}
</style>
</head>
<body>
<div class="container">
<h1>登录测试</h1>
<div class="form-group">
<label for="username">用户名:</label>
<input type="text" id="username" value="13888888888">
</div>
<div class="form-group">
<label for="password">密码:</label>
<input type="password" id="password" value="7887336">
</div>
<button onclick="login()">登录</button>
<div id="result"></div>
</div>
<script>
function login() {
var username = document.getElementById('username').value;
var password = document.getElementById('password').value;
var resultDiv = document.getElementById('result');
resultDiv.style.display = 'block';
resultDiv.innerHTML = '正在登录...';
var xhr = new XMLHttpRequest();
xhr.open('POST', '/index.php/Retail/Login/doLogin_v1', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
resultDiv.innerHTML = '状态码: ' + xhr.status + '<br>';
resultDiv.innerHTML += '响应: ' + xhr.responseText;
}
};
xhr.send('username=' + encodeURIComponent(username) + '&password=' + encodeURIComponent(password));
}
</script>
</body>
</html>