- 重构加载模式
This commit is contained in:
+1
-3
@@ -1,10 +1,8 @@
|
|||||||
# Python 打包产物
|
# Python 打包产物
|
||||||
dist_python/
|
dist_python/
|
||||||
build_python/
|
build_python/
|
||||||
*.spec
|
|
||||||
|
|
||||||
# SQLite 数据库文件
|
# SQLite 数据库文件
|
||||||
*.db
|
|
||||||
*.sqlite
|
*.sqlite
|
||||||
*.sqlite3
|
*.sqlite3
|
||||||
|
|
||||||
@@ -52,4 +50,4 @@ data/
|
|||||||
knowledge_base/
|
knowledge_base/
|
||||||
|
|
||||||
# 本地敏感配置(不要提交到仓库)
|
# 本地敏感配置(不要提交到仓库)
|
||||||
config.json
|
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>丑橘文化传媒GEO内容优化平台</title>
|
||||||
|
<style>
|
||||||
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
body {
|
||||||
|
background: #f7fafc;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100vh;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||||
|
}
|
||||||
|
.loader {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.spinner {
|
||||||
|
width: 40px; height: 40px;
|
||||||
|
border: 4px solid #e2e8f0;
|
||||||
|
border-top-color: #2563eb;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 0.8s linear infinite;
|
||||||
|
margin: 0 auto 16px;
|
||||||
|
}
|
||||||
|
@keyframes spin { to { transform: rotate(360deg); } }
|
||||||
|
p { color: #4a5568; font-size: 14px; }
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
// 等待 streamlit 服务就绪后跳转
|
||||||
|
(function() {
|
||||||
|
var retries = 0;
|
||||||
|
var maxRetries = 50;
|
||||||
|
function check() {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'http://127.0.0.1:8501', true);
|
||||||
|
xhr.timeout = 2000;
|
||||||
|
xhr.onload = function() {
|
||||||
|
window.location.href = 'http://127.0.0.1:8501';
|
||||||
|
};
|
||||||
|
xhr.onerror = function() {
|
||||||
|
retries++;
|
||||||
|
if (retries < maxRetries) {
|
||||||
|
setTimeout(check, 500);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.ontimeout = function() {
|
||||||
|
retries++;
|
||||||
|
if (retries < maxRetries) {
|
||||||
|
setTimeout(check, 500);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
// 等待 500ms 后开始轮询(给 streamlit 启动时间)
|
||||||
|
setTimeout(check, 500);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="loader">
|
||||||
|
<div class="spinner"></div>
|
||||||
|
<p>正在加载...</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -98,7 +98,7 @@ pub fn run() {
|
|||||||
} else {
|
} else {
|
||||||
"geo_tool_app"
|
"geo_tool_app"
|
||||||
};
|
};
|
||||||
let exe_path = resource_dir.join("_up_").join("dist").join(exe_name);
|
let exe_path = resource_dir.join("_up_").join("dist_python").join(exe_name);
|
||||||
|
|
||||||
log::info!(
|
log::info!(
|
||||||
"[生产模式] 启动打包应用: {:?}",
|
"[生产模式] 启动打包应用: {:?}",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"identifier": "com.pinesound.geo-tool",
|
"identifier": "com.pinesound.geo-tool",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "http://localhost:8501",
|
"frontendDist": "../frontend",
|
||||||
"devUrl": "http://localhost:8501"
|
"devUrl": "http://localhost:8501"
|
||||||
},
|
},
|
||||||
"app": {
|
"app": {
|
||||||
|
|||||||
Reference in New Issue
Block a user