Browse Source

提交开源任务材料

master
LAPTOP-SB56SG4Q\86185 2 years ago
parent
commit
1e4e595deb
  1. 5
      README.md
  2. 24
      plugin.xml
  3. 16
      src/main/java/com/fr/plugin/CULifeCycleMonitor.java
  4. 56
      src/main/java/com/fr/plugin/CustomHeaderHeightComponent.java
  5. 38
      src/main/java/com/fr/plugin/CustomHeaderHeightConfig.java
  6. 37
      src/main/java/com/fr/plugin/CustomHeaderHeightJS.java
  7. 34
      src/main/java/com/fr/plugin/HeaderHeightJSHandler.java
  8. 16
      src/main/resources/com/fr/plugin/web/customHeightweb.js
  9. 0
      src/main/resources/com/fr/plugin/web/local/thi.properties
  10. 4556
      src/main/resources/com/fr/plugin/web/local/thi_th_TH.properties
  11. 0
      src/main/resources/com/fr/plugin/web/webbuy.js

5
README.md

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

24
plugin.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plugin>
<id>com.eco.plugin.xxxx.custom.header.height</id>
<name><![CDATA[header高度自定义插件]]></name>
<active>yes</active>
<version>1.0.0</version>
<env-version>10.0</env-version>
<jartime>2020-03-10</jartime>
<vendor>fr.open</vendor>
<description><![CDATA[header高度自定义插件]]></description>
<function-recorder class="com.fr.plugin.HeaderHeightJSHandler"/>
<lifecycle-monitor class="com.fr.plugin.CULifeCycleMonitor"/>
<change-notes>
<![CDATA[
<p>[2019-6-19]项目启动</p>
]]>
</change-notes>
<main-package>com.fr.plugin</main-package>
<extra-decision>
<WebResourceProvider class="com.fr.plugin.HeaderHeightJSHandler"/>
</extra-decision>
</plugin>

16
src/main/java/com/fr/plugin/CULifeCycleMonitor.java

@ -0,0 +1,16 @@
package com.fr.plugin;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor;
public class CULifeCycleMonitor extends AbstractPluginLifecycleMonitor {
@Override
public void afterRun(PluginContext pluginContext) {
CustomHeaderHeightConfig.getInstance();
}
@Override
public void beforeStop(PluginContext pluginContext) {
}
}

56
src/main/java/com/fr/plugin/CustomHeaderHeightComponent.java

@ -0,0 +1,56 @@
package com.fr.plugin;
import com.fr.plugin.context.PluginContexts;
import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.web.struct.Component;
import com.fr.web.struct.Filter;
import com.fr.web.struct.browser.RequestClient;
import com.fr.web.struct.category.FileType;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.category.StylePath;
@FunctionRecorder()
public class CustomHeaderHeightComponent extends Component {
public static final CustomHeaderHeightComponent KEY = new CustomHeaderHeightComponent();
/**
* 返回需要引入的JS脚本路径
* @param client 请求客户端描述
* @return JS脚本路径
*/
@ExecuteFunctionRecord
public ScriptPath script( RequestClient client ) {
if (PluginContexts.currentContext().isAvailable()) {
// 做认证通过的事情
return ScriptPath.build("com.fr.plugin.CustomHeaderHeightJS", FileType.CLASS);
} else {
// 做认证未通过的事情
return ScriptPath.build("com/fr/plugin/web/webnuy.js");
}
}
/**
* 返回需要引入的CSS样式路径
* @param client 请求客户端描述
* @return CSS样式路径
*/
public StylePath style( RequestClient client ) {
//如果不需要就直接返回 StylePath.EMPTY;
return StylePath.EMPTY;
}
/**
* 通过给定的资源过滤器控制是否加载这个资源
* @return 资源过滤器
*/
public Filter filter() {
return new Filter(){
@Override
public boolean accept() {
//任何情况下我们都在平台组件加载时加载我们的组件
return true;
}
};
}
}

38
src/main/java/com/fr/plugin/CustomHeaderHeightConfig.java

@ -0,0 +1,38 @@
package com.fr.plugin;
import com.fr.config.*;
import com.fr.config.holder.Conf;
import com.fr.config.holder.factory.Holders;
@Visualization(category = "自定义Header高度配置")
public class CustomHeaderHeightConfig extends DefaultConfiguration {
private static volatile CustomHeaderHeightConfig config = null;
public static CustomHeaderHeightConfig getInstance() {
if (config == null) {
config = ConfigContext.getConfigInstance(CustomHeaderHeightConfig.class);
}
return config;
}
@Identifier(value = "customHeight", name = "高度(px)", description = "直接输入数字,修改后需要清空缓存", status = Status.SHOW)
private Conf<Integer> customHeight = Holders.simple(60);
public Integer getCustomHeight() {
return customHeight.get();
}
public void setCustomHeight(Integer customHeight) {
this.customHeight.set(customHeight);
}
@Override
public Object clone() throws CloneNotSupportedException {
CustomHeaderHeightConfig cloned = (CustomHeaderHeightConfig) super.clone();
cloned.customHeight = (Conf<Integer>) customHeight.clone();
return cloned;
}
}

37
src/main/java/com/fr/plugin/CustomHeaderHeightJS.java

@ -0,0 +1,37 @@
package com.fr.plugin;
import com.fr.base.TemplateUtils;
import com.fr.gen.TextGenerator;
import com.fr.plugin.context.PluginContexts;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
public class CustomHeaderHeightJS implements TextGenerator {
public String text(HttpServletRequest req, HttpServletResponse res) throws Exception {
Map<String, Object> renderMap = new HashMap();
CustomHeaderHeightConfig instance = CustomHeaderHeightConfig.getInstance();
Integer height = instance.getCustomHeight();
renderMap.put("height", height);
if (PluginContexts.currentContext().isAvailable()) {
// 做认证通过的事情
return TemplateUtils.renderTemplate(this.template(), renderMap);
} else {
// 做认证未通过的事情
return TemplateUtils.renderTemplate("/com/fr/plugin/scanBuy.tpl", renderMap);
}
}
public String mimeType() {
return "text/javascript";
}
public String template() {
return "/com/fr/plugin/web/customHeightweb.js";
}
}

34
src/main/java/com/fr/plugin/HeaderHeightJSHandler.java

@ -0,0 +1,34 @@
package com.fr.plugin;
import com.fr.decision.fun.impl.AbstractWebResourceProvider;
import com.fr.decision.web.MainComponent;
import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.stable.fun.Authorize;
import com.fr.web.struct.Atom;
@Authorize(callSignKey = "com.eco.plugin.zzl.custom.header.height" )
@FunctionRecorder
public class HeaderHeightJSHandler extends AbstractWebResourceProvider {
/**
* 需要附加到的主组件
*
* @return 主组件
*/
@Override
@ExecuteFunctionRecord
public Atom attach() {
return MainComponent.KEY;
}
/**
* 客户端所需的组件
*
* @return 组件
*/
@Override
public Atom client() {
return CustomHeaderHeightComponent.KEY;
}
}

16
src/main/resources/com/fr/plugin/web/customHeightweb.js

@ -0,0 +1,16 @@
;(function ($){
BI.config("dec.provider.layout", function (provider) {
var height=parseInt('${height}')
debugger
provider.inject({
layoutConfig: {
north: {
height: height,
invisible: false,
},
},
});
});
})(jQuery)

0
src/main/resources/com/fr/plugin/web/local/thi.properties

4556
src/main/resources/com/fr/plugin/web/local/thi_th_TH.properties

File diff suppressed because it is too large Load Diff

0
src/main/resources/com/fr/plugin/web/webbuy.js

Loading…
Cancel
Save