From 092a252ac46aaf78cbe89c8b876ae1a892650e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Mon, 1 May 2023 21:49:08 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B9=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/path/project.api.ts | 3 +- .../components/CanvasPage/index.vue | 32 ++++++++++--------- src/views/chart/hooks/useSync.hook.ts | 15 ++++++--- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/api/path/project.api.ts b/src/api/path/project.api.ts index 164df1d3..36b1cb6c 100644 --- a/src/api/path/project.api.ts +++ b/src/api/path/project.api.ts @@ -89,7 +89,8 @@ export const uploadFile = async (data: object) => { /** * 文件地址 */ - fileName: string + fileName: string, + httpurl: string, }>(`${ModuleTypeEnum.PROJECT}/upload`, data, ContentTypeEnum.FORM_DATA) return res } catch { diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue index 79a6c916..3142541b 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue @@ -139,7 +139,7 @@ import { loadAsyncComponent, fetchRouteParamsLocation } from '@/utils' import { PreviewScaleEnum } from '@/enums/styleEnum' import { ResultEnum } from '@/enums/httpEnum' import { icon } from '@/plugins' -import { uploadFile} from '@/api/path' +import { uploadFile } from '@/api/path' const { ColorPaletteIcon } = icon.ionicons5 const { ScaleIcon, FitToScreenIcon, FitToHeightIcon, FitToWidthIcon } = icon.carbon @@ -273,24 +273,26 @@ const customRequest = (options: UploadCustomRequestOptions) => { nextTick(async () => { if (file.file) { // 修改名称 - const newNameFile = new File( - [file.file], - `${fetchRouteParamsLocation()}_index_background.png`, - { type: file.file.type } - ) + const newNameFile = new File([file.file], `${fetchRouteParamsLocation()}_index_background.png`, { + type: file.file.type + }) let uploadParams = new FormData() uploadParams.append('object', newNameFile) const uploadRes = await uploadFile(uploadParams) - if(uploadRes && uploadRes.code === ResultEnum.SUCCESS) { - chartEditStore.setEditCanvasConfig( - EditCanvasConfigEnum.BACKGROUND_IMAGE, - `${systemStore.getFetchInfo.OSSUrl}${uploadRes.data.fileName}?time=${new Date().getTime()}` - ) - chartEditStore.setEditCanvasConfig( - EditCanvasConfigEnum.SELECT_COLOR, - false - ) + if (uploadRes && uploadRes.code === ResultEnum.SUCCESS) { + if (uploadRes.data.httpurl) { + chartEditStore.setEditCanvasConfig( + EditCanvasConfigEnum.BACKGROUND_IMAGE, + `${uploadRes.data.httpurl}?time=${new Date().getTime()}` + ) + } else { + chartEditStore.setEditCanvasConfig( + EditCanvasConfigEnum.BACKGROUND_IMAGE, + `${systemStore.getFetchInfo.OSSUrl || ''}${uploadRes.data.fileName}?time=${new Date().getTime()}` + ) + } + chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.SELECT_COLOR, false) return } window['$message'].error('添加图片失败,请稍后重试!') diff --git a/src/views/chart/hooks/useSync.hook.ts b/src/views/chart/hooks/useSync.hook.ts index 1bf5c82e..8aa67c7f 100644 --- a/src/views/chart/hooks/useSync.hook.ts +++ b/src/views/chart/hooks/useSync.hook.ts @@ -294,10 +294,17 @@ export const useSync = () => { const uploadRes = await uploadFile(uploadParams) // 保存预览图 if(uploadRes && uploadRes.code === ResultEnum.SUCCESS) { - await updateProjectApi({ - id: fetchRouteParamsLocation(), - indexImage: `${systemStore.getFetchInfo.OSSUrl}${uploadRes.data.fileName}` - }) + if (uploadRes.data.httpurl) { + await updateProjectApi({ + id: fetchRouteParamsLocation(), + indexImage: `${uploadRes.data.httpurl}` + }) + } else { + await updateProjectApi({ + id: fetchRouteParamsLocation(), + indexImage: `${systemStore.getFetchInfo.OSSUrl}${uploadRes.data.fileName}` + }) + } } } } catch (e) { From f37264fdbbc6f354d2184f708ccc57c7dd9b82af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Mon, 1 May 2023 21:51:18 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E5=8E=BB=E9=99=A4=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E5=8A=9F=E8=83=BD=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ProjectItemsCard/index.vue | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/views/project/items/components/ProjectItemsCard/index.vue b/src/views/project/items/components/ProjectItemsCard/index.vue index bc79edce..9e0b9166 100644 --- a/src/views/project/items/components/ProjectItemsCard/index.vue +++ b/src/views/project/items/components/ProjectItemsCard/index.vue @@ -124,22 +124,6 @@ const selectOptions = ref([ key: 'preview', icon: renderIcon(BrowsersOutlineIcon) }, - { - label: renderLang('global.r_copy'), - key: 'copy', - icon: renderIcon(CopyIcon), - disabled: true - }, - { - label: renderLang('global.r_rename'), - key: 'rename', - icon: renderIcon(PencilIcon), - disabled: true - }, - { - type: 'divider', - key: 'd1' - }, { label: props.cardData?.release ? renderLang('global.r_unpublish') @@ -147,15 +131,9 @@ const selectOptions = ref([ key: 'release', icon: renderIcon(SendIcon) }, - { - label: renderLang('global.r_download'), - key: 'download', - icon: renderIcon(DownloadIcon), - disabled: true - }, { type: 'divider', - key: 'd2' + key: 'd1' }, { label: renderLang('global.r_delete'), From fe87d0e4330774c1faf95dd9787721e4eb4817c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Mon, 8 May 2023 20:15:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E7=9A=84=20httpurl=20=E4=B8=BA=20fileurl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/path/project.api.ts | 2 +- .../ContentConfigurations/components/CanvasPage/index.vue | 4 ++-- src/views/chart/hooks/useSync.hook.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/path/project.api.ts b/src/api/path/project.api.ts index 36b1cb6c..ee0001ba 100644 --- a/src/api/path/project.api.ts +++ b/src/api/path/project.api.ts @@ -90,7 +90,7 @@ export const uploadFile = async (data: object) => { * 文件地址 */ fileName: string, - httpurl: string, + fileurl: string, }>(`${ModuleTypeEnum.PROJECT}/upload`, data, ContentTypeEnum.FORM_DATA) return res } catch { diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue index 3142541b..f79be187 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue @@ -281,10 +281,10 @@ const customRequest = (options: UploadCustomRequestOptions) => { const uploadRes = await uploadFile(uploadParams) if (uploadRes && uploadRes.code === ResultEnum.SUCCESS) { - if (uploadRes.data.httpurl) { + if (uploadRes.data.fileurl) { chartEditStore.setEditCanvasConfig( EditCanvasConfigEnum.BACKGROUND_IMAGE, - `${uploadRes.data.httpurl}?time=${new Date().getTime()}` + `${uploadRes.data.fileurl}?time=${new Date().getTime()}` ) } else { chartEditStore.setEditCanvasConfig( diff --git a/src/views/chart/hooks/useSync.hook.ts b/src/views/chart/hooks/useSync.hook.ts index 8aa67c7f..1d8fdbd4 100644 --- a/src/views/chart/hooks/useSync.hook.ts +++ b/src/views/chart/hooks/useSync.hook.ts @@ -294,10 +294,10 @@ export const useSync = () => { const uploadRes = await uploadFile(uploadParams) // 保存预览图 if(uploadRes && uploadRes.code === ResultEnum.SUCCESS) { - if (uploadRes.data.httpurl) { + if (uploadRes.data.fileurl) { await updateProjectApi({ id: fetchRouteParamsLocation(), - indexImage: `${uploadRes.data.httpurl}` + indexImage: `${uploadRes.data.fileurl}` }) } else { await updateProjectApi({