diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index cfbb80e..52bf511 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -1,3 +1,8 @@ +--- # 本地开发环境覆盖 +ruoyi: + profile: /home/wy/oa/uploadPath + server-url: http://localhost:8080 + --- # 监控中心配置 spring.boot.admin.client: # 增加客户端开关 diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml index 86747ce..b0e348d 100644 --- a/ruoyi-admin/src/main/resources/application-prod.yml +++ b/ruoyi-admin/src/main/resources/application-prod.yml @@ -1,3 +1,7 @@ +--- # 生产环境覆盖 +ruoyi: + profile: /home/wy/oa/uploadPath + server-url: http://49.232.154.205:8080 --- # 监控中心配置 spring.boot.admin.client: diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 7a76333..2ea01bd 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -12,9 +12,10 @@ ruoyi: addressEnabled: true # 缓存懒加载 cacheLazy: false - # 文件路径 + # 服务地址(各环境 profile 覆盖此值) + server-url: http://localhost:8080 + # 文件路径(各环境 profile 覆盖此值) profile: /home/wy/oa/uploadPath -# profile: F:\work\fad_oa系统\fad_oa\temp captcha: # 页面 <参数设置> 可开启关闭 验证码校验 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java index a65e640..3a9b8c0 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java @@ -4,6 +4,8 @@ package com.ruoyi.framework.config; import javax.servlet.http.HttpServletRequest; import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; /** @@ -14,13 +16,21 @@ import org.springframework.stereotype.Component; @Component public class ServerConfig { + + @Value("${ruoyi.server-url:}") + private String serverUrl; + /** * 获取完整的请求路径,包括:域名,端口,上下文访问路径 + * 优先使用配置的 ruoyi.server-url,未配置时从请求动态解析 * * @return 服务地址 */ public String getUrl() { + if (StringUtils.isNotEmpty(serverUrl)) { + return serverUrl; + } HttpServletRequest request = ServletUtils.getRequest(); return getDomain(request); } diff --git a/ruoyi-ui/src/views/rm/drawingDesign/index.vue b/ruoyi-ui/src/views/rm/drawingDesign/index.vue index 33e2959..7d7dc53 100644 --- a/ruoyi-ui/src/views/rm/drawingDesign/index.vue +++ b/ruoyi-ui/src/views/rm/drawingDesign/index.vue @@ -126,8 +126,9 @@ -
{{ selected ? '暂未上传文件' : '点击左侧图纸进行预览' }}
点击左侧文件进行预览
{{ selected ? '暂未上传文件' : '点击左侧文件进行预览' }}