diff --git a/jweb/apps/jnpf-web-apps-main/public/ssw/tds/index.html b/jweb/apps/jnpf-web-apps-main/public/ssw-tds/index.html similarity index 100% rename from jweb/apps/jnpf-web-apps-main/public/ssw/tds/index.html rename to jweb/apps/jnpf-web-apps-main/public/ssw-tds/index.html diff --git a/jweb/apps/jnpf-web-apps-main/vite.config.mts b/jweb/apps/jnpf-web-apps-main/vite.config.mts index 005db43..7db953e 100644 --- a/jweb/apps/jnpf-web-apps-main/vite.config.mts +++ b/jweb/apps/jnpf-web-apps-main/vite.config.mts @@ -25,25 +25,9 @@ export default defineConfig(async () => { }, ], }, - // 门户页(jweb 真源 public/ssw/{tds,tdc,sswflow}/index.html)的目录形式 URL 需命中真源; - // vite 默认 SPA fallback 把所有无后缀路径 rewrite 到根 /index.html,对 ssw/ 前缀单独放行; - // 门户页与 SPA 入口同名(都是 index.html),浏览器历史里残留的 SPA fallback 响应会污染缓存, - // 设 no-store 强制每次重新拉,避免「不登录跳 /login」假象(旧缓存 SPA 启动触发 router 守卫) + // 门户页 (jweb 真源 public/ssw-tds/index.html) 走 vite 默认 static serving, + // 路径前缀 ssw-tds 与 jweb src/views/ssw/tds 组件目录不冲突, 无需中间件干预. plugins: [ - { - name: 'ssw-portal-rewrite', - configureServer(server) { - server.middlewares.use((req, res, next) => { - const u = req.url || '' - // 允许 query string: /ssw/tds/?redirect=... 也命中门户页 - if (/^\/ssw\/(tds|tdc|sswflow)\/?(\?|$)/.test(u)) { - req.url = u.replace(/\/?(\?|$)/, '/index.html$1') - res.setHeader('Cache-Control', 'no-store') - } - next() - }) - }, - }, ], }, }; diff --git a/web/public/ssw b/web/public/ssw deleted file mode 120000 index 2e412f9..0000000 --- a/web/public/ssw +++ /dev/null @@ -1 +0,0 @@ -/Users/xs/Desktop/ssw/jweb/apps/jnpf-web-apps-main/public/ssw \ No newline at end of file diff --git a/web/public/ssw-tds b/web/public/ssw-tds new file mode 120000 index 0000000..4383314 --- /dev/null +++ b/web/public/ssw-tds @@ -0,0 +1 @@ +/Users/xs/Desktop/ssw/jweb/apps/jnpf-web-apps-main/public/ssw-tds \ No newline at end of file diff --git a/web/vite.config.ts b/web/vite.config.ts index 1787967..1e6a9b4 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -4,7 +4,7 @@ import { fileURLToPath, URL } from 'node:url' import path from 'node:path' const __dirname = fileURLToPath(new URL('.', import.meta.url)) -// jweb 真源 public 目录:web/public/ssw/tds 是软链指向这里,需让 vite 放开 fs 限制 +// jweb 真源 public 目录:web/public/ssw-tds 是软链指向这里,需让 vite 放开 fs 限制 const jwebPublic = path.resolve(__dirname, '../jweb/apps/jnpf-web-apps-main/public') export default defineConfig({ @@ -17,7 +17,7 @@ export default defineConfig({ server: { host: true, port: 5173, - // src/views/ssw + public/ssw 是软链到 jweb 的目录(跨项目符号链接),放开 fs 限制让 vite 能读 + // src/views/ssw + public/ssw-tds 是软链到 jweb 的目录(跨项目符号链接),放开 fs 限制让 vite 能读 fs: { allow: ['..', jwebPublic] }, @@ -28,26 +28,10 @@ export default defineConfig({ } } }, - // 门户页(jweb 真源 public/ssw/{tds,tdc,sswflow}/index.html)的目录形式 URL 需命中真源; - // vite 默认 SPA fallback 把所有无后缀路径 rewrite 到根 /index.html,对 ssw/ 前缀单独放行; - // 门户页与 SPA 入口同名(都是 index.html),浏览器历史里残留的 SPA fallback 响应会污染缓存, - // 设 no-store 强制每次重新拉,避免「不登录跳 /login」假象(旧缓存 SPA 启动触发 router 守卫) + // 门户页 (jweb 真源 public/ssw-tds/index.html) 走 vite 默认 static serving, + // 路径前缀 ssw-tds 与 jweb src/views/ssw/tds 组件目录不冲突, 无需中间件干预. plugins: [ vue(), - { - name: 'ssw-portal-rewrite', - configureServer(server) { - server.middlewares.use((req, res, next) => { - const u = req.url || '' - // 允许 query string: /ssw/tds/?redirect=... 也命中门户页 - if (/^\/ssw\/(tds|tdc|sswflow)\/?(\?|$)/.test(u)) { - req.url = u.replace(/\/?(\?|$)/, '/index.html$1') - res.setHeader('Cache-Control', 'no-store') - } - next() - }) - } - } ], build: { rollupOptions: {