Merge branch 'master-fetch-dev' into master-fetch
This commit is contained in:
commit
8809022e8c
@ -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 {
|
||||
|
@ -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('添加图片失败,请稍后重试!')
|
||||
|
@ -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) {
|
||||
|
@ -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'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user