From 042b28b2d62860db912b254420fb4172880aafab Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 22 八月 2022 16:17:28 +0800
Subject: [PATCH] 支持全局异常和统一返回结果

---
 web_src/src/components/channelList.vue |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue
index d8817d5..933cc44 100644
--- a/web_src/src/components/channelList.vue
+++ b/web_src/src/components/channelList.vue
@@ -342,12 +342,15 @@
             channelType: this.channelType
           }
         }).then( (res) =>{
-          this.total = res.data.total;
-          this.deviceChannelList = res.data.list;
-          // 闃叉鍑虹幇琛ㄦ牸閿欎綅
-          this.$nextTick(() => {
-            this.$refs.channelListTable.doLayout();
-          })
+          if (res.data.code === 0) {
+            this.total = res.data.data.total;
+            this.deviceChannelList = res.data.data.list;
+            // 闃叉鍑虹幇琛ㄦ牸閿欎綅
+            this.$nextTick(() => {
+              this.$refs.channelListTable.doLayout();
+            })
+          }
+
         }).catch(function (error) {
           console.log(error);
         });
@@ -361,12 +364,14 @@
             count: this.count,
           }
         }).then((res)=> {
-          this.total = res.data.total;
-          this.deviceChannelList = res.data.list;
-          // 闃叉鍑虹幇琛ㄦ牸閿欎綅
-          this.$nextTick(() => {
-            this.$refs.channelListTable.doLayout();
-          })
+          if (res.data.code === 0) {
+            this.total = res.data.total;
+            this.deviceChannelList = res.data.list;
+            // 闃叉鍑虹幇琛ㄦ牸閿欎綅
+            this.$nextTick(() => {
+              this.$refs.channelListTable.doLayout();
+            })
+          }
         }).catch(function (error) {
           console.log(error);
         });

--
Gitblit v1.8.0