Browse Source

feat: 监控组件toast提示逻辑优化

cuiyalong 1 year ago
parent
commit
1dc8d75d32
1 changed files with 32 additions and 28 deletions
  1. 32 28
      apps/mobile/src/views/article/components/ActionMonitor.vue

+ 32 - 28
apps/mobile/src/views/article/components/ActionMonitor.vue

@@ -301,38 +301,42 @@ export default {
       }
       const loading = this.$toast.loading()
       // do something...
-      const { success, msg, data } = await this.doChange()
-      if (success) {
-        // 判断是否开启推送提醒
-        if (data?.msg_open) {
-          // 推送提醒已经开启
-          this.$toast(this.conf.successDialogMessage)
-        } else {
-          // 提醒未开启
-          this.successMonitorAndToPushSettingDialog()
-        }
-      } else {
-        // 判断是否超出可监控项目个数
-        if (data?.limit_status) {
-          if (this.isMemberOrBusiness) {
-            const count = data?.limit_status || 0
-            this.concatKfDialog({
-              title: `监控${this.conf.key}个数已达上限`,
-              message: `您最多可监控${count}个${this.conf.key},可联系客服,申请监控更多${this.conf.key}`
-            })
+      try {
+        const { success, msg, data } = await this.doChange()
+        loading.clear()
+        if (success) {
+          // 判断是否开启推送提醒
+          if (data?.msg_open) {
+            // 推送提醒已经开启
+            this.$toast(this.conf.successDialogMessage)
           } else {
-            // 留资
-            this.$leaveInfo.toLeaveInfoPage({
-              source: `${this.$env.platform}_${this.conf.limitSource}`
-            })
+            // 提醒未开启
+            this.successMonitorAndToPushSettingDialog()
           }
+        } else {
+          // 判断是否超出可监控项目个数
+          if (data?.limit_status) {
+            if (this.isMemberOrBusiness) {
+              const count = data?.limit_status || 0
+              this.concatKfDialog({
+                title: `监控${this.conf.key}个数已达上限`,
+                message: `您最多可监控${count}个${this.conf.key},可联系客服,申请监控更多${this.conf.key}`
+              })
+            } else {
+              // 留资
+              this.$leaveInfo.toLeaveInfoPage({
+                source: `${this.$env.platform}_${this.conf.limitSource}`
+              })
+            }
+          }
+          // if (msg) {
+          //   this.$toast(msg)
+          // }
         }
-        // if (msg) {
-        //   this.$toast(msg)
-        // }
+        this.syncValue(true)
+      } catch (error) {
+        loading.clear()
       }
-      loading.clear()
-      this.syncValue(true)
     },
     // 取消监控
     async doCancelMonitor() {