diff --git a/src/api/path/project.api.ts b/src/api/path/project.api.ts index 164df1d3..ee0001ba 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, + 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 79a6c916..f79be187 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.fileurl) { + chartEditStore.setEditCanvasConfig( + EditCanvasConfigEnum.BACKGROUND_IMAGE, + `${uploadRes.data.fileurl}?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..1d8fdbd4 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.fileurl) { + await updateProjectApi({ + id: fetchRouteParamsLocation(), + indexImage: `${uploadRes.data.fileurl}` + }) + } else { + await updateProjectApi({ + id: fetchRouteParamsLocation(), + indexImage: `${systemStore.getFetchInfo.OSSUrl}${uploadRes.data.fileName}` + }) + } } } } catch (e) { 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'),