feat: 自动提交 - 周一 2025/09/22 15:12:38.91
This commit is contained in:
133
src/web/templates/index_new.html
Normal file
133
src/web/templates/index_new.html
Normal file
@@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>TSP智能助手</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/static/dist/vite.svg">
|
||||
|
||||
<!-- 预加载关键资源 -->
|
||||
<link rel="preload" href="/static/dist/assets/index.css" as="style">
|
||||
<link rel="preload" href="/static/dist/assets/index.js" as="script">
|
||||
|
||||
<!-- 样式 -->
|
||||
<link rel="stylesheet" href="/static/dist/assets/index.css">
|
||||
|
||||
<!-- 如果构建文件不存在,显示提示信息 -->
|
||||
<style>
|
||||
.build-missing {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #f5f5f5;
|
||||
z-index: 9999;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.build-missing.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.build-missing h1 {
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.build-missing p {
|
||||
color: #666;
|
||||
margin-bottom: 20px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.build-missing .actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.build-missing .btn {
|
||||
padding: 12px 24px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.build-missing .btn-primary {
|
||||
background: #409eff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.build-missing .btn-primary:hover {
|
||||
background: #337ecc;
|
||||
}
|
||||
|
||||
.build-missing .btn-secondary {
|
||||
background: #909399;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.build-missing .btn-secondary:hover {
|
||||
background: #73767a;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
<!-- 构建文件缺失提示 -->
|
||||
<div id="build-missing" class="build-missing">
|
||||
<h1>🚀 TSP智能助手</h1>
|
||||
<p>
|
||||
前端构建文件不存在,请先构建前端应用。<br>
|
||||
或者使用传统HTML页面。
|
||||
</p>
|
||||
<div class="actions">
|
||||
<button class="btn btn-primary" onclick="buildFrontend()">
|
||||
📦 构建前端
|
||||
</button>
|
||||
<a href="/legacy" class="btn btn-secondary">
|
||||
📄 使用传统页面
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 脚本 -->
|
||||
<script>
|
||||
// 检查构建文件是否存在
|
||||
function checkBuildFiles() {
|
||||
const cssLink = document.querySelector('link[href="/static/dist/assets/index.css"]');
|
||||
const jsScript = document.createElement('script');
|
||||
jsScript.src = '/static/dist/assets/index.js';
|
||||
|
||||
jsScript.onerror = function() {
|
||||
document.getElementById('build-missing').classList.add('show');
|
||||
};
|
||||
|
||||
jsScript.onload = function() {
|
||||
document.getElementById('build-missing').classList.remove('show');
|
||||
};
|
||||
|
||||
document.head.appendChild(jsScript);
|
||||
}
|
||||
|
||||
// 构建前端
|
||||
function buildFrontend() {
|
||||
alert('请运行 build_frontend.bat 脚本构建前端应用');
|
||||
}
|
||||
|
||||
// 页面加载完成后检查
|
||||
document.addEventListener('DOMContentLoaded', checkBuildFiles);
|
||||
</script>
|
||||
|
||||
<!-- 尝试加载Vue应用 -->
|
||||
<script type="module" src="/static/dist/assets/index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user