diff --git a/README.md b/README.md index f6b66ba..afdfbed 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # open-JSD-9152 -平台样式修改 \ No newline at end of file +平台样式修改\ +免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ +仅作为开发者学习参考使用!禁止用于任何商业用途!\ +为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。 \ No newline at end of file diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..82dbe67 --- /dev/null +++ b/plugin.xml @@ -0,0 +1,25 @@ + + com.fr.plugin.JSD4731 + + yes + 1.0.8 + 10.0 + 2018-07-31 + fr.open + + + com.fr.plugin.hwWeb + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/hwWeb/bean/ThemeWebResourceProvider.java b/src/main/java/com/fr/plugin/hwWeb/bean/ThemeWebResourceProvider.java new file mode 100644 index 0000000..6dc79c6 --- /dev/null +++ b/src/main/java/com/fr/plugin/hwWeb/bean/ThemeWebResourceProvider.java @@ -0,0 +1,35 @@ +package com.fr.plugin.hwWeb.bean; + +import com.fr.decision.fun.impl.AbstractWebResourceProvider; +import com.fr.decision.web.MainComponent; +import com.fr.plugin.transform.FunctionRecorder; +import com.fr.web.struct.Atom; +import com.fr.web.struct.Component; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; + +/** + * Created by zhouping on 2019/1/16. + */ +@FunctionRecorder +public class ThemeWebResourceProvider extends AbstractWebResourceProvider { + @Override + public Atom attach() { + return MainComponent.KEY; + } + + @Override + public Atom client() { + return new Component() { + @Override + public ScriptPath script(RequestClient requestClient) { + return ScriptPath.build("/com/fr/plugin/hwWeb/js/hw.js"); + } + @Override + public StylePath style(RequestClient requestClient) { + return StylePath.build("/com/fr/plugin/hwWeb/css/hw.css"); + } + }; + } +} diff --git a/src/main/java/com/fr/plugin/hwWeb/bean/simple/DemoInitializeMonitor.java b/src/main/java/com/fr/plugin/hwWeb/bean/simple/DemoInitializeMonitor.java new file mode 100644 index 0000000..bcd71af --- /dev/null +++ b/src/main/java/com/fr/plugin/hwWeb/bean/simple/DemoInitializeMonitor.java @@ -0,0 +1,23 @@ +package com.fr.plugin.hwWeb.bean.simple; + + +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.hwWeb.bean.simple.account.PluginSimpleConfig; +import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2018-12-04 + */ +public class DemoInitializeMonitor extends AbstractPluginLifecycleMonitor { + @Override + public void afterRun(PluginContext pluginContext) { + PluginSimpleConfig.getInstance(); + } + + @Override + public void beforeStop(PluginContext pluginContext) { + + } +} diff --git a/src/main/java/com/fr/plugin/hwWeb/bean/simple/PluginInitializeFilterBridge.java b/src/main/java/com/fr/plugin/hwWeb/bean/simple/PluginInitializeFilterBridge.java new file mode 100644 index 0000000..efc7936 --- /dev/null +++ b/src/main/java/com/fr/plugin/hwWeb/bean/simple/PluginInitializeFilterBridge.java @@ -0,0 +1,24 @@ +package com.fr.plugin.hwWeb.bean.simple; + + +import com.fr.decision.fun.impl.AbstractEmbedRequestFilterProvider; +import com.fr.plugin.hwWeb.bean.simple.account.PluginSimpleConfig; + +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class PluginInitializeFilterBridge extends AbstractEmbedRequestFilterProvider { + + @Override + public void init(FilterConfig filterConfig) { + PluginSimpleConfig.getInstance(); + } + + @Override + public void filter(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException, ServletException { + + } +} diff --git a/src/main/java/com/fr/plugin/hwWeb/bean/simple/PluginLocaleFinderBridge.java b/src/main/java/com/fr/plugin/hwWeb/bean/simple/PluginLocaleFinderBridge.java new file mode 100644 index 0000000..35cd82d --- /dev/null +++ b/src/main/java/com/fr/plugin/hwWeb/bean/simple/PluginLocaleFinderBridge.java @@ -0,0 +1,10 @@ +package com.fr.plugin.hwWeb.bean.simple; + +import com.fr.stable.fun.impl.AbstractLocaleFinder; + +public class PluginLocaleFinderBridge extends AbstractLocaleFinder { + @Override + public String find() { + return "conf"; + } +} diff --git a/src/main/java/com/fr/plugin/hwWeb/bean/simple/account/PluginSimpleConfig.java b/src/main/java/com/fr/plugin/hwWeb/bean/simple/account/PluginSimpleConfig.java new file mode 100644 index 0000000..f9dda71 --- /dev/null +++ b/src/main/java/com/fr/plugin/hwWeb/bean/simple/account/PluginSimpleConfig.java @@ -0,0 +1,63 @@ +package com.fr.plugin.hwWeb.bean.simple.account; + +import com.fr.config.ConfigContext; +import com.fr.config.DefaultConfiguration; +import com.fr.config.Identifier; +import com.fr.config.Status; +import com.fr.config.Visualization; +import com.fr.config.holder.Conf; +import com.fr.config.holder.factory.Holders; +import com.fr.intelli.record.Focus; +import com.fr.intelli.record.Original; +import com.fr.record.analyzer.EnableMetrics; +import com.fr.stable.StringUtils; + +@Visualization(category = "Plugin-Config_Group") +@EnableMetrics +public class PluginSimpleConfig extends DefaultConfiguration { + + private static volatile PluginSimpleConfig config = null; + + @Focus(id="com.fr.plugin.hwWeb.bean.com.fr.plugin.bsSSO.bean.simple", text = "平台样式配置", source = Original.PLUGIN) + public static PluginSimpleConfig getInstance() { + if (config == null) { + config = ConfigContext.getConfigInstance(PluginSimpleConfig.class); + } + return config; + } + + @Identifier(value = "homePage", name = "homePage", description = "主页", status = Status.SHOW) + private Conf homePage = Holders.simple("https://xxxx"); + + @Identifier(value = "helpPage", name = "helpPage", description = "帮助文档地址", status = Status.SHOW) + private Conf helpPage = Holders.simple("https://xxxx"); + + public String getHomePage() { + return homePage.get(); + } + + public void setHomePage(String url) { + this.homePage.set(url); + } + + public String getHelpPage() { + return helpPage.get(); + } + + public void setHelpPage(String url) { + this.helpPage.set(url); + } + + + + @Override + public Object clone() throws CloneNotSupportedException { + PluginSimpleConfig cloned = (PluginSimpleConfig) super.clone(); +// cloned.text = (Conf) text.clone(); +// cloned.count = (Conf) count.clone(); +// cloned.price = (Conf) price.clone(); +// cloned.time = (Conf) time.clone(); +// cloned.student = (Conf) student.clone(); + return cloned; + } +} diff --git a/src/main/java/com/fr/plugin/hwWeb/handler/ExtendAttrHandlerProvider.java b/src/main/java/com/fr/plugin/hwWeb/handler/ExtendAttrHandlerProvider.java new file mode 100644 index 0000000..051f6a0 --- /dev/null +++ b/src/main/java/com/fr/plugin/hwWeb/handler/ExtendAttrHandlerProvider.java @@ -0,0 +1,13 @@ +package com.fr.plugin.hwWeb.handler; + +import com.fr.decision.fun.HttpHandler; +import com.fr.decision.fun.impl.AbstractHttpHandlerProvider; + +public class ExtendAttrHandlerProvider extends AbstractHttpHandlerProvider { + @Override + public HttpHandler[] registerHandlers() { + return new HttpHandler[]{ + new GetInfoHandler() + }; + } +} diff --git a/src/main/java/com/fr/plugin/hwWeb/handler/GetInfoHandler.java b/src/main/java/com/fr/plugin/hwWeb/handler/GetInfoHandler.java new file mode 100644 index 0000000..45e072a --- /dev/null +++ b/src/main/java/com/fr/plugin/hwWeb/handler/GetInfoHandler.java @@ -0,0 +1,41 @@ +package com.fr.plugin.hwWeb.handler; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.hwWeb.bean.simple.account.PluginSimpleConfig; +import com.fr.plugin.hwWeb.utils.ResponseUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class GetInfoHandler extends BaseHttpHandler { + + public GetInfoHandler() { + } + + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/getInfo"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + PluginSimpleConfig psc = PluginSimpleConfig.getInstance(); + + String result = psc.getHomePage()+","+psc.getHelpPage(); + + ResponseUtils.successResponse(res,result); + } +} + diff --git a/src/main/java/com/fr/plugin/hwWeb/handler/URLAliasProvide.java b/src/main/java/com/fr/plugin/hwWeb/handler/URLAliasProvide.java new file mode 100644 index 0000000..5f5fef2 --- /dev/null +++ b/src/main/java/com/fr/plugin/hwWeb/handler/URLAliasProvide.java @@ -0,0 +1,14 @@ +package com.fr.plugin.hwWeb.handler; + +import com.fr.decision.fun.impl.AbstractURLAliasProvider; +import com.fr.decision.webservice.url.alias.URLAlias; +import com.fr.decision.webservice.url.alias.URLAliasFactory; + +public class URLAliasProvide extends AbstractURLAliasProvider { + @Override + public URLAlias[] registerAlias() { + return new URLAlias[]{ + URLAliasFactory.createPluginAlias("/getInfo","/getInfo",true), + }; + } +} diff --git a/src/main/java/com/fr/plugin/hwWeb/utils/ResponseUtils.java b/src/main/java/com/fr/plugin/hwWeb/utils/ResponseUtils.java new file mode 100644 index 0000000..bb781a6 --- /dev/null +++ b/src/main/java/com/fr/plugin/hwWeb/utils/ResponseUtils.java @@ -0,0 +1,39 @@ +package com.fr.plugin.hwWeb.utils; + +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; + +public class ResponseUtils { + private static final int SUCCESS = 200; + private static final int FAILED = -1; + + public static void successResponse(HttpServletResponse res, String body) { + response(res, body, SUCCESS); + } + + public static void failedResponse(HttpServletResponse res, String body) { + response(res, body, FAILED); + } + + private static void response(HttpServletResponse res, String body, int code) { + JSONObject object = new JSONObject(); + PrintWriter pw; + try { + object.put("code", code); + object.put("data", body); + pw = WebUtils.createPrintWriter(res); + } catch (Exception e) { + FineLoggerFactory.getLogger().info(e.getMessage()); + return; + } + res.setContentType("application/json;charset=utf-8"); + String result = object.toString(); + pw.println(result); + pw.flush(); + pw.close(); + } +} diff --git a/src/main/resources/com/fr/plugin/hwWeb/css/hw.css b/src/main/resources/com/fr/plugin/hwWeb/css/hw.css new file mode 100644 index 0000000..cbc88e3 --- /dev/null +++ b/src/main/resources/com/fr/plugin/hwWeb/css/hw.css @@ -0,0 +1,4 @@ +.hw{ + background-color:rgb(33,33,33) + !important; +} \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/hwWeb/image/head.png b/src/main/resources/com/fr/plugin/hwWeb/image/head.png new file mode 100644 index 0000000..39e50ab Binary files /dev/null and b/src/main/resources/com/fr/plugin/hwWeb/image/head.png differ diff --git a/src/main/resources/com/fr/plugin/hwWeb/image/help.png b/src/main/resources/com/fr/plugin/hwWeb/image/help.png new file mode 100644 index 0000000..697dcae Binary files /dev/null and b/src/main/resources/com/fr/plugin/hwWeb/image/help.png differ diff --git a/src/main/resources/com/fr/plugin/hwWeb/image/home.png b/src/main/resources/com/fr/plugin/hwWeb/image/home.png new file mode 100644 index 0000000..54ea761 Binary files /dev/null and b/src/main/resources/com/fr/plugin/hwWeb/image/home.png differ diff --git a/src/main/resources/com/fr/plugin/hwWeb/image/search.png b/src/main/resources/com/fr/plugin/hwWeb/image/search.png new file mode 100644 index 0000000..66d6a27 Binary files /dev/null and b/src/main/resources/com/fr/plugin/hwWeb/image/search.png differ diff --git a/src/main/resources/com/fr/plugin/hwWeb/js/hw.js b/src/main/resources/com/fr/plugin/hwWeb/js/hw.js new file mode 100644 index 0000000..f13f355 --- /dev/null +++ b/src/main/resources/com/fr/plugin/hwWeb/js/hw.js @@ -0,0 +1,333 @@ +//主页 +var homePage = "" +//帮助文档地址 +var helpPage = "" + +function getInfo(){ + $.ajax({ + type:"GET", + async:false, + url:"/webroot/decision/url/getInfo", + success:function(data){ + var info = data.data; + var infos = info.split(","); + homePage = infos[0]; + helpPage = infos[1]; + }, + error:function(data){ + + } + }) +} + +BI.constant("dec.constant.header.items", [ + { + type: "dec.account" + } +]) + +var c4 = BI.inherit(BI.BasicButton, { + + mounted: function () {}, + render: function () { + getInfo(); + return { + type: "bi.center_adapt", + items:[{type: "bi.img", + $testId: "dec-header-logo", + src: "/webroot/decision/resources?path=/com/fr/plugin/hwWeb/image/help.png", + + height: 15, + width: "auto", + ref: function (e) { + // t.logoImg = e + }}]} + } +}); + +BI.shortcut("dec.imgButtion4", c4); + +var e = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-header-account", + $testId: "dec-header-account" + }, + _store: function () { + return BI.Models.getModel("dec.model.account") + }, + watch: { + displayName: function (e) { + this.showName.setText(e) + } + }, + render: function () { + var t = this, + e = (this.options, { + type: "bi.vertical", + items: BI.createItems(BI.Constants.getConstant("dec.constant.account.items"), { + textAlign: "left", + cls: "bi-list-item", + height: 24, + hgap: 10, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + t.combo.hideView() + } + } + ] + }) + }); + return { + type: "bi.combo", + ref: function (e) { + t.combo = e + }, + trigger: "click-hover", + direction: "bottom,left", + adjustXOffset: 0, + el: { + type: "bi.vertical_adapt", + cls: "cursor-pointer dec-frame-header-account", + items: [ + { + type: "bi.img", + $testId: "dec-header-logo", + src: "/webroot/decision/resources?path=/com/fr/plugin/hwWeb/image/head.png", + + height: 15, + width: "auto", + ref: function (e) { + t.logoImg = e + } + }, + { + el: { + type: "bi.label", + cls: "dec-header-account-username dec-frame-text dec-frame-alpha-80", + text: this.model.displayName, + ref: function (e) { + t.showName = e + } + } + }, { + el: { + type: "bi.icon_change_button", + ref: function (e) { + t.arrowButton = e + }, + cls: "account-arrow-trigger dec-frame-icon dec-frame-alpha-50", + iconCls: "account-down-arrow-font" + } + } + ], + height: 40, + hgap: 5 + }, + popup: { + el: e, + innerVGap: 5, + stopPropagation: !0, + minWidth: 125 + }, + listeners: [{ + eventName: "EVENT_AFTER_POPUPVIEW", + action: function () { + t.arrowButton.setIcon("account-up-arrow-font") + } + }, { + eventName: "EVENT_AFTER_HIDEVIEW", + action: function () { + t.arrowButton.setIcon("account-down-arrow-font") + } + } + ] + } + }, + _resize: function () { + this.combo.adjustWidth(), + this.combo.adjustHeight() + } +}); +BI.shortcut("dec.account", e) + +var c = BI.inherit(BI.BasicButton, { + + mounted: function () {}, + render: function () { + return { + type: "bi.center_adapt", + items:[{type: "bi.img", + $testId: "dec-header-logo", + // src: BI.isEmpty(Dec.platformStyles.logoImgId) ? Dec.resourceURL + "resources/logo_FR_white.png" : Dec.fineServletURL + "/v10/attach/image/" + Dec.platformStyles.logoImgId, + src: "/webroot/img/title.png", + height: 25, + width: "auto", + }]} + + } +}); + +BI.shortcut("dec.imgButtion", c); + +var c2 = BI.inherit(BI.BasicButton, { + _store: function () { + return BI.Models.getModel("dec.model.frame.header") + + // return BI.Stores.getStore("dec.store.header") + }, + mounted: function () {}, + render: function () { + return { + type: "bi.label", + $testId: "dec-header-platform-title", + ref: function (e) { + // t.title = e + }, + textAlign: "left", + height: 40, + lgap: this.model.headerType === DecCst.PlatformStyle.HeaderType.INTEGRATED ? 0 : 15, + cls: "dec-banner dec-frame-text", + // text: this.model.platformTitle + text: "丨 NetEco" + } + + } +}); + +BI.shortcut("dec.imgButtion2", c2); + +var c3 = BI.inherit(BI.BasicButton, { + + mounted: function () {}, + render: function () { + return { + type: "bi.center_adapt", + items:[{type: "bi.img", + $testId: "dec-header-logo", + src: "/webroot/decision/resources?path=/com/fr/plugin/hwWeb/image/home.png", + height: 15, + width: "auto", + // lgap: 40, + ref: function (e) { + // t.logoImg = e + } + }]} + + } +}); + +BI.shortcut("dec.imgButtion3", c3); + +var e = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-card hw dec-frame-header", + $testId: "dec-frame-header", + height: 40 + }, + _store: function () { + return BI.Models.getModel("dec.model.frame.header") + + // return BI.Stores.getStore("dec.store.header") + // return BI.Stores.getStore("dec.model.frame.header"); + }, + watch: { + platformTitle: function (e) { + this.title.setText(e) + }, + headerType: function () { + this.logoContainer.populate(this._assertLogo()), + this._resizeWrapper() + }, + headerLogoId: function (e) { + this.logoImg.setSrc(Dec.fineServletURL + "/v10/attach/image/" + e) + } + }, + render: function () { + var t = this, + e = BI.Constants.getConstant("dec.constant.header.items"); + return { + type: "bi.absolute", + ref: function (e) { + t.headWrapper = e + }, + items: [{ + el: { + type: "bi.button_group", + items: this._assertLogo(), + layouts: [{ + type: "bi.vertical_adapt" + } + ], + ref: function (e) { + t.logoContainer = e + } + }, + top: 0, + bottom: 0, + left: 0 + }, { + el: { + type: "bi.right_vertical_adapt", + items: BI.createItems(e, {}, { + rgap: 15 + }) + }, + top: 0, + bottom: 0, + right: 35 + },{ + el: + { + type: "dec.imgButtion4", + handler:function(){ + window.open(helpPage,"_blank") + } + }, + top: 0, + bottom: 0, + right: 25 + } + ] + } + }, + created: function () { + BI.Services.getService("dec.service.main").registerGlobalComponent("Header", this) + }, + _assertLogo: function () { + var t = this, + // e = this.model.headerType === DecCst.PlatformStyle.HeaderType.INTEGRATED ? + e=""; + return [{ + el:{ + type:"dec.imgButtion", + width:'auto', + handler:function(){ + window.open(homePage,"_blank") + }}, + hgap: 5 + }, + { + type: "dec.imgButtion2", + handler:function(){ + window.open(homePage,"_blank") + } + }, + { + el: { + type: "dec.imgButtion3", + handler:function(){ + window.open(homePage,"_blank") + } + }, + hgap: 25, + } + ] + }, + _resizeWrapper: function () { + this.headWrapper.attr("items")[1].left = 1 === this.model.headerType ? 70 : 50, + this.headWrapper.resize() + } +}); + +BI.shortcut("dec.header", e) \ No newline at end of file