首页工作空间下载:对象名传参适配后端相对路径、下载感知(toast+按钮级)、5分钟超时

- downloadAsset 重写:content 相对路径直接作下载参数,兼容历史完整 URL 去域名;
  blob 校验拒绝 JSON 错误体,避免生成坏文件;文件名带扩展名
- 下载感知:统一加下载中轻量 toast(旋转图标、不锁页面),工作空间按钮级
  「下载中…」禁用;成功/失败替换为结果提示
- 新增 downloadWorkspaceFile(workflow 域独立 API):下载超时放宽到 5 分钟,
  不动 creation 共享 downloadToFile

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-08-21 20:09:20 +08:00
co-authored by Claude
parent 490cf4bb93
commit d48875bd7a
3 changed files with 76 additions and 21 deletions
+14
View File
@@ -1,4 +1,5 @@
import request from '/@/utils/request';
import type { RequestOptions } from '/@/utils/request';
// ===== 节点库(V2 结构,workflow 专用;creation 继续使用 creation/index.ts 的旧结构)=====
export interface NodeLibraryPresetOption {
@@ -134,3 +135,16 @@ export function getSubFlowWorkflowDetail(id: string) {
params: { id },
}) as Promise<{ code: number; message: string; data: any }>;
}
// 工作空间文件下载(首页工作流/工作空间专用):与 creation 的 downloadToFile 同一后端接口,
// 但工作空间文件可能较大(视频/音频),下载超时放宽到 5 分钟;不改动 creation 共享 API 的超时
export function downloadWorkspaceFile(data: { fileURL: string }, requestOptions?: RequestOptions) {
return request({
url: '/oss/file/downloadToBrowser',
method: 'post',
data,
responseType: 'blob',
timeout: 5 * 60 * 1000,
requestOptions,
});
}