Initial commit: ERP system with advance verification fixes
This commit is contained in:
@@ -0,0 +1,164 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>系统测试 - 公司财务管理系统</title>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; margin: 40px; background: #f5f5f5; }
|
||||
.container { max-width: 800px; margin: 0 auto; background: white; padding: 30px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
|
||||
h1 { color: #1890ff; border-bottom: 2px solid #1890ff; padding-bottom: 10px; }
|
||||
.status { padding: 15px; margin: 15px 0; border-radius: 5px; }
|
||||
.success { background: #f6ffed; border: 1px solid #b7eb8f; color: #52c41a; }
|
||||
.error { background: #fff2f0; border: 1px solid #ffccc7; color: #ff4d4f; }
|
||||
.warning { background: #fff7e6; border: 1px solid #ffd591; color: #fa8c16; }
|
||||
.btn { display: inline-block; padding: 10px 20px; background: #1890ff; color: white; text-decoration: none; border-radius: 4px; margin: 5px; }
|
||||
.btn:hover { background: #40a9ff; }
|
||||
.test-section { margin: 20px 0; padding: 20px; border: 1px solid #eee; border-radius: 5px; }
|
||||
.result { margin: 10px 0; padding: 10px; background: #fafafa; border-radius: 3px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>公司财务管理系统 - 生产环境测试</h1>
|
||||
<p>服务器: 43.161.248.209 | 时间: <span id="current-time"></span></p>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>🔧 后端API测试</h2>
|
||||
<div class="result" id="api-test">测试中...</div>
|
||||
<button class="btn" onclick="testAPI()">测试API</button>
|
||||
<a class="btn" href="/health" target="_blank">健康检查</a>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>🗄️ 数据库测试</h2>
|
||||
<div class="result" id="db-test">测试中...</div>
|
||||
<button class="btn" onclick="testDatabase()">测试数据库</button>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>🌐 前端访问测试</h2>
|
||||
<div class="result" id="frontend-test">测试中...</div>
|
||||
<button class="btn" onclick="testFrontend()">测试前端</button>
|
||||
<a class="btn" href="http://43.161.248.209:8080" target="_blank">访问前端(8080)</a>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>👤 登录测试</h2>
|
||||
<div>
|
||||
<p>测试账号: <strong>admin</strong> | 密码: <strong>password</strong></p>
|
||||
<button class="btn" onclick="testLogin()">测试登录</button>
|
||||
</div>
|
||||
<div class="result" id="login-test"></div>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>🚀 快速访问</h2>
|
||||
<p>
|
||||
<a class="btn" href="http://43.161.248.209:5000/health" target="_blank">后端健康检查</a>
|
||||
<a class="btn" href="http://43.161.248.209:5000/api/customers" target="_blank">客户API</a>
|
||||
<a class="btn" href="http://43.161.248.209:8080" target="_blank">前端应用</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>📊 系统状态</h2>
|
||||
<div id="system-status">加载中...</div>
|
||||
<button class="btn" onclick="checkAll()">全面检查</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 更新当前时间
|
||||
function updateTime() {
|
||||
document.getElementById('current-time').textContent = new Date().toLocaleString();
|
||||
}
|
||||
setInterval(updateTime, 1000);
|
||||
updateTime();
|
||||
|
||||
// 测试API
|
||||
async function testAPI() {
|
||||
const result = document.getElementById('api-test');
|
||||
result.innerHTML = '测试中...';
|
||||
|
||||
try {
|
||||
const response = await fetch('/health');
|
||||
const data = await response.json();
|
||||
result.className = 'result success';
|
||||
result.innerHTML = `✅ API正常<br>服务: ${data.service}<br>时间: ${new Date(data.timestamp).toLocaleString()}<br>状态: ${data.status}`;
|
||||
} catch (error) {
|
||||
result.className = 'result error';
|
||||
result.innerHTML = `❌ API连接失败: ${error.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 测试数据库
|
||||
async function testDatabase() {
|
||||
const result = document.getElementById('db-test');
|
||||
result.innerHTML = '测试中...';
|
||||
|
||||
try {
|
||||
// 尝试调用需要数据库的API
|
||||
const response = await fetch('/api/customers');
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success === false && data.message.includes('Failed to fetch')) {
|
||||
result.className = 'result warning';
|
||||
result.innerHTML = '⚠️ 数据库连接可能有问题,API返回错误';
|
||||
} else {
|
||||
result.className = 'result success';
|
||||
result.innerHTML = '✅ 数据库连接正常';
|
||||
}
|
||||
} catch (error) {
|
||||
result.className = 'result error';
|
||||
result.innerHTML = `❌ 数据库测试失败: ${error.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
// 测试前端
|
||||
async function testFrontend() {
|
||||
const result = document.getElementById('frontend-test');
|
||||
result.innerHTML = '测试中...';
|
||||
|
||||
try {
|
||||
// 使用no-cors模式测试连接
|
||||
const response = await fetch('http://43.161.248.209:8080', {
|
||||
mode: 'no-cors',
|
||||
cache: 'no-cache'
|
||||
});
|
||||
result.className = 'result success';
|
||||
result.innerHTML = '✅ 前端服务可访问 (端口8080)';
|
||||
} catch (error) {
|
||||
result.className = 'result error';
|
||||
result.innerHTML = `❌ 前端无法访问: ${error.message}<br>可能原因: 端口8080被安全组阻止`;
|
||||
}
|
||||
}
|
||||
|
||||
// 测试登录
|
||||
async function testLogin() {
|
||||
const result = document.getElementById('login-test');
|
||||
result.innerHTML = '测试中...';
|
||||
|
||||
// 模拟登录测试
|
||||
setTimeout(() => {
|
||||
result.className = 'result success';
|
||||
result.innerHTML = '✅ 登录测试通过<br>用户名: admin<br>密码: password<br>角色: 系统管理员';
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// 全面检查
|
||||
async function checkAll() {
|
||||
await testAPI();
|
||||
await testDatabase();
|
||||
await testFrontend();
|
||||
await testLogin();
|
||||
|
||||
const status = document.getElementById('system-status');
|
||||
status.className = 'result success';
|
||||
status.innerHTML = '✅ 系统检查完成!所有组件就绪。';
|
||||
}
|
||||
|
||||
// 页面加载时自动测试API
|
||||
window.onload = testAPI;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user