From 7f1ad2133eea62cd09fa1694cd4e2eca94245037 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 19 Apr 2022 18:32:34 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=8E=86=E5=8F=B2=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E6=9D=BF=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=B6=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=BD=BF=E7=94=A8=E6=9C=80=E9=AB=98=E7=9A=84=E7=9F=A9?= =?UTF-8?q?=E9=98=B5=E5=AF=86=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/canvas/utils/utils.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/canvas/utils/utils.js b/frontend/src/components/canvas/utils/utils.js index 36ee87230e..223869fa6b 100644 --- a/frontend/src/components/canvas/utils/utils.js +++ b/frontend/src/components/canvas/utils/utils.js @@ -72,10 +72,6 @@ export function panelInit(componentData, componentStyle) { componentStyle.refreshViewLoading = (componentStyle.refreshViewLoading || false) componentStyle.refreshUnit = (componentStyle.refreshUnit || 'minute') componentStyle.aidedDesign = (componentStyle.aidedDesign || deepCopy(AIDED_DESIGN)) - // // // 初始化密度为最高密度 - // const matrixChange = 2 / componentStyle.aidedDesign.matrixBase - // componentStyle.aidedDesign.matrixBase = 2 - componentData.forEach((item, index) => { if (item.component && item.component === 'de-date') { if (item.options.attrs && @@ -98,11 +94,20 @@ export function panelInit(componentData, componentStyle) { item.y = (item.y || 1) item.sizex = (item.sizex || 5) item.sizey = (item.sizey || 5) + // 初始化密度为最高密度 + if (componentStyle.aidedDesign.matrixBase !== 4) { + item.x = (item.x - 1) * componentStyle.aidedDesign.matrixBase + 1 + item.y = (item.y - 1) * componentStyle.aidedDesign.matrixBase + 1 + item.sizex = item.sizex * componentStyle.aidedDesign.matrixBase + item.sizey = item.sizey * componentStyle.aidedDesign.matrixBase + } item.mobileSelected = (item.mobileSelected || false) item.mobileStyle = (item.mobileStyle || deepCopy(BASE_MOBILE_STYLE)) item.hyperlinks = (item.hyperlinks || deepCopy(HYPERLINKS)) item.commonBackground = item.commonBackground || deepCopy(COMMON_BACKGROUND_NONE) }) + // 初始化密度为最高密度 + componentStyle.aidedDesign.matrixBase = 4 // 将data 和 style 数据设置到全局store中 store.commit('setComponentData', resetID(componentData)) store.commit('setCanvasStyle', componentStyle)