From 5d3529a43c2f80c6eff5235c646a446737dcb13c Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期三, 30 七月 2025 14:07:55 +0800 Subject: [PATCH] feat: 页面 --- src/utils/common/file.ts | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/utils/common/file.ts b/src/utils/common/file.ts index 25cbd9a..7346b89 100644 --- a/src/utils/common/file.ts +++ b/src/utils/common/file.ts @@ -8,12 +8,17 @@ return _url.startsWith('/') ? _url : '/' + _url; } +type ConvertApi2FormUrlOptions = { + fileName?: string; +}; + /** * 鎶奱pi杩斿洖鐨勮矾寰勮浆鎹负upload鐨勮矾寰� */ -export function convertApi2FormUrl(path: string) { +export function convertApi2FormUrl(path: string, options: ConvertApi2FormUrlOptions = {}) { + const { fileName } = options; return { - name: setOssFileName(path), + name: fileName ? fileName : setOssFileName(path), path: urlOmitDomain(path), url: setOSSLink(path), status: 'success', @@ -21,8 +26,8 @@ } as UploadUserFile; } -export function convertApi2FormUrlOnlyOne(path: string) { - return path ? [convertApi2FormUrl(path)] : []; +export function convertApi2FormUrlOnlyOne(path: string, options: ConvertApi2FormUrlOptions = {}) { + return path ? [convertApi2FormUrl(path, options)] : []; } /** -- Gitblit v1.9.1