更新VSCode配置,启用Maven支持,设置Java 17环境,调整MybatisPlusSaasConfig以开启系统租户控制并添加新租户表。更新pom.xml以包含新模块jeecg-module-xslmes,优化Vue3环境配置以统一API路径,增强代理设置以支持完整的后端路径。修复useForm钩子中的字段重置逻辑,改进axios配置以处理相对URL的上下文路径问题。
This commit is contained in:
@@ -20,12 +20,30 @@ export function createProxy(list: ProxyList = []) {
|
||||
for (const [prefix, target] of list) {
|
||||
const isHttps = httpsRE.test(target);
|
||||
|
||||
// 若 target 带路径(如 http://localhost:8080/jeecg-boot),需拼回转发路径:
|
||||
// 否则 rewrite 去掉 /jeecgboot 后只剩 /xslmes/...,缺少 context-path,后端会报 No static resource。
|
||||
let proxyTarget = target;
|
||||
let targetPathPrefix = '';
|
||||
try {
|
||||
const u = new URL(target);
|
||||
const p = (u.pathname || '').replace(/\/$/, '');
|
||||
if (p) {
|
||||
targetPathPrefix = p;
|
||||
proxyTarget = `${u.protocol}//${u.host}`;
|
||||
}
|
||||
} catch {
|
||||
/* 非标准 URL 时保持原 target */
|
||||
}
|
||||
|
||||
// https://github.com/http-party/node-http-proxy#options
|
||||
ret[prefix] = {
|
||||
target: target,
|
||||
target: proxyTarget,
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
rewrite: (path) => path.replace(new RegExp(`^${prefix}`), ''),
|
||||
rewrite: (path) => {
|
||||
const stripped = path.replace(new RegExp(`^${prefix}`), '');
|
||||
return targetPathPrefix ? `${targetPathPrefix}${stripped}` : stripped;
|
||||
},
|
||||
// https is require secure=false
|
||||
...(isHttps ? { secure: false } : {}),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user