chore: 主题通道第一步挂载 + 迁移 Vue3 前基线

This commit is contained in:
lijing
2026-10-20 15:16:49 +08:00
parent 5e85aae7e0
commit 0564f5f89d
5 changed files with 55 additions and 13 deletions
+11
View File
@@ -0,0 +1,11 @@
# 开发环境(Vue CLI 默认 mode=development 时自动加载本文件)
#
# 主题通道接入说明(《云海子应用前端接入规范》§2.2 第一步):
# 1. public/index.html 已插入 A 类 loader,主题/皮肤由通道 /static/js/yh-theme-init.js 下发;
# 2. 本地 dev 的 /static 请求由 vue.config.js 的 devServer.proxy 兜到主题通道;
# 3. 默认通道地址 http://base.yunhaixingtong.com,联调本地通道源时用环境变量覆盖:
# YH_THEME_PROXY_TARGET=http://localhost:9527 npm run dev
# 4. 跨源直连(VITE_THEME_HOST)是 Vite 工程的机制,本项目为 Vue CLI(webpack),
# 内联脚本里的 %VITE_THEME_HOST% 会被判为占位符并置空,统一走上面的 dev 代理。
#
# 说明:本文件不含敏感配置,仅作接入连法备忘。
+4 -4
View File
@@ -1,7 +1,7 @@
window.conf = {
baseHost: "http://base.bestsch.com",
ssoHost: "http://sso.bestsch.com",
serviceUrl: "http://192.168.10.166:8087",
fileHost:'http://base.bestsch.com/ClassroomMan/file',
baseHost: "http://base.yunhaixingtong.com",
ssoHost: "http://sso.yunhaixingtong.com",
serviceUrl: "http://base.yunhaixingtong.com/userclass",
fileHost: "http://base.yunhaixingtong.com/userclass",
isLayoutOld: false,
};
+20
View File
@@ -13,6 +13,26 @@
<link rel="stylesheet" href="./libs/base.layout.css" />
<link rel="stylesheet" href="./libs/default-theme.css" />
<link rel="stylesheet" href="//at.alicdn.com/t/c/font_4962449_bwzjcx59wz4.css" />
<!-- 主题通道引导(A 类免插件接入,见 YschTheme《管理端主题远程化与公共静态通道方案》§11):
唯一接入点。不装 npm 依赖、不改构建配置;FOUC 门、manifest 预取、主题 <link> 追加与
排序(晚于 viewuiplus.css)全由通道 yh-theme-init.js 承担,主题升级走 /static 通道,
本应用无需重新构建。
origin 零写死,优先级四档:__APP_CONFIG__.staticHost(专用通道覆盖)
> __APP_CONFIG__.baseHost(env-config 在线维护,换域名改配置即生效)
> %VITE_THEME_HOST%(仅 dev 注入的跨源直连,需通道已开 CORS)
> 同源相对 "/static/…"(生产常态:本应用部署在 base 域 /<app>/front/,与通道同源;
本地 dev 由 vue.config.js 的 /static 代理兜到通道)。
document.write 是有意为之:保证 parser-blocking,让档位类与 FOUC 门先于首帧;
build 不读 .env,占位符留字面量 → 判首字符 % 置空 → 产物零环境值烧入。 -->
<script>
(function () {
var c = window.__APP_CONFIG__ || {};
var themeHost = "%VITE_THEME_HOST%";
if (themeHost.charAt(0) === "%") themeHost = "";
var host = String(c.staticHost || c.baseHost || themeHost).replace(/\/+$/, "");
document.write('<script src="' + host + '/static/js/yh-theme-init.js"><\/script>');
})();
</script>
</head>
<body>
<div id="app"></div>
+2 -1
View File
@@ -99,7 +99,8 @@
<Breadcrumb separator=">">
<a :href="baseHost + '/userhome/front/index.html'">
<BreadcrumbItem>
<i class="iconfont icon-category"></i>
<!-- 面包屑首页图标:行内基线流 -0.125em 光学居中(接入规范 §4) -->
<i class="iconfont icon-category" style="vertical-align: -0.125em"></i>
首页
</BreadcrumbItem>
</a>
+18 -8
View File
@@ -76,14 +76,24 @@ module.exports = {
https: false, //是否开启https
hotOnly: true, //是否配置热更新
open: true, //配置自动启动浏览器
// proxy: { //配置多个代理跨域(配置一个 proxy: 'http://localhost:4000' )
// '/api': {
// target: 'http://basedebug.bestsch.com/BschHome',
// ws: true, //是否跨域
// changeOrigin: true,
// // pathRewrite: { '^/api': '' }
// }
// },
// 主题通道 dev 代理(A 类接入 §2.2 第一步):
// 本地开发时 /static/* 兜到主题通道(默认线上通道),联调本地通道源可覆盖:
// YH_THEME_PROXY_TARGET=http://localhost:9527 npm run dev
// 生产与通道同源,不依赖本代理。
proxy: {
"/static": {
target: process.env.YH_THEME_PROXY_TARGET || "http://base.yunhaixingtong.com",
changeOrigin: true,
ws: true
}
// 原有业务接口代理示例(按需启用):
// '/api': {
// target: 'http://basedebug.bestsch.com/BschHome',
// ws: true, //是否跨域
// changeOrigin: true,
// // pathRewrite: { '^/api': '' }
// }
},
overlay: {
//关闭eslint
warnings: false,