From 9ac71125e47308bd6f81187f95f4db35602e8428 Mon Sep 17 00:00:00 2001 From: Fay Date: Tue, 8 Oct 2019 15:09:32 +0800 Subject: [PATCH] =?UTF-8?q?BI-52775=20fix:=20=E7=A9=BA=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +---- plugin.xml | 2 +- .../com/finebi/plugin/web/plugin.screen_adaptive.js | 12 ++++++++++-- .../resources/com/finebi/plugin/web/scripts/entry.js | 12 ++++++++++-- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6598ca6..c2eddfb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ # BI模板自适应插件 -用户查看模板时可以选择自适应屏幕宽度的查看方式。 - -待解决问题: -1. IE下图表的弹出框错位 \ No newline at end of file +用户查看模板时可以选择自适应屏幕宽度的查看方式。 \ No newline at end of file diff --git a/plugin.xml b/plugin.xml index d4ce01a..fe840d4 100644 --- a/plugin.xml +++ b/plugin.xml @@ -3,7 +3,7 @@ com.finebi.plugin.screenadaptive yes - 1.1.30 + 1.1.31 10.0 2019-03-01 fay diff --git a/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js b/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js index 72abb68..39749e0 100644 --- a/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js +++ b/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js @@ -91,13 +91,21 @@ // 获取缩放倍数,原模板宽高 function getScaleBounds() { - var widgts = BI.designConfigure.widgets, + var widgets = BI.designConfigure.widgets, layoutRatio = BI.designConfigure.layoutRatio, freeLayoutRatio = BI.designConfigure.freeLayoutRatio, freeWidgets = BI.designConfigure.freeWidgetIds; + + if (Object.keys(widgets).length === 0) { + return { + scale: 1, + width: html.clientWidth, + height: html.clientHeight + } + } var left = null, right = null, top = null, bottom = null, freeLeft = null, freeRight = null, freeTop = null, freeBottom = null; - BI.each(widgts, function (wId, widget) { + BI.each(widgets, function (wId, widget) { var bounds = widget.bounds || {}; if (BI.contains(freeWidgets, wId)) { freeLeft = BI.isNull(freeLeft) ? bounds.left : Math.min(freeLeft, bounds.left); diff --git a/src/main/resources/com/finebi/plugin/web/scripts/entry.js b/src/main/resources/com/finebi/plugin/web/scripts/entry.js index 72abb68..39749e0 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -91,13 +91,21 @@ // 获取缩放倍数,原模板宽高 function getScaleBounds() { - var widgts = BI.designConfigure.widgets, + var widgets = BI.designConfigure.widgets, layoutRatio = BI.designConfigure.layoutRatio, freeLayoutRatio = BI.designConfigure.freeLayoutRatio, freeWidgets = BI.designConfigure.freeWidgetIds; + + if (Object.keys(widgets).length === 0) { + return { + scale: 1, + width: html.clientWidth, + height: html.clientHeight + } + } var left = null, right = null, top = null, bottom = null, freeLeft = null, freeRight = null, freeTop = null, freeBottom = null; - BI.each(widgts, function (wId, widget) { + BI.each(widgets, function (wId, widget) { var bounds = widget.bounds || {}; if (BI.contains(freeWidgets, wId)) { freeLeft = BI.isNull(freeLeft) ? bounds.left : Math.min(freeLeft, bounds.left);