소스 검색

Video.vue 中对失败的请求给出通知

reghao 2 년 전
부모
커밋
538717af6d
1개의 변경된 파일28개의 추가작업 그리고 0개의 파일을 삭제
  1. 28 0
      src/views/home/Video.vue

+ 28 - 0
src/views/home/Video.vue

@@ -117,7 +117,21 @@ export default {
           this.category.push(name)
           this.categoryMap.Set(name, res.data[i])
         }
+      } else {
+        this.$notify({
+          title: '提示',
+          message: res.msg,
+          type: 'error',
+          duration: 3000
+        })
       }
+    }).catch(error => {
+      this.$notify({
+        title: '提示',
+        message: error.message,
+        type: 'warning',
+        duration: 3000
+      })
     })
     this.videoPageWrapper(this.currentPage, this.prevId, this.nextId, this.categoryId)
   },
@@ -158,7 +172,21 @@ export default {
           this.totalSize = resData.totalSize
           this.prevId = resData.prevId
           this.nextId = resData.nextId
+        } else {
+          this.$notify({
+            title: '提示',
+            message: res.msg,
+            type: 'error',
+            duration: 3000
+          })
         }
+      }).catch(error => {
+        this.$notify({
+          title: '提示',
+          message: error.message,
+          type: 'warning',
+          duration: 3000
+        })
       })
     },
     chooseCategory(item, index) {