From ba581ed095d31ea0d2e5c22dbbca447429c48ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=87=AA=E8=BE=BE?= <980324341@qq.com> Date: Tue, 8 Sep 2026 15:19:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(brand):=20=E5=93=81=E7=89=8C=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=BA=90=E6=96=87=E4=BB=B6=E6=94=B9=E8=B5=B0=20OSS=20?= =?UTF-8?q?URL=EF=BC=88=E6=9C=8D=E5=8A=A1=E7=AB=AF=E5=8C=96=E8=B7=A8?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=BB=84=E8=A3=85=E5=8F=AF=E7=94=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 前端上传桥与降级桥透传 uploadOss;品牌页提交时 fileUrl 优先取上传响应的 OSS url,localPath 仅作旧桌面桥兜底。 --- frontend-vue/src/pages/brand/components/BrandBrandTab.vue | 7 ++++--- frontend-vue/src/shared/bridges/pywebview.ts | 1 + frontend-vue/src/shared/bridges/web-fallback.ts | 8 ++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/frontend-vue/src/pages/brand/components/BrandBrandTab.vue b/frontend-vue/src/pages/brand/components/BrandBrandTab.vue index 20615357..b66489f1 100644 --- a/frontend-vue/src/pages/brand/components/BrandBrandTab.vue +++ b/frontend-vue/src/pages/brand/components/BrandBrandTab.vue @@ -286,7 +286,7 @@ async function uploadBrandPathsToJava(paths: Array ({ fileKey: f.fileKey, originalFilename: f.originalFilename, relativePath: f.relativePath, - fileUrl: f.localPath, + fileUrl: f.url || f.localPath, })) if (runMode.value === 'immediate') { const res = await runBrandNow(files, strategy.value) diff --git a/frontend-vue/src/shared/bridges/pywebview.ts b/frontend-vue/src/shared/bridges/pywebview.ts index 5eabd2c4..5555c772 100644 --- a/frontend-vue/src/shared/bridges/pywebview.ts +++ b/frontend-vue/src/shared/bridges/pywebview.ts @@ -93,6 +93,7 @@ export interface PywebviewApi { upload_file_to_java?: ( filePath: string, relativePath?: string, + uploadOss?: boolean, ) => Promise<{ success: boolean; message?: string; diff --git a/frontend-vue/src/shared/bridges/web-fallback.ts b/frontend-vue/src/shared/bridges/web-fallback.ts index 52379a3d..36d79e1d 100644 --- a/frontend-vue/src/shared/bridges/web-fallback.ts +++ b/frontend-vue/src/shared/bridges/web-fallback.ts @@ -125,8 +125,8 @@ export const webFallbackApi: PywebviewApi = { return registerWebFiles(files) }, - /** 虚拟路径 → 浏览器 File → 上传 Java 临时目录;返回结构与桌面桥一致(透传 Java ApiResponse) */ - async upload_file_to_java(filePath, relativePath) { + /** 虚拟路径 → 浏览器 File → 上传 Java;uploadOss=true 时同时上传公开 OSS(品牌检测等服务端化工具用) */ + async upload_file_to_java(filePath, relativePath, uploadOss) { const file = typeof filePath === 'string' ? webFileMap.get(filePath) : undefined if (!file) { return { success: false, error: '文件不存在,请重新选择' } @@ -136,6 +136,10 @@ export const webFallbackApi: PywebviewApi = { if (relativePath) { form.append('relativePath', relativePath) } + if (uploadOss) { + form.append('uploadToOss', 'true') + form.append('moduleType', 'BRAND') + } try { // http 实例对 /newApi 前缀自动附带 Bearer;FormData 的 Content-Type 交由浏览器自动生成(含 boundary) const response = await http.post('/newApi/api/files/upload', form, { timeout: 120000 })