From 1f5c0556a3edad5ec437853893c212070e78a1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BC=96=E7=A0=81=E7=8C=BF?= Date: Tue, 23 Sep 2025 11:20:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9base=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=B5=84=E6=BA=90=E6=9D=A5=E6=BA=90=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E8=B5=84=E6=BA=90=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front-end/app-product/vite.config.ts | 2 +- front-end/app-shared/package.json | 2 +- front-end/app-shared/src/infra/AxiosInfra.ts | 16 +++++++++++----- front-end/app-shared/vite.config.ts | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/front-end/app-product/vite.config.ts b/front-end/app-product/vite.config.ts index 1d0dce9..c856e1b 100644 --- a/front-end/app-product/vite.config.ts +++ b/front-end/app-product/vite.config.ts @@ -10,7 +10,7 @@ export default defineConfig(async ({ mode }) => { const env = loadEnv(mode, process.cwd()); return { - base: `/${ env.VITE_SERVER_NAME }/`, + base: `http://${ env.VITE_TRAEFIK_ADDRESS }/${ env.VITE_SERVER_NAME }/`, server: { port: Number(env.VITE_SERVER_PORT), host: '0.0.0.0', diff --git a/front-end/app-shared/package.json b/front-end/app-shared/package.json index a4647bf..4a8f7b1 100644 --- a/front-end/app-shared/package.json +++ b/front-end/app-shared/package.json @@ -17,8 +17,8 @@ "nacos-federation": "link:../nacos-federation" }, "devDependencies": { - "@vitejs/plugin-vue": "^6.0.1", "@originjs/vite-plugin-federation": "^1.4.1", + "@vitejs/plugin-vue": "^6.0.1", "typescript": "~5.8.3", "vite": "^7.1.6" } diff --git a/front-end/app-shared/src/infra/AxiosInfra.ts b/front-end/app-shared/src/infra/AxiosInfra.ts index fe47210..467e755 100644 --- a/front-end/app-shared/src/infra/AxiosInfra.ts +++ b/front-end/app-shared/src/infra/AxiosInfra.ts @@ -1,4 +1,10 @@ -import axios, { AxiosError, type AxiosInstance, type AxiosRequestConfig } from "axios"; +import axios, { + AxiosError, + type AxiosInstance, + type AxiosRequestConfig, + AxiosResponse, + InternalAxiosRequestConfig +} from "axios"; import { UrlCheckUtils } from '../utils/index' @@ -52,9 +58,9 @@ class AxiosInfra { * 响应拦截器 * @constructor */ - public async ResponseInterceptor(): Promise { + public async ResponseInterceptor(): Promise { this.instance.interceptors.response.use( - (response: any) => { + (response: AxiosResponse) => { return response.data.result; }, (error: AxiosError) => { @@ -79,8 +85,8 @@ class AxiosInfra { * 添加请求拦截器 * @constructor */ - public async RequestInterceptor(): Promise { - this.instance.interceptors.request.use((config: any) => { + public async RequestInterceptor(): Promise { + this.instance.interceptors.request.use((config: InternalAxiosRequestConfig) => { return config }, function (error: AxiosError) { return Promise.reject(error) diff --git a/front-end/app-shared/vite.config.ts b/front-end/app-shared/vite.config.ts index 21d8728..38e59b4 100644 --- a/front-end/app-shared/vite.config.ts +++ b/front-end/app-shared/vite.config.ts @@ -8,7 +8,7 @@ export default defineConfig(async ({ mode }): Promise => { const env = loadEnv(mode, process.cwd()); return { - base: `/${ env.VITE_SERVER_NAME }/`, + base: `http://${ env.VITE_TRAEFIK_ADDRESS }/${ env.VITE_SERVER_NAME }/`, server: { port: Number(env.VITE_SERVER_PORT), host: '0.0.0.0',