126 lines
4.4 KiB
HTML
Executable File
126 lines
4.4 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>服务器测试页面</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
padding: 40px;
|
|
text-align: center;
|
|
}
|
|
.success { color: green; }
|
|
.error { color: red; }
|
|
.test-btn {
|
|
padding: 10px 20px;
|
|
margin: 10px;
|
|
background: #409eff;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>🔄 服务器状态测试</h1>
|
|
|
|
<div id="status">
|
|
<p>测试服务器是否正常工作...</p>
|
|
</div>
|
|
|
|
<div style="margin: 30px;">
|
|
<button class="test-btn" onclick="testServer()">测试服务器</button>
|
|
<button class="test-btn" onclick="testVuePages()">测试Vue页面</button>
|
|
<button class="test-btn" onclick="checkConsole()">检查控制台</button>
|
|
</div>
|
|
|
|
<div id="results" style="margin-top: 30px; text-align: left; max-width: 600px; margin-left: auto; margin-right: auto;">
|
|
<!-- 测试结果将显示在这里 -->
|
|
</div>
|
|
|
|
<div style="margin-top: 50px; color: #666;">
|
|
<h3>问题诊断指南:</h3>
|
|
<ol style="text-align: left; max-width: 600px; margin: 20px auto;">
|
|
<li>如果此页面能正常显示 → 服务器正常</li>
|
|
<li>如果Vue页面空白但此页面正常 → Vue编译问题</li>
|
|
<li>如果所有页面都空白 → 服务器或网络问题</li>
|
|
<li>按F12打开控制台查看具体错误</li>
|
|
</ol>
|
|
</div>
|
|
|
|
<script>
|
|
function log(message, type = 'info') {
|
|
const results = document.getElementById('results')
|
|
const div = document.createElement('div')
|
|
div.innerHTML = `<strong>${type === 'error' ? '❌' : '✅'} ${new Date().toLocaleTimeString()}:</strong> ${message}`
|
|
div.style.color = type === 'error' ? 'red' : 'green'
|
|
div.style.margin = '5px 0'
|
|
results.appendChild(div)
|
|
}
|
|
|
|
function testServer() {
|
|
log('开始测试服务器...')
|
|
|
|
// 测试当前页面
|
|
log('当前页面加载正常')
|
|
|
|
// 测试是否能访问其他资源
|
|
fetch('/')
|
|
.then(response => {
|
|
if (response.ok) {
|
|
log('服务器根目录可访问')
|
|
} else {
|
|
log(`服务器响应状态: ${response.status}`, 'error')
|
|
}
|
|
})
|
|
.catch(error => {
|
|
log(`服务器访问失败: ${error.message}`, 'error')
|
|
})
|
|
}
|
|
|
|
function testVuePages() {
|
|
log('测试Vue页面...')
|
|
|
|
const vuePages = [
|
|
'/print/test-minimal',
|
|
'/print/batch-simple-fixed',
|
|
'/print/batch-fixed'
|
|
]
|
|
|
|
vuePages.forEach(page => {
|
|
fetch(page)
|
|
.then(response => {
|
|
if (response.ok) {
|
|
log(`Vue页面 ${page} 可访问`)
|
|
} else {
|
|
log(`Vue页面 ${page} 访问失败: ${response.status}`, 'error')
|
|
}
|
|
})
|
|
.catch(error => {
|
|
log(`Vue页面 ${page} 访问错误: ${error.message}`, 'error')
|
|
})
|
|
})
|
|
}
|
|
|
|
function checkConsole() {
|
|
log('请按F12打开浏览器控制台')
|
|
log('检查是否有以下错误:')
|
|
log('1. Vue编译错误')
|
|
log('2. JavaScript语法错误')
|
|
log('3. 网络请求失败')
|
|
log('4. 资源加载失败')
|
|
|
|
// 尝试触发一个控制台消息
|
|
console.log('✅ 测试控制台输出 - 如果你能看到这条消息,控制台工作正常')
|
|
console.error('❌ 测试错误输出 - 这是预期的测试错误')
|
|
}
|
|
|
|
// 页面加载时自动测试
|
|
window.addEventListener('load', function() {
|
|
log('页面加载完成,服务器基本正常')
|
|
document.getElementById('status').innerHTML = '<p class="success">✅ 服务器基本工作正常</p>'
|
|
})
|
|
</script>
|
|
</body>
|
|
</html> |