Browse Source

提交开源任务材料

10.0
LAPTOP-SB56SG4Q\86185 3 years ago
parent
commit
3dbfbb6b67
  1. 5
      README.md
  2. 25
      plugin.xml
  3. 35
      src/main/java/com/fr/plugin/hwWeb/bean/ThemeWebResourceProvider.java
  4. 23
      src/main/java/com/fr/plugin/hwWeb/bean/simple/DemoInitializeMonitor.java
  5. 24
      src/main/java/com/fr/plugin/hwWeb/bean/simple/PluginInitializeFilterBridge.java
  6. 10
      src/main/java/com/fr/plugin/hwWeb/bean/simple/PluginLocaleFinderBridge.java
  7. 63
      src/main/java/com/fr/plugin/hwWeb/bean/simple/account/PluginSimpleConfig.java
  8. 13
      src/main/java/com/fr/plugin/hwWeb/handler/ExtendAttrHandlerProvider.java
  9. 41
      src/main/java/com/fr/plugin/hwWeb/handler/GetInfoHandler.java
  10. 14
      src/main/java/com/fr/plugin/hwWeb/handler/URLAliasProvide.java
  11. 39
      src/main/java/com/fr/plugin/hwWeb/utils/ResponseUtils.java
  12. 4
      src/main/resources/com/fr/plugin/hwWeb/css/hw.css
  13. BIN
      src/main/resources/com/fr/plugin/hwWeb/image/head.png
  14. BIN
      src/main/resources/com/fr/plugin/hwWeb/image/help.png
  15. BIN
      src/main/resources/com/fr/plugin/hwWeb/image/home.png
  16. BIN
      src/main/resources/com/fr/plugin/hwWeb/image/search.png
  17. 333
      src/main/resources/com/fr/plugin/hwWeb/js/hw.js

5
README.md

@ -1,3 +1,6 @@
# open-JSD-9152
平台样式修改
平台样式修改\
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\
仅作为开发者学习参考使用!禁止用于任何商业用途!\
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。

25
plugin.xml

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin>
<id>com.fr.plugin.JSD4731</id>
<name><![CDATA[平台样式]]></name>
<active>yes</active>
<version>1.0.8</version>
<env-version>10.0</env-version>
<jartime>2018-07-31</jartime>
<vendor>fr.open</vendor>
<description><![CDATA[平台样式]]></description>
<change-notes><![CDATA[
]]></change-notes>
<main-package>com.fr.plugin.hwWeb</main-package>
<extra-core>
<LocaleFinder class="com.fr.plugin.hwWeb.bean.simple.PluginLocaleFinderBridge"/>
</extra-core>
<lifecycle-monitor class="com.fr.plugin.hwWeb.bean.simple.DemoInitializeMonitor"/>
<extra-decision>
<WebResourceProvider class="com.fr.plugin.hwWeb.bean.ThemeWebResourceProvider"/>
<HttpHandlerProvider class="com.fr.plugin.hwWeb.handler.ExtendAttrHandlerProvider"/>
<URLAliasProvider class="com.fr.plugin.hwWeb.handler.URLAliasProvide"/>
</extra-decision>
<function-recorder class="com.fr.plugin.hwWeb.bean.simple.account.PluginSimpleConfig"/>
</plugin>

35
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");
}
};
}
}

23
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) {
}
}

24
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 {
}
}

10
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";
}
}

63
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<String> homePage = Holders.simple("https://xxxx");
@Identifier(value = "helpPage", name = "helpPage", description = "帮助文档地址", status = Status.SHOW)
private Conf<String> 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<String>) text.clone();
// cloned.count = (Conf<Integer>) count.clone();
// cloned.price = (Conf<Double>) price.clone();
// cloned.time = (Conf<Long>) time.clone();
// cloned.student = (Conf<Boolean>) student.clone();
return cloned;
}
}

13
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()
};
}
}

41
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);
}
}

14
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),
};
}
}

39
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();
}
}

4
src/main/resources/com/fr/plugin/hwWeb/css/hw.css

@ -0,0 +1,4 @@
.hw{
background-color:rgb(33,33,33)
!important;
}

BIN
src/main/resources/com/fr/plugin/hwWeb/image/head.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
src/main/resources/com/fr/plugin/hwWeb/image/help.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
src/main/resources/com/fr/plugin/hwWeb/image/home.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
src/main/resources/com/fr/plugin/hwWeb/image/search.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

333
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)
Loading…
Cancel
Save