From 55663cc9d2b777ef809b550a4cbac18544177375 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Fri, 26 Dec 2025 14:32:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=93=E5=8C=85=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 +++ .env.production | 5 ++++- src/router/index.js | 2 +- src/views/planMange/monthlyPlan/edit.vue | 4 ++-- vite.config.js | 6 +++--- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.env.development b/.env.development index c0c88b4..515b421 100644 --- a/.env.development +++ b/.env.development @@ -6,3 +6,6 @@ VITE_APP_ENV = 'development' # 运检站管理/开发环境 VITE_APP_BASE_API = '/dev-api' + +#静态资源路径(服务器目录) +VITE_APP_PUBLIC_PATH = '' diff --git a/.env.production b/.env.production index e5a9d89..d1fe8f1 100644 --- a/.env.production +++ b/.env.production @@ -5,7 +5,10 @@ VITE_APP_TITLE = 运检站管理 VITE_APP_ENV = 'production' # 运检站管理/生产环境 -VITE_APP_BASE_API = '/prod-api' +VITE_APP_BASE_API = '/ynDigitalGadgets-prod-api' + +#静态资源路径(服务器目录) +VITE_APP_PUBLIC_PATH = '/ynDigitalGadgets' # 是否在打包时开启压缩,支持 gzip 和 brotli VITE_BUILD_COMPRESS = gzip \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 278397f..f40e626 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -194,7 +194,7 @@ export const dynamicRoutes = [ ] const router = createRouter({ - history: createWebHistory(), + history: createWebHistory(import.meta.env.VITE_APP_PUBLIC_PATH || '/'), routes: constantRoutes, scrollBehavior(to, from, savedPosition) { if (savedPosition) { diff --git a/src/views/planMange/monthlyPlan/edit.vue b/src/views/planMange/monthlyPlan/edit.vue index 1830b09..102594f 100644 --- a/src/views/planMange/monthlyPlan/edit.vue +++ b/src/views/planMange/monthlyPlan/edit.vue @@ -11,9 +11,9 @@ diff --git a/vite.config.js b/vite.config.js index c676b2e..843c74f 100644 --- a/vite.config.js +++ b/vite.config.js @@ -3,8 +3,8 @@ import path from 'path' import createVitePlugins from './vite/plugins' // const baseUrl = 'http://192.168.0.133:58080' // 后端接口地址 超子 -// const baseUrl = 'http://localhost:58080' // 后端接口地址 -const baseUrl = 'http://192.168.0.60:58080' // 后端接口地址 福海 +const baseUrl = 'http://localhost:58080' // 后端接口地址 +// const baseUrl = 'http://192.168.0.60:58080' // 后端接口地址 福海 // https://vitejs.dev/config/ export default defineConfig(({ mode, command }) => { @@ -16,7 +16,7 @@ export default defineConfig(({ mode, command }) => { // 部署生产环境和开发环境下的URL。 // 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上 // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 - base: VITE_APP_ENV === 'production' ? '/' : '/', + base: VITE_APP_ENV === 'production' ? '/ynDigitalGadgets' : '/', plugins: createVitePlugins(env, command === 'build'), resolve: { // https://cn.vitejs.dev/config/#resolve-alias