diff --git a/src/config.ts b/src/config.ts index 1a74ce1..97d2207 100644 --- a/src/config.ts +++ b/src/config.ts @@ -6,6 +6,9 @@ import { createVNode } from "vue"; import ErrorDialog from "@/components/ErrorDialog.vue"; function globalConfig() { + window.globalConfig.axiosRequestDef = () => ({ + timeout: 1000 * 60 * 10, + }) window.globalConfig.customAxios = axiosInstance => { // 全局请求拦截 axiosInstance.interceptors.request.clear(); @@ -25,18 +28,18 @@ function globalConfig() { axiosInstance.interceptors.response.clear(); axiosInstance.interceptors.response.use( (response) => { - const data = response.data; + const data = response.data; - if (data && data.success === false) { - // 显示错误对话框 - system.showErrorDialog(data.failMessage || '系统异常'); + if (data && data.success === false) { + // 显示错误对话框 + system.showErrorDialog(data.failMessage || '系统异常'); - // 返回一个被拒绝的 Promise,这样后续 .then() 不会执行,进入 .catch() - return Promise.reject(response); - } + // 返回一个被拒绝的 Promise,这样后续 .then() 不会执行,进入 .catch() + return Promise.reject(response); + } - // 正常情况,继续传递数据 - return response; + // 正常情况,继续传递数据 + return response; }, (error: any) => { const { response } = error;