更新VSCode配置,启用Maven支持,设置Java 17环境,调整MybatisPlusSaasConfig以开启系统租户控制并添加新租户表。更新pom.xml以包含新模块jeecg-module-xslmes,优化Vue3环境配置以统一API路径,增强代理设置以支持完整的后端路径。修复useForm钩子中的字段重置逻辑,改进axios配置以处理相对URL的上下文路径问题。

This commit is contained in:
geht
2026-04-21 13:41:05 +08:00
parent 73426a7af3
commit 1b06e987dc
114 changed files with 8249 additions and 17 deletions

View File

@@ -151,6 +151,36 @@ const transform: AxiosTransform = {
}
}
/**
* 单体 / 集成部署:页面在 http://host/jeecg-boot/ 下时,若仅用「以 / 开头的相对 URL」
* 浏览器会解析到 http://host/jeecg-boot/... 或误解析到 http://host/xslmes/...(缺少 context-path
* 后端报 No static resource。使用完整 domainUrl 作 axios baseURLurl 只保留 servlet 内路径。
*/
if (
!isStartWithHttp &&
!globSetting.isQiankunMicro &&
globSetting.domainUrl &&
/^https?:\/\//.test(globSetting.domainUrl) &&
config.url &&
typeof config.url === 'string'
) {
try {
const du = new URL(globSetting.domainUrl);
const ctx = (du.pathname || '').replace(/\/$/, '');
config.baseURL = globSetting.domainUrl.replace(/\/$/, '');
let pathOnly = config.url as string;
if (ctx && (pathOnly === ctx || pathOnly.startsWith(ctx + '/'))) {
pathOnly = pathOnly.slice(ctx.length) || '/';
}
if (!pathOnly.startsWith('/')) {
pathOnly = '/' + pathOnly;
}
config.url = pathOnly;
} catch {
/* 忽略 URL 解析异常 */
}
}
return config;
},