✨ 优化监控页面加载体验
- 添加monitorTabLoading整体加载遮罩 - 创建openMonitorTab()和initMonitorTab()方法 - 使用Promise.all并行加载健康检测和系统日志 - 数据全部加载完成后才显示监控内容,彻底解决刷新闪烁问题 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -189,6 +189,9 @@ createApp({
|
||||
}
|
||||
},
|
||||
|
||||
// 监控页整体加载遮罩(避免刷新时闪一下空态)
|
||||
monitorTabLoading: initialAdminTab === 'monitor',
|
||||
|
||||
// Toast通知
|
||||
toasts: [],
|
||||
toastIdCounter: 0,
|
||||
@@ -2314,8 +2317,12 @@ handleDragLeave(e) {
|
||||
if (this.user && this.user.is_admin) {
|
||||
this.loadUsers();
|
||||
this.loadServerStorageStats();
|
||||
this.loadHealthCheck();
|
||||
this.loadSystemLogs(1);
|
||||
if (this.adminTab === 'monitor') {
|
||||
this.initMonitorTab();
|
||||
} else {
|
||||
this.loadHealthCheck();
|
||||
this.loadSystemLogs(1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'settings':
|
||||
@@ -2530,6 +2537,30 @@ handleDragLeave(e) {
|
||||
}
|
||||
},
|
||||
|
||||
// 打开监控标签页(带整体loading遮罩)
|
||||
openMonitorTab() {
|
||||
this.adminTab = 'monitor';
|
||||
this.initMonitorTab();
|
||||
},
|
||||
|
||||
// 统一加载监控数据,避免初次渲染空态闪烁
|
||||
async initMonitorTab() {
|
||||
this.monitorTabLoading = true;
|
||||
this.healthCheck.loading = true;
|
||||
this.systemLogs.loading = true;
|
||||
|
||||
try {
|
||||
await Promise.all([
|
||||
this.loadHealthCheck(),
|
||||
this.loadSystemLogs(1)
|
||||
]);
|
||||
} catch (e) {
|
||||
// 子方法内部已处理错误
|
||||
} finally {
|
||||
this.monitorTabLoading = false;
|
||||
}
|
||||
},
|
||||
|
||||
// ===== 健康检测 =====
|
||||
|
||||
async loadHealthCheck() {
|
||||
@@ -2883,6 +2914,7 @@ handleDragLeave(e) {
|
||||
if (this.adminTab === 'monitor') {
|
||||
this.healthCheck.loading = true;
|
||||
this.systemLogs.loading = true;
|
||||
this.monitorTabLoading = true;
|
||||
}
|
||||
|
||||
// 检查登录状态
|
||||
|
||||
Reference in New Issue
Block a user