Files
GoFundBot/Frontend/index.html
2026-02-02 11:35:09 +08:00

203 lines
5.9 KiB
HTML
Raw Permalink 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 lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GoFundBot - Make The Fund Fun</title>
<meta name="description" content="专业的基金数据分析工具,提供基金详情、净值走势、持仓分析等功能">
<meta name="keywords" content="基金分析,基金数据,净值走势,基金查询,基金投资">
<style>
/* 全局基础样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: #f5f7fa;
color: #333;
line-height: 1.6;
}
#app {
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* 加载状态样式 */
.app-loading {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
color: white;
text-align: center;
padding: 20px;
}
.loading-spinner {
width: 50px;
height: 50px;
border: 3px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top-color: #fff;
animation: spin 1s ease-in-out infinite;
margin-bottom: 20px;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.loading-text {
font-size: 1.2rem;
opacity: 0.9;
margin-top: 10px;
}
/* 错误状态样式 */
.app-error {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
background: #ffebee;
color: #c62828;
padding: 40px 20px;
text-align: center;
}
.error-icon {
font-size: 60px;
margin-bottom: 20px;
}
.error-message {
font-size: 1.1rem;
margin: 10px 0;
max-width: 600px;
}
.error-tip {
color: #666;
font-size: 0.9rem;
margin-top: 20px;
max-width: 600px;
}
.retry-button {
background: #c62828;
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
font-size: 1rem;
cursor: pointer;
margin-top: 20px;
transition: background 0.3s;
}
.retry-button:hover {
background: #b71c1c;
}
/* 移动端适配 */
@media (max-width: 768px) {
.loading-spinner {
width: 40px;
height: 40px;
}
.loading-text {
font-size: 1rem;
}
.error-icon {
font-size: 50px;
}
.error-message {
font-size: 1rem;
}
}
</style>
</head>
<body>
<!-- Vue应用挂载点 -->
<div id="app">
<!-- 加载状态 -->
<div class="app-loading" id="loading">
<div class="loading-spinner"></div>
<h1>基金分析系统</h1>
<p class="loading-text">正在加载应用资源...</p>
</div>
<!-- 错误状态(隐藏) -->
<div class="app-error" id="error" style="display: none;">
<div class="error-icon">⚠️</div>
<h2>应用加载失败</h2>
<p class="error-message" id="error-message">无法加载应用资源,请检查网络连接或刷新页面重试。</p>
<p class="error-tip">如果问题持续存在请确保后端服务已启动http://localhost:5000</p>
<button class="retry-button" onclick="window.location.reload()">刷新页面</button>
</div>
</div>
<!-- 错误处理脚本 -->
<script>
// 页面加载处理
window.addEventListener('load', function() {
const appElement = document.getElementById('app');
const loadingElement = document.getElementById('loading');
const errorElement = document.getElementById('error');
const errorMessageElement = document.getElementById('error-message');
// 检查Vue应用是否成功挂载
setTimeout(() => {
// 检查是否有Vue应用被挂载
const vueApp = appElement.__vue_app__;
if (!vueApp) {
// 如果Vue应用没有挂载显示错误
loadingElement.style.display = 'none';
errorElement.style.display = 'flex';
// 检查后端服务
fetch('http://localhost:5000/api')
.then(response => {
if (response.ok) {
errorMessageElement.textContent = '前端应用加载失败,请检查控制台错误信息。';
} else {
errorMessageElement.textContent = '后端服务连接失败,请确保后端已启动。';
}
})
.catch(() => {
errorMessageElement.textContent = '无法连接到后端服务请确保已启动后端http://localhost:5000。';
});
}
}, 5000); // 5秒后检查
});
// 捕获全局错误
window.addEventListener('error', function(event) {
console.error('全局错误:', event.error);
});
// 捕获未处理的Promise拒绝
window.addEventListener('unhandledrejection', function(event) {
console.error('未处理的Promise拒绝:', event.reason);
});
</script>
<!-- Vue应用主脚本 -->
<script type="module" src="/src/main.js"></script>
</body>
</html>