Files
task-board/public/test.html
T

89 lines
2.3 KiB
HTML
Raw Normal View History

<!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>
body {
font-family: Arial, sans-serif;
padding: 20px;
background: #f5f5f5;
}
.test-box {
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
max-width: 600px;
margin: 50px auto;
text-align: center;
}
h1 {
color: #667eea;
}
.status {
margin: 20px 0;
padding: 15px;
background: #e7f5e7;
border-radius: 5px;
color: #2d6a2d;
}
button {
padding: 12px 24px;
background: #667eea;
color: white;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
margin: 5px;
}
button:active {
background: #5568d3;
}
</style>
</head>
<body>
<div class="test-box">
<h1>✅ 服务器正常运行</h1>
<div class="status">
<strong>状态:</strong> 连接成功<br>
<strong>时间:</strong> <span id="time"></span><br>
<strong>User-Agent:</strong> <span id="ua"></span>
</div>
<button onclick="testAPI()">测试 API</button>
<button onclick="location.href='/'">返回主页</button>
<div id="result" style="margin-top: 20px;"></div>
</div>
<script>
document.getElementById('time').textContent = new Date().toLocaleString('zh-CN');
document.getElementById('ua').textContent = navigator.userAgent;
async function testAPI() {
const result = document.getElementById('result');
result.innerHTML = '正在测试...';
try {
const response = await fetch('/api/stats');
const data = await response.json();
result.innerHTML = `
<div style="background: #e7f5e7; padding: 15px; border-radius: 5px; margin-top: 10px;">
✅ API 正常<br>
项目数: ${data.projects || 0}<br>
任务数: ${data.tasks || 0}
</div>
`;
} catch (error) {
result.innerHTML = `
<div style="background: #ffe7e7; padding: 15px; border-radius: 5px; margin-top: 10px; color: #d32f2f;">
❌ API 错误: ${error.message}
</div>
`;
}
}
</script>
</body>
</html>