From 41487b9a8ad1353c21dd1ac2bfafcf8d1d4f34e4 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期五, 28 八月 2026 17:09:47 +0800
Subject: [PATCH] feat: 所有前端 API 请求加超时保护,超时/网络异常优雅提示,不再无限 pending

---
 traffic-audit-web/src/views/RuleManage.vue |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/traffic-audit-web/src/views/RuleManage.vue b/traffic-audit-web/src/views/RuleManage.vue
index 30d2f57..e39ff03 100644
--- a/traffic-audit-web/src/views/RuleManage.vue
+++ b/traffic-audit-web/src/views/RuleManage.vue
@@ -91,19 +91,19 @@
       this.loading = true
       api.get('/rules/list', { params: { reportType: this.reportType } })
         .then(res => { this.rules = res.data || [] })
-        .catch(() => { this.$message.error('瑙勫垯鍔犺浇澶辫触') })
+        .catch(e => { if (e && e._toast) return; this.$message.error('瑙勫垯鍔犺浇澶辫触') })
         .finally(() => { this.loading = false })
     },
     toggleRule(row) {
       api.post('/rules/toggle', null, { params: { id: row.id, enabled: row.isEnabled } })
         .then(() => { this.$message.success((row.isEnabled ? '宸插惎鐢細' : '宸插仠鐢細') + row.ruleCode) })
-        .catch(() => { row.isEnabled = row.isEnabled ? 0 : 1; this.$message.error('鎿嶄綔澶辫触') })
+        .catch(e => { if (e && e._toast) return; row.isEnabled = row.isEnabled ? 0 : 1; this.$message.error('鎿嶄綔澶辫触') })
     },
     saveThreshold(row) {
       api.post('/rules/update', {
         id: row.id, threshold: row.threshold, alertLevel: row.alertLevel
       }).then(() => { this.$message.success('宸蹭繚瀛橈細' + row.ruleCode) })
-        .catch(() => { this.$message.error('淇濆瓨澶辫触') })
+        .catch(e => { if (e && e._toast) return; this.$message.error('淇濆瓨澶辫触') })
     }
   },
   mounted() { this.loadRules() }

--
Gitblit v1.9.1