From 59e0a80b377a94b78b58bc5adbe3d82f4a9e1519 Mon Sep 17 00:00:00 2001 From: thinkgem Date: Mon, 1 Apr 2024 12:02:24 +0800 Subject: [PATCH] =?UTF-8?q?web-fast=20=E9=BB=98=E8=AE=A4=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=20vue=20=E5=89=8D=E7=AB=AF=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-fast/pom.xml | 13 ++++++++++--- .../com/jeesite/modules/FastApplication.java | 17 +++++++++++++++-- .../src/main/resources/config/application.yml | 17 +++++++++++++++-- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/web-fast/pom.xml b/web-fast/pom.xml index 1ef20310..a718f710 100644 --- a/web-fast/pom.xml +++ b/web-fast/pom.xml @@ -26,11 +26,11 @@ unix:///var/run/docker.sock - thinkgem/jeesite-web:latest + - - + thinkgem/jeesite-web:arm64 + linux/arm64 8980:8980 @@ -86,6 +86,13 @@ ${project.parent.version} --> + + + com.jeesite + jeesite-vue-dist + 5.7.0-SNAPSHOT + + diff --git a/web-fast/src/main/java/com/jeesite/modules/FastApplication.java b/web-fast/src/main/java/com/jeesite/modules/FastApplication.java index e4e47e28..fedee528 100644 --- a/web-fast/src/main/java/com/jeesite/modules/FastApplication.java +++ b/web-fast/src/main/java/com/jeesite/modules/FastApplication.java @@ -6,11 +6,13 @@ package com.jeesite.modules; 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; @@ -35,6 +37,16 @@ public class FastApplication extends SpringBootServletInitializer { 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:" @@ -52,11 +64,12 @@ public class FastApplication extends SpringBootServletInitializer { } @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"); } } diff --git a/web-fast/src/main/resources/config/application.yml b/web-fast/src/main/resources/config/application.yml index 79cb3036..e5ff7410 100644 --- a/web-fast/src/main/resources/config/application.yml +++ b/web-fast/src/main/resources/config/application.yml @@ -107,6 +107,16 @@ logging: #========== System settings ===========# #======================================# +# 管理基础路径 +adminPath: /a + +# 前端基础路径 +frontPath: /f + +# Vue 资源文件路径,与 VITE_PUBLIC_PATH 一致。 +# 映射到 src/main/resources/{vuePath} 文件夹 +vuePath: /vue + # 用户相关 user: @@ -136,8 +146,11 @@ state: # Shiro 相关 shiro: - # 主页路径 - defaultPath: ${shiro.loginUrl} + # defaultPath: ${shiro.loginUrl} + defaultPath: ${vuePath}/login + + # Vue 资源文件路径,与 VITE_PUBLIC_PATH 一致 + vuePath: /vue # 登录相关设置 loginUrl: ${adminPath}/login