Skip to content

Commit

Permalink
web-fast 默认使用 vue 前端展示
Browse files Browse the repository at this point in the history
  • Loading branch information
think-gem committed Apr 1, 2024
1 parent ed836c2 commit 24d51e4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
7 changes: 7 additions & 0 deletions web-fast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@
<version>${project.parent.version}</version>
</dependency> -->

<!-- Vue发布包 https://gitee.com/thinkgem/jeesite-vue -->
<dependency>
<groupId>com.jeesite</groupId>
<artifactId>jeesite-vue-dist</artifactId>
<version>5.7.0-SNAPSHOT</version>
</dependency>

</dependencies>

<build>
Expand Down
17 changes: 15 additions & 2 deletions web-fast/src/main/java/com/jeesite/modules/FastApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@

import com.jeesite.common.config.Global;
import com.jeesite.common.io.FileUtils;
import com.jeesite.common.lang.StringUtils;
import com.jeesite.common.web.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.stereotype.Controller;
Expand All @@ -35,6 +37,16 @@ public static void setJeeSiteInitDataProperty() {
public static void main(String[] args) throws UnknownHostException {
FastApplication.setJeeSiteInitDataProperty();
SpringApplication.run(FastApplication.class, args);
String vuePath = Global.getProperty("vuePath");
String ctxPath = Global.getProperty("server.servlet.context-path");
if (StringUtils.isNoneBlank(vuePath, ctxPath)) {
logger.info(
"\r\n\r\n==============================================================\r\n"
+ "\r\n 存在此提示:因为您修改了 server.servlet.context-path 参数,需要您"
+ "\r\n 同步修改 jeesite-vue/.env.tomcat 中的 VITE_PUBLIC_PATH 并重新打包 "
+ "\r\n 如:context-path: " + ctxPath +" 即对应为 VITE_PUBLIC_PATH = " + ctxPath + vuePath
+ "\r\n\r\n==============================================================\r\n");
}
logger.info(
"\r\n\r\n==============================================================\r\n"
+ "\r\n 启动完成,访问地址:http://127.0.0.1:"
Expand All @@ -52,11 +64,12 @@ protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
}

@Controller
public class JeeSiteController extends BaseController {
@ConditionalOnProperty(name = "server.servlet.context-path", havingValue = "")
public static class JeeSiteController extends BaseController {

@RequestMapping(value = "/js/**")
public String login() {
return REDIRECT + adminPath + "/login";
return REDIRECT + Global.getProperty("defaultPath");
}

}
Expand Down
15 changes: 13 additions & 2 deletions web-fast/src/main/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ logging:
#========== System settings ===========#
#======================================#

# 管理基础路径
adminPath: /a

# 前端基础路径
frontPath: /f

# Vue 资源文件路径,与 VITE_PUBLIC_PATH 一致。
# 映射到 src/main/resources/{vuePath} 文件夹
vuePath: /vue

# 用户相关
user:

Expand Down Expand Up @@ -135,9 +145,10 @@ state:

# Shiro 相关
shiro:

# 主页路径
defaultPath: ${shiro.loginUrl}
# defaultPath: ${shiro.loginUrl}
defaultPath: ${vuePath}/login

# 登录相关设置
loginUrl: ${adminPath}/login
Expand Down

0 comments on commit 24d51e4

Please sign in to comment.