diff --git a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java index 92f02e39d..0efa324d7 100644 --- a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java +++ b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java @@ -2,7 +2,9 @@ package com.fr.design.update.push; import com.fr.design.dialog.UIDialog; import com.fr.design.ui.ModernUIPane; +import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.stable.StringUtils; import com.fr.web.struct.AssembleComponent; import com.fr.web.struct.Atom; import com.fr.web.struct.browser.RequestClient; @@ -19,7 +21,7 @@ import java.awt.Frame; * Created by plough on 2019/4/10. */ class DesignerPushUpdateDialog extends UIDialog { - public static final Dimension DEFAULT = new Dimension(640, 320); + public static final Dimension DEFAULT = new Dimension(640, 360); private ModernUIPane jsPane; @@ -111,8 +113,10 @@ class DesignerPushUpdateDialog extends UIDialog { this.content = content; } - public String getMoreInfoUrl() { - return moreInfoUrl; + public void browseMoreInfoUrl() { + if (StringUtils.isNotEmpty(moreInfoUrl)) { + BrowseUtils.browser(moreInfoUrl); + } } public void setMoreInfoUrl(String moreInfoUrl) { diff --git a/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css b/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css index e583a96aa..e50bf12a0 100644 --- a/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css +++ b/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css @@ -5,18 +5,56 @@ body { } .title { - font-size: 30px; + font-family: PingFangSC-Semibold; + font-size: 24px; + letter-spacing: 1.5px; + line-height: 24px; } + +.version { + font-family: PingFangSC-Semibold; + font-size: 12px; + line-height: 14px; + margin-top: 6px; +} + .desc { - margin-top: 35px; + margin-top: 40px; + font-family: PingFangSC-Regular; + font-size: 13px; + width: 540px; + margin-left: 19px; + text-indent: -19px; + overflow: visible !important; +} + +.desc .bi-label { + overflow: visible !important; } + .moreInfo { - margin-top: 15px; + margin-top: 20px; + font-family: PingFangSC-Regular; + font-size: 13px; + text-decoration: underline; } + .buttonGroup { - margin-top: 35px; + position: absolute !important; + bottom: 60px; } + +.buttonGroup .bi-button { + font-family: PingFangSC-Medium; + font-size: 11px; + text-align: center; + line-height: 12px; + box-shadow: 0 2px 4px 0 rgba(0,82,169,0.20); + border-radius: 12px; +} + .button-ignore { background-color: white !important; border: 1px solid white !important; + color: #51A6FF; } \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js b/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js index 722b3d3cd..a791e3ee4 100644 --- a/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js +++ b/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js @@ -1,9 +1,33 @@ +var MAX_DESC_NUM = 5; // 最多显示5条信息 + function i18nText(key) { return Pool.data.i18nText(key); } -window.addEventListener("load", function (ev) { - var title = BI.createWidget({ +function getDescArea(descList) { + var descItems = []; + for (var i in descList) { + var num = parseInt(i) + 1; + if (num > MAX_DESC_NUM) { + break; + } + descItems.push({ + type: "bi.label", + text: num + ")" + descList[i], + whiteSpace: "pre-wrap", + textAlign: "left" + }) + } + + return BI.createWidget({ + type: "bi.vertical", + cls: "desc", + items: descItems + }); +} + +function getTitleArea() { + return BI.createWidget({ type: "bi.vertical", items: [ { @@ -15,31 +39,15 @@ window.addEventListener("load", function (ev) { { type: "bi.label", text: Pool.data.getVersion(), + cls: "version", textAlign: "left" } ] }); +} - var desc = BI.createWidget({ - type: "bi.vertical", - cls: "desc", - items: [ - { - type: "bi.label", - text: Pool.data.getContent(), - textAlign: "left" - } - ] - }); - - var moreInfo = BI.createWidget({ - type: "bi.text_button", - text: i18nText("Fine-Design_Basic_More_Information"), - cls: "moreInfo", - textAlign: "left" - }); - - var buttonGroup = BI.createWidget({ +function getButtonGroup() { + return BI.createWidget({ type: 'bi.left', cls: "buttonGroup", items: [ @@ -47,8 +55,8 @@ window.addEventListener("load", function (ev) { type: 'bi.button', text: i18nText("Fine-Design_Update_Now"), level: 'common', - height: 30, - handler: function() { + height: 24, + handler: function () { Pool.data.updateNow(); } }, @@ -57,8 +65,8 @@ window.addEventListener("load", function (ev) { type: 'bi.button', text: i18nText("Fine-Design_Remind_Me_Next_Time"), level: 'ignore', - height: 30, - handler: function() { + height: 24, + handler: function () { Pool.data.remindNextTime(); } }, @@ -69,8 +77,8 @@ window.addEventListener("load", function (ev) { type: 'bi.button', text: i18nText("Fine-Design_Skip_This_Version"), level: 'ignore', - height: 30, - handler: function() { + height: 24, + handler: function () { Pool.data.skipThisVersion(); } }, @@ -78,17 +86,48 @@ window.addEventListener("load", function (ev) { } ] }); +} + +function getMoreInfo() { + return BI.createWidget({ + type: "bi.text_button", + text: i18nText("Fine-Design_See_More_New_Features"), + cls: "moreInfo", + textAlign: "left", + handler: function () { + // 为了使用系统的浏览器,只能从 Java 那边打开网页 + Pool.data.browseMoreInfoUrl(); + } + }); +} + +function getShowItems() { + var title = getTitleArea(); + + var descList = Pool.data.getContent().split("\n"); + var descArea = getDescArea(descList); + + var moreInfo = getMoreInfo(); + + var buttonGroup = getButtonGroup(); + + var showItems = [title, descArea]; + if (descList.length > MAX_DESC_NUM) { + showItems.push(moreInfo); + } + showItems.push(buttonGroup); + + return showItems; +} + +window.addEventListener("load", function (ev) { + var showItems = getShowItems(); var container = BI.createWidget({ type:"bi.vertical", element: "body", cls: "container", - items: [ - title, - desc, - moreInfo, - buttonGroup - ] + items: showItems }); container.element.css("background", "url(" + Pool.data.getBackgroundUrl() + ")"); diff --git a/designer-base/src/test/java/com/fr/design/update/push/DesignerPushUpdateDialogTest.java b/designer-base/src/test/java/com/fr/design/update/push/DesignerPushUpdateDialogTest.java index ae3edf150..f461a5804 100644 --- a/designer-base/src/test/java/com/fr/design/update/push/DesignerPushUpdateDialogTest.java +++ b/designer-base/src/test/java/com/fr/design/update/push/DesignerPushUpdateDialogTest.java @@ -13,7 +13,7 @@ public class DesignerPushUpdateDialogTest { JSONObject jo = JSONObject.create(); jo.put("version", "2019.03.06.04.02.43.6"); - jo.put("content", "test content"); + jo.put("content", "设计器改进:去除右击弹框,让操作过程更流畅;增加报表块缩放功能,利于从全局角度整体设计报表\n插件重构:插件支持热部署,即装即用,不再需要重启服务器;\nsapbw:可用于bwcube和bwquery;\n私有云认证:可在客户本地部署私有云认证服务器,业务服务器可到此服务器进行认证;\n开放:打通简道云,可以在简道云里创建项目,并将数据同步到客户的私有库\nshould not display"); jo.put("more", "http://baidu.com"); jo.put("background", "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1555043827901&di=fc266992abef5a7e13b4e0cb98975a75&imgtype=0&src=http%3A%2F%2Fi5.3conline.com%2Fimages%2Fpiclib%2F201203%2F20%2Fbatch%2F1%2F130280%2F1332249463721rez0li5fg0_medium.jpg"); DesignerUpdateInfo mockUpdateInfo = new DesignerUpdateInfo("111.22.11", "2211.231.1", "11.23.1", jo);