refactor: 样式设置缩略图增加分类部署读取方式

This commit is contained in:
wangjiahao 2022-08-31 16:56:34 +08:00
parent d86a9b46f1
commit 193423bb98
2 changed files with 6 additions and 4 deletions

View File

@ -132,7 +132,7 @@
import { queryBackground } from '@/api/background/background'
import BackgroundItem from '@/views/background/BackgroundItem'
import { mapState } from 'vuex'
import { deepCopy } from '@/components/canvas/utils/utils'
import {deepCopy, imgUrlTrans} from '@/components/canvas/utils/utils'
import { COLOR_PANEL } from '@/views/chart/chart/chart'
import { uploadFileResult } from '@/api/staticResource/staticResource'
import { COMMON_BACKGROUND_NONE } from '@/components/canvas/custom-component/component-list'
@ -171,7 +171,7 @@ export default {
methods: {
init() {
if (this.curComponent && this.curComponent.commonBackground && this.curComponent.commonBackground.outerImage && typeof (this.curComponent.commonBackground.outerImage) === 'string') {
this.fileList.push({ url: this.curComponent.commonBackground.outerImage })
this.fileList.push({ url: imgUrlTrans(this.curComponent.commonBackground.outerImage) })
}
this.backgroundOrigin = deepCopy(this.curComponent.commonBackground ? this.curComponent.commonBackground : COMMON_BACKGROUND_NONE)
this.queryBackground()

View File

@ -52,6 +52,8 @@ import { mapState } from 'vuex'
import { deepCopy } from '@/components/canvas/utils/utils'
import { COLOR_PANEL } from '@/views/chart/chart/chart'
import { uploadFileResult } from '@/api/staticResource/staticResource'
import {imgUrlTrans} from "@/components/canvas/utils/utils";
export default {
name: 'BackgroundSelector',
@ -77,7 +79,7 @@ export default {
//
this.panel = this.canvasStyleData.panel
if (this.panel.imageUrl && typeof (this.panel.imageUrl) === 'string') {
this.fileList.push({ url: this.panel.imageUrl })
this.fileList.push({ url: imgUrlTrans(this.panel.imageUrl) })
}
},
methods: {
@ -111,7 +113,7 @@ export default {
uploadFileResult(file.file, (fileUrl) => {
_this.$store.commit('canvasChange')
_this.panel.imageUrl = fileUrl
_this.fileList = [{ url: this.panel.imageUrl }]
_this.fileList = [{ url: imgUrlTrans(this.panel.imageUrl) }]
_this.commitStyle()
})
},