67 lines
2.2 KiB
HTML
67 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Debug Frontend</title>
|
|
</head>
|
|
<body>
|
|
<h1>前端调试页面</h1>
|
|
|
|
<button id="test-upload" onclick="testUpload()">测试上传API</button>
|
|
<button id="test-generate" onclick="testGenerate()">测试网格生成API</button>
|
|
<button id="test-status" onclick="testStatus()">测试状态API</button>
|
|
|
|
<div id="results" style="margin-top: 20px; padding: 10px; border: 1px solid #ccc;">
|
|
<h3>测试结果:</h3>
|
|
<pre id="output"></pre>
|
|
</div>
|
|
|
|
<script>
|
|
function log(message) {
|
|
const output = document.getElementById('output');
|
|
output.textContent += new Date().toLocaleTimeString() + ': ' + message + '\n';
|
|
}
|
|
|
|
async function testUpload() {
|
|
log('测试上传API (空请求)...');
|
|
try {
|
|
const response = await fetch('/api/upload', {
|
|
method: 'POST'
|
|
});
|
|
const result = await response.json();
|
|
log(`上传API响应: ${response.status} - ${JSON.stringify(result)}`);
|
|
} catch (error) {
|
|
log(`上传API错误: ${error.message}`);
|
|
}
|
|
}
|
|
|
|
async function testGenerate() {
|
|
log('测试网格生成API...');
|
|
try {
|
|
const response = await fetch('/api/mesh/generate', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
}
|
|
});
|
|
const result = await response.json();
|
|
log(`网格生成API响应: ${response.status} - ${JSON.stringify(result)}`);
|
|
} catch (error) {
|
|
log(`网格生成API错误: ${error.message}`);
|
|
}
|
|
}
|
|
|
|
async function testStatus() {
|
|
log('测试状态API...');
|
|
try {
|
|
const response = await fetch('/api/mesh/status');
|
|
const result = await response.json();
|
|
log(`状态API响应: ${response.status} - ${JSON.stringify(result)}`);
|
|
} catch (error) {
|
|
log(`状态API错误: ${error.message}`);
|
|
}
|
|
}
|
|
|
|
log('调试页面已加载');
|
|
</script>
|
|
</body>
|
|
</html> |