2026-08-21 17:01:39 +08:00

37 lines
1.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { UploadApiResult } from './model/uploadModel';
import { defHttp } from '/@/utils/http/axios';
import { UploadFileParams } from '/#/axios';
import { useGlobSetting } from '/@/hooks/setting';
const { uploadUrl = '' } = useGlobSetting();
/**
* @description: Upload interface
*/
export function uploadApi(params: UploadFileParams, onUploadProgress: (progressEvent: ProgressEvent) => void) {
return defHttp.uploadFile<UploadApiResult>(
{
url: `${uploadUrl}/sys/common/upload`,
onUploadProgress,
},
params,
// update-begin--author:liaozhiyang---date:20260804---for【LHZP-1385】修复上传示例报错
// 返回上传接口完整响应,避免调用方拿到 undefined 被当成失败
{ isReturnResponse: true }
// update-end--author:liaozhiyang---date:20260804---for【LHZP-1385】修复上传示例报错
);
}
/**
* @description: Upload interface
*/
export function uploadImg(params: UploadFileParams, onUploadProgress: (progressEvent: ProgressEvent) => void) {
return defHttp.uploadFile<UploadApiResult>(
{
url: `${uploadUrl}/sys/common/upload`,
onUploadProgress,
},
params,
{ isReturnResponse: true }
);
}