141 lines
5.1 KiB
HTML
141 lines
5.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>ERP系统修复测试</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 20px;
|
|
line-height: 1.6;
|
|
}
|
|
.status {
|
|
padding: 10px;
|
|
margin: 10px 0;
|
|
border-radius: 5px;
|
|
}
|
|
.success {
|
|
background-color: #d4edda;
|
|
color: #155724;
|
|
border: 1px solid #c3e6cb;
|
|
}
|
|
.error {
|
|
background-color: #f8d7da;
|
|
color: #721c24;
|
|
border: 1px solid #f5c6cb;
|
|
}
|
|
.warning {
|
|
background-color: #fff3cd;
|
|
color: #856404;
|
|
border: 1px solid #ffeaa7;
|
|
}
|
|
.info {
|
|
background-color: #d1ecf1;
|
|
color: #0c5460;
|
|
border: 1px solid #bee5eb;
|
|
}
|
|
button {
|
|
padding: 10px 20px;
|
|
margin: 5px;
|
|
background-color: #007bff;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
}
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
#result {
|
|
margin-top: 20px;
|
|
padding: 15px;
|
|
background-color: #f8f9fa;
|
|
border-radius: 5px;
|
|
white-space: pre-wrap;
|
|
font-family: monospace;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>ERP系统修复测试</h1>
|
|
|
|
<div class="status info">
|
|
<strong>测试说明:</strong> 验证Mock API修复是否解决404错误
|
|
</div>
|
|
|
|
<h2>1. 测试服务器状态</h2>
|
|
<button onclick="testServer()">测试服务器连接</button>
|
|
|
|
<h2>2. 测试API端点</h2>
|
|
<button onclick="testAPI('/api/goods/list')">测试商品列表API</button>
|
|
<button onclick="testAPI('/api/goods/select')">测试商品选择API</button>
|
|
<button onclick="testAPI('/api/goods/pushLogs')">测试推送日志API</button>
|
|
<button onclick="testAPI('/api/orders/list')">测试订单列表API</button>
|
|
<button onclick="testAPI('/api/express/list')">测试快递公司API</button>
|
|
|
|
<h2>3. 测试Vue页面</h2>
|
|
<button onclick="window.open('/print/batch-fixed', '_blank')">打开终极修复版</button>
|
|
<button onclick="window.open('/print/batch-simple-fixed', '_blank')">打开简化修复版</button>
|
|
<button onclick="window.open('/print/test-minimal', '_blank')">打开最小测试版</button>
|
|
|
|
<h2>4. 测试结果</h2>
|
|
<div id="result">点击按钮开始测试...</div>
|
|
|
|
<script>
|
|
async function testServer() {
|
|
const result = document.getElementById('result');
|
|
result.innerHTML = '正在测试服务器连接...';
|
|
|
|
try {
|
|
const response = await fetch('/');
|
|
if (response.ok) {
|
|
result.innerHTML = '✅ 服务器连接正常\n';
|
|
result.innerHTML += `状态码: ${response.status}\n`;
|
|
result.innerHTML += `内容类型: ${response.headers.get('content-type')}`;
|
|
} else {
|
|
result.innerHTML = `❌ 服务器连接失败: ${response.status} ${response.statusText}`;
|
|
}
|
|
} catch (error) {
|
|
result.innerHTML = `❌ 服务器连接错误: ${error.message}`;
|
|
}
|
|
}
|
|
|
|
async function testAPI(endpoint) {
|
|
const result = document.getElementById('result');
|
|
result.innerHTML = `正在测试 API: ${endpoint}...`;
|
|
|
|
try {
|
|
const response = await fetch(endpoint);
|
|
const data = await response.json();
|
|
|
|
result.innerHTML = `📊 API测试结果: ${endpoint}\n`;
|
|
result.innerHTML += `状态码: ${response.status}\n`;
|
|
result.innerHTML += `响应码: ${data.code}\n`;
|
|
result.innerHTML += `消息: ${data.message || '无消息'}\n`;
|
|
|
|
if (data.code === 200) {
|
|
result.innerHTML += `✅ API调用成功\n`;
|
|
result.innerHTML += `数据量: ${data.data?.list?.length || data.data?.length || 0} 条\n`;
|
|
|
|
// 显示前3条数据
|
|
const sampleData = data.data?.list?.slice(0, 3) || data.data?.slice(0, 3);
|
|
if (sampleData && sampleData.length > 0) {
|
|
result.innerHTML += '\n示例数据:\n';
|
|
sampleData.forEach(item => {
|
|
result.innerHTML += ` • ${item.name || item.orderNo || item.id}\n`;
|
|
});
|
|
}
|
|
} else {
|
|
result.innerHTML += `❌ API调用失败: ${data.message}`;
|
|
}
|
|
} catch (error) {
|
|
result.innerHTML = `❌ API测试错误: ${error.message}`;
|
|
}
|
|
}
|
|
|
|
// 页面加载时自动测试服务器
|
|
window.onload = testServer;
|
|
</script>
|
|
</body>
|
|
</html> |