This commit is contained in:
ln1778 2024-05-07 11:57:19 +08:00
parent 4c0adafbbf
commit 7e39cb8d9d
1 changed files with 5 additions and 9 deletions

View File

@ -11,7 +11,7 @@ import { MessageBox, Message } from 'element-ui';
// import cancelClass from './cancelToken' // import cancelClass from './cancelToken'
const service = axios.create({ const service = axios.create({
baseURL: window?.VUE_APP_BASE_API?window.VUE_APP_BASE_API:"http://dev-erp-api.xtkj99.com:7890", // api 的 base_url baseURL: window.VUE_APP_BASE_API?window.VUE_APP_BASE_API:"http://dev-erp-api.xtkj99.com:7890", // api 的 base_url
timeout: 1000 * 60 * 2 // 接口超时 timeout: 1000 * 60 * 2 // 接口超时
}) })
@ -164,14 +164,10 @@ service.interceptors.response.use(
message: '接口请求超时', message: '接口请求超时',
type: 'error' type: 'error'
}) })
} else { } else {
// console.log(Object.getOwnPropertyNames(error)); if(error.response&&error.response.config){
// console.log(error); const copyconfig = JSON.parse(JSON.stringify(error.response.config))
// console.log(error.stack); copyconfig.url = copyconfig.url.replace(copyconfig.baseURL, '')
// console.log(error.message);
if(error?.response.config){
const copyconfig = JSON.parse(JSON.stringify(error?.response.config))
copyconfig.url = error?.response.config?.url?.replace(copyconfig.baseURL, '')
if (typeof (copyconfig.data) === undefined || copyconfig.data == {} || copyconfig.data == '' || typeof (copyconfig.data) === 'object') { if (typeof (copyconfig.data) === undefined || copyconfig.data == {} || copyconfig.data == '' || typeof (copyconfig.data) === 'object') {
copyconfig.data = '' copyconfig.data = ''
} }