Files
telegram-management-system/test-frontend-real.html
你的用户名 237c7802e5
Some checks failed
Deploy / deploy (push) Has been cancelled
Initial commit: Telegram Management System
Full-stack web application for Telegram management
- Frontend: Vue 3 + Vben Admin
- Backend: NestJS
- Features: User management, group broadcast, statistics

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 15:37:50 +08:00

118 lines
4.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<title>前端功能测试</title>
<meta charset="utf-8">
<style>
body { font-family: Arial, sans-serif; padding: 20px; }
.test-item { margin: 20px 0; padding: 15px; border: 1px solid #ddd; border-radius: 5px; }
.success { background: #d4edda; border-color: #c3e6cb; }
.error { background: #f8d7da; border-color: #f5c6cb; }
.info { background: #d1ecf1; border-color: #bee5eb; }
button { padding: 10px 20px; margin: 5px; cursor: pointer; }
iframe { width: 100%; height: 600px; border: 1px solid #ddd; margin-top: 20px; }
</style>
</head>
<body>
<h1>Telegram 管理系统测试面板</h1>
<div class="test-item">
<h2>🔍 服务状态检查</h2>
<button onclick="checkServices()">检查所有服务</button>
<div id="service-status"></div>
</div>
<div class="test-item">
<h2>🚀 快速访问链接</h2>
<button onclick="window.open('http://localhost:8890', '_blank')">打开首页</button>
<button onclick="window.open('http://localhost:8890/#/login', '_blank')">登录页面</button>
<button onclick="window.open('http://localhost:8890/#/tgAccountManage/telegramQuickAccess', '_blank')">Telegram快速访问</button>
<button onclick="window.open('http://localhost:8890/#/tgAccountManage/telegramGuide', '_blank')">使用指南</button>
</div>
<div class="test-item">
<h2>📊 API测试</h2>
<button onclick="testAPI('/api/auth/login', 'POST', {username: 'test', password: 'test'})">测试登录API</button>
<button onclick="testAPI('/api/tgAccount/getAccountList', 'POST', {pageNum: 1, pageSize: 10})">测试账号列表API</button>
<div id="api-result"></div>
</div>
<div class="test-item">
<h2>🖼️ 页面预览</h2>
<select id="pageSelect" onchange="loadPage(this.value)">
<option value="">选择页面预览</option>
<option value="http://localhost:8890">首页</option>
<option value="http://localhost:8890/#/login">登录页</option>
<option value="http://localhost:8890/#/tgAccountManage/telegramQuickAccess">Telegram快速访问</option>
</select>
<iframe id="preview" style="display:none;"></iframe>
</div>
<script>
function checkServices() {
const statusDiv = document.getElementById('service-status');
statusDiv.innerHTML = '<p>检查中...</p>';
// 检查前端
fetch('http://localhost:8890/')
.then(response => {
let html = '<h3>服务状态:</h3>';
if (response.ok) {
html += '<p class="success">✅ 前端服务 (8890端口) - 正常运行</p>';
} else {
html += '<p class="error">❌ 前端服务 (8890端口) - 响应异常</p>';
}
statusDiv.innerHTML = html;
// 检查后端
return fetch('http://localhost:3000/');
})
.then(response => {
if (response.status === 401 || response.status === 404) {
statusDiv.innerHTML += '<p class="success">✅ 后端服务 (3000端口) - 正常运行</p>';
} else {
statusDiv.innerHTML += '<p class="error">❌ 后端服务 (3000端口) - 未响应</p>';
}
})
.catch(error => {
statusDiv.innerHTML += '<p class="error">❌ 后端服务 (3000端口) - 连接失败</p>';
});
}
function testAPI(url, method, data) {
const resultDiv = document.getElementById('api-result');
resultDiv.innerHTML = '<p>测试中...</p>';
fetch('http://localhost:8890' + url, {
method: method,
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => {
resultDiv.innerHTML = '<h4>API响应</h4><pre>' + JSON.stringify(data, null, 2) + '</pre>';
})
.catch(error => {
resultDiv.innerHTML = '<p class="error">API调用失败: ' + error + '</p>';
});
}
function loadPage(url) {
const iframe = document.getElementById('preview');
if (url) {
iframe.src = url;
iframe.style.display = 'block';
} else {
iframe.style.display = 'none';
}
}
// 页面加载时自动检查服务
window.onload = function() {
checkServices();
};
</script>
</body>
</html>