<!DOCTYPE html>
|
<html lang="zh-CN">
|
<head>
|
<meta charset="UTF-8">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<title>登录 - 机器人日志系统</title>
|
<style>
|
* {
|
margin: 0;
|
padding: 0;
|
box-sizing: border-box;
|
}
|
body {
|
font-family: Arial, sans-serif;
|
background-color: #f0f2f5;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
height: 100vh;
|
}
|
.login-container {
|
background-color: white;
|
padding: 40px;
|
border-radius: 8px;
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
width: 100%;
|
max-width: 400px;
|
}
|
h2 {
|
text-align: center;
|
margin-bottom: 30px;
|
color: #333;
|
}
|
.form-group {
|
margin-bottom: 20px;
|
}
|
label {
|
display: block;
|
margin-bottom: 8px;
|
color: #666;
|
}
|
input {
|
width: 100%;
|
padding: 10px;
|
border: 1px solid #ddd;
|
border-radius: 4px;
|
font-size: 16px;
|
}
|
button {
|
width: 100%;
|
padding: 12px;
|
background-color: #1890ff;
|
color: white;
|
border: none;
|
border-radius: 4px;
|
font-size: 16px;
|
cursor: pointer;
|
margin-top: 10px;
|
}
|
button:hover {
|
background-color: #40a9ff;
|
}
|
.error-message {
|
color: red;
|
margin-top: 10px;
|
text-align: center;
|
}
|
</style>
|
</head>
|
<body>
|
<div class="login-container">
|
<h2>机器人日志系统</h2>
|
<form id="loginForm">
|
<div class="form-group">
|
<label for="username">用户名</label>
|
<input type="text" id="username" name="username" required>
|
</div>
|
<div class="form-group">
|
<label for="password">密码</label>
|
<input type="password" id="password" name="password" required>
|
</div>
|
<button type="submit">登录</button>
|
<div id="errorMessage" class="error-message"></div>
|
</form>
|
</div>
|
<script>
|
document.getElementById('loginForm').addEventListener('submit', function(e) {
|
e.preventDefault();
|
const username = document.getElementById('username').value;
|
const password = document.getElementById('password').value;
|
|
// 简单的登录验证(实际项目中应该调用后端API)
|
if (username === 'admin' && password === 'admin123') {
|
// 存储登录状态
|
localStorage.setItem('loggedIn', 'true');
|
// 跳转到主页面
|
window.location.href = '/';
|
} else {
|
document.getElementById('errorMessage').textContent = '用户名或密码错误';
|
}
|
});
|
</script>
|
</body>
|
</html>
|