解决API文档和路由配置合并冲突

This commit is contained in:
李旭明 committed 2025-08-04 11:19:52 +08:00
commit 79a96a7dfd
662 files changed
+127608 -205195

No files matched your search

+31 -2
View File
@@ -28,7 +28,7 @@ axios.defaults.headers['clientid'] = import.meta.env.VITE_APP_CLIENT_ID;
// 创建 axios 实例
const service = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_API,
timeout: 50000
timeout: 300000 // 增加到5分钟,适合大数据量导出
});
// 请求拦截器
@@ -205,7 +205,36 @@ export function download(url: string, params: any, fileName: string) {
}
],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob'
responseType: 'blob',
timeout: 1200000 // 导出接口单独设置20分钟超时
}).then(async (resp: any) => {
const isLogin = blobValidate(resp);
if (isLogin) {
const blob = new Blob([resp]);
FileSaver.saveAs(blob, fileName);
} else {
const blob = new Blob([resp]);
const resText = await blob.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'];
ElMessage.error(errMsg);
}
downloadLoadingInstance.close();
}).catch((r: any) => {
console.error(r);
ElMessage.error('下载文件出现错误,请联系管理员!');
downloadLoadingInstance.close();
});
}
// 通用下载方法(JSON格式入参)
export function downloadJson(url: string, params: any, fileName: string) {
downloadLoadingInstance = ElLoading.service({ text: '正在下载数据,请稍候', background: 'rgba(0, 0, 0, 0.7)' });
// prettier-ignore
return service.post(url, params, {
headers: { 'Content-Type': 'application/json;charset=utf-8' },
responseType: 'blob',
timeout: 1200000 // 导出接口单独设置20分钟超时
}).then(async (resp: any) => {
const isLogin = blobValidate(resp);
if (isLogin) {