From beb5cc2ed009b199a285e6d7032155050d628810 Mon Sep 17 00:00:00 2001 From: icssoa <615206459@qq.com> Date: Mon, 23 May 2022 14:38:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=20request=20code=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/cool/service/request.ts | 4 ++++ src/modules/upload/components/index.vue | 10 ++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index b898c8b..3a621f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "front-next", - "version": "5.2.1", + "version": "5.2.2", "scripts": { "dev": "vite --host", "build": "vite build", diff --git a/src/cool/service/request.ts b/src/cool/service/request.ts index 8051862..35aa43b 100644 --- a/src/cool/service/request.ts +++ b/src/cool/service/request.ts @@ -103,6 +103,10 @@ axios.interceptors.response.use( const { code, data, message } = res.data; + if (!code) { + return res.data; + } + switch (code) { case 1000: return data; diff --git a/src/modules/upload/components/index.vue b/src/modules/upload/components/index.vue index 34d6974..a1e35bf 100644 --- a/src/modules/upload/components/index.vue +++ b/src/modules/upload/components/index.vue @@ -352,12 +352,10 @@ async function httpRequest(req: any, item?: any) { update(); }) .catch((err) => { - if (mode == "local") { - ElMessage.error(err.message); - item.error = err.message; - emit("error", item); - reject(err); - } + ElMessage.error(err.message); + item.error = err.message; + emit("error", item); + reject(err); }); }