feat(config): 添加服务器URL配置并优化文件预览功能
- 在 application.yml 中添加 server-url 配置项,支持各环境profile覆盖 - 在 application-dev.yml 和 application-prod.yml 中分别配置对应的服务器地址 - 移除 @flyfish-group/file-viewer-web 依赖,改用 iframe 方式实现文件预览 - 更新 drawingDesign、installFeedback、layout 和 manuals 等模块的预览逻辑 - 在 ServerConfig 中实现优先使用配置的 server-url 的逻辑 - 移除相关的 viewerCtrl 控制器和生命周期钩子函数
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user