build: 适配管理端 flow 基路径

- 调整开发与分析环境的 base 和接口前缀为 /flow

- 更新 Vite 代理配置,兼容 /flow/api 与 /flow/userCenter

- 修复基路径下的 Logo 与启动加载图资源地址
This commit is contained in:
2026-03-18 21:56:36 +08:00
parent 5d3c7d8692
commit cff4fe8da9
5 changed files with 24 additions and 13 deletions

View File

@@ -20,6 +20,7 @@ async function viteInjectAppLoadingPlugin(
const { version } = await readPackageJSON(process.cwd());
const envRaw = isBuild ? 'prod' : 'dev';
const cacheName = `'${env.VITE_APP_NAMESPACE}-${version}-${envRaw}-preferences-theme'`;
const appBase = JSON.stringify(ensureTrailingSlash(env.VITE_BASE || '/'));
// 获取缓存的主题
// 保证黑暗主题下刷新页面时loading也是黑暗主题
@@ -29,7 +30,7 @@ async function viteInjectAppLoadingPlugin(
document.documentElement.classList.toggle('dark', /dark/.test(theme));
setTimeout(() => {
if (/dark/.test(theme)) {
document.querySelector('#__app-loading__ img').src = '/logoDark.svg';
document.querySelector('#__app-loading__ img').src = ${appBase} + 'logoDark.svg';
}
})
</script>
@@ -68,4 +69,8 @@ async function getLoadingRawByHtmlTemplate(loadingTemplate: string) {
return await fsp.readFile(appLoadingPath, 'utf8');
}
function ensureTrailingSlash(path: string) {
return path.endsWith('/') ? path : `${path}/`;
}
export { viteInjectAppLoadingPlugin };