fix: 修复退出跳错域、二级页高亮、落地页权限口径与操作列图标悬浮不居中
build / build (push) Successful in 10m27s

This commit is contained in:
lijing
2026-09-21 12:09:52 +08:00
parent c9b1ab9e84
commit b623e18b9b
5 changed files with 310 additions and 70 deletions
+28 -1
View File
@@ -9,7 +9,7 @@ import { BaseConf } from "@/types/Basics";
* build 产物不读任何 .env.*(.env.base/.env.ld/.env.prod 已删),VITE_* 恒为 undefined,
* 本层自动跳过,产物不含任何环境值
* ③ 同域推导兜底:env-config 未配置/拉取失败时框架至少能渲染并调通同源 API;
* ssoHost 为空 → 登出跳转不可用——与后端未就绪状态一致,可接受。
* ssoHost 另由 ④ 按 base.* → sso.* 的运维约定推导,保证登出仍能跳到 SSO 域
*/
const env = import.meta.env;
@@ -61,6 +61,33 @@ if (runtime && typeof runtime === "object" && runtime.relayConf) {
applyConf(conf.relayConf, runtime.relayConf);
}
/**
* ④ 登出地址兜底:ssoHost 为空时 logout 会退化成同源相对路径
* `/logout?service=…`,落到 base 域而不是 SSO 域 —— 会话根本没注销,
* 只是从当前页跳回首页,用户看着像"点了退出没反应"。
*
* 触发条件很常见:projman 侧 env-config 未配 ssoHost 时接口返回 `{}`
* (实测同族多个应用都存在这种空下发,而 campusnotice / notice 下发了完整三键)。
*
* 运维约定 SSO 与 base 同域不同子域(base.x.com ↔ sso.x.com),据此**按当前站点推导**,
* 而不是把域名写死进产物 —— 保持"构建产物不含任何环境值"这一设计前提。
* 部署在非 base.* 域名(如 IP、localhost)时不推导,维持原行为。
*/
function deriveSsoHostFrom(base: string): string {
if (!base) return "";
try {
const u = new URL(base);
if (!/^base\./i.test(u.hostname)) return "";
u.hostname = u.hostname.replace(/^base\./i, "sso.");
return u.origin;
} catch {
return "";
}
}
if (!conf.ssoHost) {
conf.ssoHost = deriveSsoHostFrom(conf.baseHost);
}
// HTTPS 自动升级:当前页面是 https 时,将所有 http:// 配置项升级为 https://
var ishttps = "https:" == document.location.protocol ? true : false;
if (ishttps) {
File diff suppressed because one or more lines are too long