Commit b15ada0e4bbdb9cb953a7c914c22e16985cb5af7

Authored by 福福
Committed by xp.Huang
1 parent 48be4e64

Merge branch 'ww' into 'main_dev'

fix(background): 修复背景图片在预览模式下引用路径不正确

See merge request yunteng/thingskit-view!38

(cherry picked from commit e45d77c3)

4b2f2e04 fix(background): 修复背景图片在预览模式下引用路径不正确
@@ -177,6 +177,7 @@ const rangeStyle = computed(() => { @@ -177,6 +177,7 @@ const rangeStyle = computed(() => {
177 // : { background: `url(${backgroundImage}) no-repeat center center / cover !important` } 177 // : { background: `url(${backgroundImage}) no-repeat center center / cover !important` }
178 // THINGS_KIT 路径转换,同步生产环境与开发环境的保存的静态资源文件路径不一致 178 // THINGS_KIT 路径转换,同步生产环境与开发环境的保存的静态资源文件路径不一致
179 : { background: `url(${getBackgroundImagePath(backgroundImage!)}) no-repeat center center / cover !important` } 179 : { background: `url(${getBackgroundImagePath(backgroundImage!)}) no-repeat center center / cover !important` }
  180 + console.log(getBackgroundImagePath(backgroundImage!))
180 return { 181 return {
181 ...computedBackground, 182 ...computedBackground,
182 width: 'inherit', 183 width: 'inherit',
1 import { PickCreateComponentType } from '@/packages/index.d' 1 import { PickCreateComponentType } from '@/packages/index.d'
2 import { EditCanvasConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' 2 import { EditCanvasConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
  3 +/// THINGS_KIT 修改背景图片
  4 +import { useBackgroundSelect } from '@/utils/external/useBackgroundImageSelect'
3 5
4 type AttrType = PickCreateComponentType<'attr'> 6 type AttrType = PickCreateComponentType<'attr'>
5 type StatusType = PickCreateComponentType<'status'> 7 type StatusType = PickCreateComponentType<'status'>
@@ -41,13 +43,15 @@ export const getPreviewConfigStyle = (previewConfig: PreviewConfig) => { @@ -41,13 +43,15 @@ export const getPreviewConfigStyle = (previewConfig: PreviewConfig) => {
41 return previewStyle 43 return previewStyle
42 } 44 }
43 45
  46 +// THINGS_KIT 修改背景图片
  47 +const { getBackgroundImagePath } = useBackgroundSelect()
44 // 全局样式 48 // 全局样式
45 export const getEditCanvasConfigStyle = (canvas: EditCanvasConfigType) => { 49 export const getEditCanvasConfigStyle = (canvas: EditCanvasConfigType) => {
46 // 背景 50 // 背景
47 const computedBackground = canvas.selectColor 51 const computedBackground = canvas.selectColor
48 ? { background: canvas.background } 52 ? { background: canvas.background }
49 : { 53 : {
50 - background: `url(${canvas.backgroundImage}) center center / cover no-repeat !important` 54 + background: `url(${getBackgroundImagePath(canvas.backgroundImage as unknown as string)}) center center / cover no-repeat !important`
51 } 55 }
52 return { 56 return {
53 position: 'relative' as const, 57 position: 'relative' as const,