优化install安装流程
This commit is contained in:
@@ -1,14 +1,54 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/install/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BuildAdmin-安装</title>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/install/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>BuildAdmin-安装</title>
|
||||
<script>
|
||||
(function(){
|
||||
var urls = { adminUrl: '', frontUrl: '' };
|
||||
fetch('/api/install/accessUrls').then(function(r){return r.json();}).then(function(res){
|
||||
if (res && res.data) { urls.adminUrl = res.data.adminUrl || ''; urls.frontUrl = res.data.frontUrl || ''; }
|
||||
}).catch(function(){});
|
||||
function applyUrls() {
|
||||
if (!urls.adminUrl && !urls.frontUrl) return;
|
||||
document.querySelectorAll('input[type="text"], input:not([type])').forEach(function(inp){
|
||||
var v = (inp.value || '').trim();
|
||||
if (v && (v.indexOf('#/admin') >= 0 || v.indexOf('index.html') >= 0) && v.indexOf('#/') >= 0) {
|
||||
inp.value = urls.adminUrl;
|
||||
inp.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
}
|
||||
});
|
||||
document.querySelectorAll('a[href*="#/admin"]').forEach(function(a){ if (urls.adminUrl) a.href = urls.adminUrl; });
|
||||
document.querySelectorAll('a[href*="#/"]').forEach(function(a){
|
||||
if (urls.frontUrl && a.href.indexOf('#/admin') < 0) a.href = urls.frontUrl;
|
||||
});
|
||||
}
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', function(){ setInterval(applyUrls, 800); });
|
||||
else setInterval(applyUrls, 800);
|
||||
})();
|
||||
(function(){
|
||||
function closeMigrateModal() {
|
||||
if (!document.body) return;
|
||||
var txt = document.body.innerText || document.body.textContent || '';
|
||||
if (txt.indexOf('数据表迁移失败') < 0 && txt.indexOf('数据表自动迁移失败') < 0) return;
|
||||
var btns = document.body.querySelectorAll('button, [role="button"], .el-button');
|
||||
for (var i = 0; i < btns.length; i++) {
|
||||
var b = btns[i];
|
||||
if (b.textContent && b.textContent.indexOf('继续安装') >= 0) { b.click(); return; }
|
||||
}
|
||||
}
|
||||
var obs = new MutationObserver(closeMigrateModal);
|
||||
function start() { if (document.body) { obs.observe(document.body, { childList: true, subtree: true }); closeMigrateModal(); } }
|
||||
if (document.body) start(); else document.addEventListener('DOMContentLoaded', start);
|
||||
setInterval(closeMigrateModal, 150);
|
||||
})();
|
||||
</script>
|
||||
<script type="module" crossorigin src="/install/assets/index.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/install/assets/index.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
</body>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user