Explorar el Código

fix(analytics): 刷新数据按钮增加错误处理防止白屏 (bug-6148)

- Analytics/index.vue handleRefresh 增加 try/catch
- API失败时显示友好错误提示'刷新数据失败,请稍后重试'
- 避免白屏无法恢复的问题
ethanfly hace 4 días
padre
commit
f96419d4c2
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      client/src/views/Analytics/index.vue

+ 4 - 0
client/src/views/Analytics/index.vue

@@ -79,6 +79,7 @@ import { Refresh } from '@element-plus/icons-vue';
 import { PLATFORMS } from '@media-manager/shared';
 import type { PlatformComparison, PlatformType } from '@media-manager/shared';
 import { useAuthStore } from '@/stores/auth';
+import { ElMessage } from 'element-plus';
 import dayjs from 'dayjs';
 import request from '@/api/request';
 
@@ -112,6 +113,9 @@ async function handleRefresh() {
   refreshing.value = true;
   try {
     await loadData();
+  } catch (error) {
+    console.error('刷新数据失败:', error);
+    ElMessage.error('刷新数据失败,请稍后重试');
   } finally {
     refreshing.value = false;
   }