48 changed files with 415 additions and 73 deletions
@ -1,7 +1,11 @@ |
|||
window.APP = {}; // 在浏览器 window 对象中新建名为 APP 的变量, 用于存放应用对象的容器
|
|||
window.APP.configure ={ // 全局配置存储容器
|
|||
webContextPath: '[(@{/})]'.startsWith('[')? '/' : '[(@{/})]', // 应用上下文路径
|
|||
// 在浏览器 window 对象中新建名为 APP 的容器变量, 用于存放平台的全局变量
|
|||
window.APP = {}; |
|||
// 全局配置
|
|||
window.APP.configure ={ |
|||
// 应用上下文路径
|
|||
webContextPath: '[(@{/})]'.startsWith('[')? '/' : '[(@{/})]', |
|||
// 默认后端 API 请求的服务地址前缀
|
|||
apiContextPaths: { |
|||
DEFAULT: '[(@{/})]'.startsWith('[') ? 'http://localhost:8080/' : '[(@{/})]', // 后端 API 请求的服务地址前缀
|
|||
DEFAULT: '[(@{/})]'.startsWith('[') ? 'http://localhost:8080/' : '[(@{/})]' |
|||
} |
|||
} |
|||
}; |
@ -0,0 +1,19 @@ |
|||
/** |
|||
* 设置打包文件的运行时目标环境(target) |
|||
* 设置方式: 通过命令行 -D 传入目标环境参数 |
|||
* 打包命令如下: |
|||
* 1. gradle bootwar # 默认, target=tomcat |
|||
* 2. gradle bootwar -Dtarget=undertow # undertow, target=undertow |
|||
* 3. gradle bootwar -Dtarget=jetty # jetty, target=jetty |
|||
*/ |
|||
def target =System.getProperty("target") ?: "undertow"; |
|||
System.setProperty('target',target); |
|||
|
|||
// 根据 targetRuntime 变量的值执行实际的 build.gradle |
|||
apply from: "build-${target}.gradle" |
|||
|
|||
// 应用启动项目无需发布到仓库中 |
|||
publishPublicationPublicationToMavenRepository.enabled=false |
|||
|
|||
// 开启 docker 镜像生成任务 |
|||
jibBuildTar.enabled =true |
@ -0,0 +1,15 @@ |
|||
println "[Jetty] 环境 ......" |
|||
|
|||
configurations { |
|||
all*.exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat" |
|||
all*.exclude group: "org.apache.tomcat.embed", module: "tomcat-embed-core" |
|||
all*.exclude group: "org.apache.tomcat.embed", module: "tomcat-embed-websocket" |
|||
} |
|||
|
|||
dependencies { |
|||
implementation("org.springframework.boot:spring-boot-starter-jetty") |
|||
|
|||
providedRuntime( |
|||
"org.springframework.boot:spring-boot-starter-jetty", |
|||
) |
|||
} |
@ -0,0 +1,7 @@ |
|||
println "[Tomcat] 环境 ......" |
|||
|
|||
dependencies { |
|||
providedRuntime( |
|||
"org.springframework.boot:spring-boot-starter-tomcat", |
|||
) |
|||
} |
@ -0,0 +1,15 @@ |
|||
println "[Undertow] 环境 ......" |
|||
|
|||
configurations { |
|||
all*.exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat" |
|||
all*.exclude group: "org.apache.tomcat.embed", module: "tomcat-embed-core" |
|||
all*.exclude group: "org.apache.tomcat.embed", module: "tomcat-embed-websocket" |
|||
} |
|||
|
|||
dependencies { |
|||
implementation("org.springframework.boot:spring-boot-starter-undertow") |
|||
|
|||
providedRuntime( |
|||
"org.springframework.boot:spring-boot-starter-undertow", |
|||
) |
|||
} |
@ -0,0 +1,19 @@ |
|||
/** |
|||
* 设置打包文件的运行时目标环境(target) |
|||
* 设置方式: 通过命令行 -D 传入目标环境参数 |
|||
* 打包命令如下: |
|||
* 1. gradle bootwar # 默认, target=tomcat |
|||
* 2. gradle bootwar -Dtarget=undertow # undertow, target=undertow |
|||
* 3. gradle bootwar -Dtarget=jetty # jetty, target=jetty |
|||
*/ |
|||
def target =System.getProperty("target") ?: "undertow"; |
|||
System.setProperty('target',target); |
|||
|
|||
// 根据 targetRuntime 变量的值执行实际的 build.gradle |
|||
apply from: "build-${target}.gradle" |
|||
|
|||
// 应用启动项目无需发布到仓库中 |
|||
publishPublicationPublicationToMavenRepository.enabled=false |
|||
|
|||
// 开启 docker 镜像生成任务 |
|||
jibBuildTar.enabled =true |
@ -0,0 +1,15 @@ |
|||
println "[Jetty] 环境 ......" |
|||
|
|||
configurations { |
|||
all*.exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat" |
|||
all*.exclude group: "org.apache.tomcat.embed", module: "tomcat-embed-core" |
|||
all*.exclude group: "org.apache.tomcat.embed", module: "tomcat-embed-websocket" |
|||
} |
|||
|
|||
dependencies { |
|||
implementation("org.springframework.boot:spring-boot-starter-jetty") |
|||
|
|||
providedRuntime( |
|||
"org.springframework.boot:spring-boot-starter-jetty", |
|||
) |
|||
} |
@ -0,0 +1,7 @@ |
|||
println "[Tomcat] 环境 ......" |
|||
|
|||
dependencies { |
|||
providedRuntime( |
|||
"org.springframework.boot:spring-boot-starter-tomcat", |
|||
) |
|||
} |
@ -0,0 +1,15 @@ |
|||
println "[Undertow] 环境 ......" |
|||
|
|||
configurations { |
|||
all*.exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat" |
|||
all*.exclude group: "org.apache.tomcat.embed", module: "tomcat-embed-core" |
|||
all*.exclude group: "org.apache.tomcat.embed", module: "tomcat-embed-websocket" |
|||
} |
|||
|
|||
dependencies { |
|||
implementation("org.springframework.boot:spring-boot-starter-undertow") |
|||
|
|||
providedRuntime( |
|||
"org.springframework.boot:spring-boot-starter-undertow", |
|||
) |
|||
} |
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
|
@ -1,7 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class Configure { |
|||
private Setting setting =new Setting(); |
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class Footer { |
|||
private boolean show =false; // 是否显示
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class Grid { |
|||
private String headBgColor ="#f5f7fa"; // 表头背景颜色
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class I18n { |
|||
private String[] availableLocales =new String[]{ "en", "zh_CN", "tw_CN" };// 支持的国际化多语言数组
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class LoadingBar { |
|||
private String color ="positive"; // 颜色
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class Login { |
|||
private String bgImage= "login-bg.jpg"; // 背景图片
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class Main { |
|||
private String bgColor = "#FFFFFF"; // 背景颜色
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class Notifier { |
|||
private String position ="top"; // 位置(可选值:top-left,top-right,bottom-left,bottom-right,top,bottom,left,right,center
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class Scroller { |
|||
private boolean enable =true; // 是否可用
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class Setting { |
|||
private String routerHistoryMode="hash"; // vue-router 历史模式(hash,web)
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class Sider { |
|||
private String position ="left"; // 位置(可选值:left;right)
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class TagViewBar { |
|||
private int height =50; // 高度(单位:像素)
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class Theme { |
|||
private boolean dark =false; // 是否黑暗模式
|
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
@ -1,4 +1,4 @@ |
|||
package io.sc.platform.lcdp.configure.vo; |
|||
package io.sc.platform.lcdp.configure.api; |
|||
|
|||
public class TopperAction { |
|||
private boolean enable =true; // 是否可用
|
@ -0,0 +1,16 @@ |
|||
package io.sc.platform.lcdp.configure.controller; |
|||
|
|||
import org.springframework.core.io.DefaultResourceLoader; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
|
|||
@Controller |
|||
public class ConfigureJsController { |
|||
private boolean isExists =new DefaultResourceLoader().getResource("classpath:/public/configure.js").exists(); |
|||
|
|||
@RequestMapping("/configure.js") |
|||
public String configureJs(){ |
|||
System.out.println(">>>>>"); |
|||
return "configure.js"; |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
package io.sc.platform.lcdp.configure.initializer; |
|||
|
|||
import io.sc.platform.core.initializer.ApplicationInitializer; |
|||
import io.sc.platform.core.initializer.ApplicationInitializerExecuteException; |
|||
import io.sc.platform.lcdp.configure.api.Setting; |
|||
import io.sc.platform.lcdp.configure.api.Theme; |
|||
import io.sc.platform.lcdp.configure.jpa.entity.ConfigureEntity; |
|||
import io.sc.platform.lcdp.configure.service.ConfigureService; |
|||
import org.springframework.context.ApplicationContext; |
|||
|
|||
public class ConfigureInitializer implements ApplicationInitializer { |
|||
private Boolean isInitialized =null; |
|||
private ConfigureService configureService; |
|||
|
|||
@Override |
|||
public void init(ApplicationContext applicationContext) { |
|||
this.configureService =applicationContext.getBean(ConfigureService.class); |
|||
} |
|||
|
|||
@Override |
|||
public synchronized boolean isInitialized() { |
|||
if(isInitialized!=null) { |
|||
return isInitialized; |
|||
} |
|||
if(configureService.getRepository().count()<=0){ |
|||
isInitialized =false; |
|||
}else { |
|||
isInitialized = true; |
|||
} |
|||
return isInitialized; |
|||
} |
|||
|
|||
@Override |
|||
public void execute() throws ApplicationInitializerExecuteException { |
|||
ConfigureEntity entity =new ConfigureEntity(); |
|||
entity.setName("Default"); |
|||
entity.setActive(true); |
|||
entity.setSetting(new Setting()); |
|||
entity.setTheme(new Theme()); |
|||
configureService.getRepository().save(entity); |
|||
} |
|||
} |
@ -1,12 +1,11 @@ |
|||
package io.sc.platform.lcdp.configure.service; |
|||
|
|||
import io.sc.platform.lcdp.configure.vo.Configure; |
|||
import io.sc.platform.lcdp.configure.api.Configure; |
|||
import io.sc.platform.lcdp.configure.jpa.entity.ConfigureEntity; |
|||
import io.sc.platform.lcdp.configure.jpa.repository.ConfigureRepository; |
|||
import io.sc.platform.orm.service.DaoService; |
|||
|
|||
public interface ConfigureService extends DaoService<ConfigureEntity, String, ConfigureRepository> { |
|||
public Configure getActiveConfigure(); |
|||
public Configure getConfigure(String name); |
|||
public void setActiveConfigure(String name); |
|||
public void activeConfigure(String id); |
|||
} |
|||
|
@ -1 +1 @@ |
|||
io.sc.platform.system.initializer.MenuInitializer |
|||
io.sc.platform.lcdp.configure.initializer.ConfigureInitializer |
@ -0,0 +1,11 @@ |
|||
// 在浏览器 window 对象中新建名为 APP 的容器变量, 用于存放平台的全局变量
|
|||
window.APP = {}; |
|||
// 全局配置
|
|||
window.APP.configure ={ |
|||
// 应用上下文路径
|
|||
webContextPath: '[(@{/})]'.startsWith('[')? '/' : '[(@{/})]', |
|||
// 默认后端 API 请求的服务地址前缀
|
|||
apiContextPaths: { |
|||
DEFAULT: '[(@{/})]'.startsWith('[') ? 'http://localhost:8080/' : '[(@{/})]' |
|||
} |
|||
}; |
Loading…
Reference in new issue