feat: 安装成功后进入等待页,重启就绪后自动跳转管理端登录页
- Install.vue 提交成功切到带加载动画的等待页,轮询系统就绪后自动进入后台 - 超时兜底显示手动提示与进入按钮;移除原 success 提示条与 done 文案
This commit is contained in:
@@ -13,8 +13,15 @@
|
||||
</div>
|
||||
|
||||
<n-spin :show="loading">
|
||||
<div v-if="restarting" class="waiting">
|
||||
<n-spin size="large" />
|
||||
<h2>{{ tt('restartTitle') }}</h2>
|
||||
<p>{{ restartTimedOut ? tt('doneLocalDev') : tt('restartHint') }}</p>
|
||||
<n-button v-if="restartTimedOut" type="primary" @click="goAdmin">{{ tt('enterAdmin') }}</n-button>
|
||||
</div>
|
||||
|
||||
<n-result
|
||||
v-if="installed"
|
||||
v-else-if="installed"
|
||||
status="success"
|
||||
:title="tt('alreadyInstalled')"
|
||||
:description="tt('gotoAdmin')"
|
||||
@@ -103,7 +110,6 @@
|
||||
</ul>
|
||||
|
||||
<n-alert v-if="error" type="error" class="mt" :title="error" />
|
||||
<n-alert v-if="success" type="success" class="mt" :title="success" />
|
||||
|
||||
<div class="wizard-foot">
|
||||
<n-button v-if="step > 0" :disabled="advancing || submitting" @click="step -= 1">{{ tt('prev') }}</n-button>
|
||||
@@ -181,7 +187,8 @@ const submitting = ref(false);
|
||||
const advancing = ref(false);
|
||||
const installed = ref(false);
|
||||
const error = ref('');
|
||||
const success = ref('');
|
||||
const restarting = ref(false);
|
||||
const restartTimedOut = ref(false);
|
||||
const testingMysql = ref(false);
|
||||
const testingRedis = ref(false);
|
||||
const testingStorage = ref(false);
|
||||
@@ -366,7 +373,6 @@ async function pollUntilReady(): Promise<boolean> {
|
||||
|
||||
async function submit(): Promise<void> {
|
||||
error.value = '';
|
||||
success.value = '';
|
||||
submitting.value = true;
|
||||
try {
|
||||
// 安装前先确认存储可用
|
||||
@@ -383,18 +389,19 @@ async function submit(): Promise<void> {
|
||||
if (body && (!res.ok || body.code !== 0)) {
|
||||
throw new Error(body.message || tt('failed'));
|
||||
}
|
||||
installed.value = true;
|
||||
success.value = tt('done');
|
||||
// 统一轮询等待系统就绪:本地 dev.py 会自动停掉安装 API 并以正式模式重启,
|
||||
// 生产由 PM2/Docker 按重启策略拉起;就绪后进入后台。
|
||||
// 进入等待页:服务正在重启,轮询到完全就绪后自动跳转到管理端登录页
|
||||
restarting.value = true;
|
||||
restartTimedOut.value = false;
|
||||
if (await pollUntilReady()) {
|
||||
installed.value = true;
|
||||
goAdmin();
|
||||
} else {
|
||||
// 超时兜底:多为 --install-mode 调试模式(写临时 .env,不会自动切换)
|
||||
success.value = tt('doneLocalDev');
|
||||
restartTimedOut.value = true;
|
||||
}
|
||||
} catch (e) {
|
||||
error.value = (e as Error).message;
|
||||
restarting.value = false;
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
@@ -445,6 +452,25 @@ async function submit(): Promise<void> {
|
||||
.steps {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.waiting {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 48px 16px 40px;
|
||||
text-align: center;
|
||||
}
|
||||
.waiting h2 {
|
||||
margin: 6px 0 0;
|
||||
font-size: 17px;
|
||||
}
|
||||
.waiting p {
|
||||
margin: 0;
|
||||
max-width: 420px;
|
||||
font-size: 13px;
|
||||
line-height: 1.7;
|
||||
color: var(--n-text-color-3, #6a7687);
|
||||
}
|
||||
.box {
|
||||
border: 1px solid var(--border, #e1e7f0);
|
||||
border-radius: 10px;
|
||||
|
||||
Reference in New Issue
Block a user