From 883ca635ebb2df1ccb9e7f6dc19a88c7ad374cb6 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期日, 21 七月 2024 14:47:00 +0800 Subject: [PATCH] update 部分需求变更 --- plugins/http.js | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/plugins/http.js b/plugins/http.js index 58e3162..db3b571 100644 --- a/plugins/http.js +++ b/plugins/http.js @@ -64,29 +64,30 @@ msg: '' }) } else { + console.log('res',res.data) if (res.data.code == ('0')) { resolve({ data: res.data.data, code: 0, msg: '' }) - } else if (res.data.code === '3000') { + } else if (res.data.code === '3000'||res.data&&res.data.code&&res.data.code.startsWith('3000')) { if (Array.isArray(res.data.data)) { if (res.data.data.length > 0 && res.data.data[0] - .errorMessage) { - message.showToast(res.data.data[0].errorMessage) + .msg) { + message.showToast(res.data.data[0].msg) } - } else if (res.data.data && res.data.data.errorMessage) { - message.showToast(res.data.data.errorMessage) + } else if (res.data && res.data.msg) { + message.showToast(res.data.msg) } else if (res.data.data && typeof res.data.data === 'string') { message.showToast(res.data.data) } reject({ data: null, code: parseInt(res.data.code), - msg: res.data.data + msg: res.data.data || res.data.msg }) - } else if (res.data.code === '4000') { + } else if (res.data.code === '4000'||res.data&&res.data.code&&res.data.code.startsWith('4000')) { message.showToast('系统异常') } else { if (res.data.data && typeof res.data.data === 'string') { @@ -191,7 +192,7 @@ let header = { Authorization: token ? `Bearer ${token}` : null, } - var url = environments.httpBaseUri + '/wxkj/upload/file' + var url = environments.httpBaseUri + '/api/upload/oss/file' if (environments.type == 'prod') { //需要拼接 var year = utils.toYear(new Date()) @@ -210,11 +211,12 @@ filePath: filePath, name: 'file', success: (res) => { - console.log('res', res) + console.log('res debug', res) message.hideLoading() if (res.statusCode === 200) { const obj = JSON.parse(res.data) - if (obj.code.startsWith('200')) { + console.log('res debug2', obj) + if (obj.code.startsWith('200')||obj.code==='0') { resolve({ data: obj.data, code: 0, @@ -257,6 +259,7 @@ try { return await http.uploadTemp(filePath, dto) } catch (e) { + console.log('error',e) return e } }, -- Gitblit v1.9.3