瀏覽代碼

fix: 优化axios实例请求异常提示

wu.jian2 1 年之前
父節點
當前提交
7ed7eb9e21
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      data-room-ui/packages/js/utils/http.js

+ 8 - 0
data-room-ui/packages/js/utils/http.js

@@ -210,8 +210,16 @@ export function download (url, headers = {}, params = {}, body = {}) {
     }).catch(e => {
       const status = e?.response?.status
       if (status === 404) {
+        Message({
+          message: '文件不存在或已被删除',
+          type: 'error'
+        })
         return
       }
+      Message({
+        message: '服务异常',
+        type: 'error'
+      })
       console.error('服务异常')
     })
   })