From 227ee04b4f462c24ba1ec3d7c060ada42e913820 Mon Sep 17 00:00:00 2001 From: xingyuv Date: Wed, 29 Mar 2023 17:36:59 +0800 Subject: [PATCH] chore: proxy --- .env.development | 4 ++-- .env.front | 4 ++-- src/hooks/setting/index.ts | 3 +-- src/views/infra/druid/index.vue | 4 +--- src/views/infra/server/index.vue | 4 +--- src/views/infra/swagger/index.vue | 4 +--- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.env.development b/.env.development index f76816d4..9c8ba136 100644 --- a/.env.development +++ b/.env.development @@ -7,7 +7,7 @@ VITE_PUBLIC_PATH = / # 本地开发代理,可以解决跨域及多地址代理 # 如果接口地址匹配到,则会转发到http://localhost:3000,防止本地出现跨域问题 # 可以有多个,注意多个不能换行,否则代理将会失效 -VITE_PROXY = [["/dev-api","http://localhost:48080"],["/upload","http://localhost:48080/admin-api/infra/file/upload"]] +VITE_PROXY = [["/dev-api","http://localhost:48080/admin-api"],["/upload","http://localhost:48080/admin-api/infra/file/upload"]] # VITE_PROXY=[["/api","http://vben.xingyuv.com/test"]] # 是否删除Console.log @@ -16,7 +16,7 @@ VITE_DROP_CONSOLE = false # 接口地址 VITE_GLOB_BASE_URL = "http://localhost:48080" # 如果没有跨域问题,直接在这里配置即可 -VITE_GLOB_API_URL = /admin-api +VITE_GLOB_API_URL = /dev-api # 文件上传接口 可选 VITE_GLOB_UPLOAD_URL = /upload diff --git a/.env.front b/.env.front index f67abbda..699b32c9 100644 --- a/.env.front +++ b/.env.front @@ -7,7 +7,7 @@ VITE_PUBLIC_PATH = / # 本地开发代理,可以解决跨域及多地址代理 # 如果接口地址匹配到,则会转发到http://localhost:3000,防止本地出现跨域问题 # 可以有多个,注意多个不能换行,否则代理将会失效 -VITE_PROXY = [["/dev-api","http://api-dashboard.yudao.iocoder.cn"],["/upload","http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload"]] +VITE_PROXY = [["/dev-api","http://api-dashboard.yudao.iocoder.cn/admin-api"],["/upload","http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload"]] # VITE_PROXY=[["/api","http://vben.xingyuv.com/test"]] # 是否删除Console.log @@ -16,7 +16,7 @@ VITE_DROP_CONSOLE = false # 接口地址 VITE_GLOB_BASE_URL = "http://api-dashboard.yudao.iocoder.cn" # 如果没有跨域问题,直接在这里配置即可 -VITE_GLOB_API_URL = /admin-api +VITE_GLOB_API_URL = /dev-api # 文件上传接口 可选 VITE_GLOB_UPLOAD_URL = /upload diff --git a/src/hooks/setting/index.ts b/src/hooks/setting/index.ts index f1d6da22..cec59ae0 100644 --- a/src/hooks/setting/index.ts +++ b/src/hooks/setting/index.ts @@ -6,7 +6,6 @@ import { getAppEnvConfig } from '@/utils/env' export const useGlobSetting = (): Readonly => { const { VITE_GLOB_APP_TITLE, - VITE_GLOB_BASE_URL, VITE_GLOB_API_URL, VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, @@ -24,7 +23,7 @@ export const useGlobSetting = (): Readonly => { // Take global configuration const glob: Readonly = { title: VITE_GLOB_APP_TITLE, - apiUrl: VITE_GLOB_BASE_URL + VITE_GLOB_API_URL, + apiUrl: VITE_GLOB_API_URL, shortName: VITE_GLOB_APP_SHORT_NAME, urlPrefix: VITE_GLOB_API_URL_PREFIX, uploadUrl: VITE_GLOB_UPLOAD_URL, diff --git a/src/views/infra/druid/index.vue b/src/views/infra/druid/index.vue index 1a2c4a9a..9cd49ff8 100644 --- a/src/views/infra/druid/index.vue +++ b/src/views/infra/druid/index.vue @@ -7,7 +7,5 @@ import { ref } from 'vue' import { IFrame } from '@/components/IFrame' -const BASE_URL = import.meta.env.VITE_GLOB_BASE_URL -// const src = ref(BASE_URL + '/doc.html') -const src = ref(BASE_URL + '/druid/index.html') +const src = ref(import.meta.env.VITE_GLOB_BASE_URL + '/druid/index.html') diff --git a/src/views/infra/server/index.vue b/src/views/infra/server/index.vue index 964af124..3e2beb87 100644 --- a/src/views/infra/server/index.vue +++ b/src/views/infra/server/index.vue @@ -7,7 +7,5 @@ import { ref } from 'vue' import { IFrame } from '@/components/IFrame' -const BASE_URL = import.meta.env.VITE_GLOB_BASE_URL -// const src = ref(BASE_URL + '/doc.html') -const src = ref(BASE_URL + '/admin/applications') +const src = ref(import.meta.env.VITE_GLOB_BASE_URL + '/admin/applications') diff --git a/src/views/infra/swagger/index.vue b/src/views/infra/swagger/index.vue index fb4f1135..808afe0a 100644 --- a/src/views/infra/swagger/index.vue +++ b/src/views/infra/swagger/index.vue @@ -7,7 +7,5 @@ import { ref } from 'vue' import { IFrame } from '@/components/IFrame' -const BASE_URL = import.meta.env.VITE_GLOB_BASE_URL -// const src = ref(BASE_URL + '/doc.html') -const src = ref(BASE_URL + '/swagger-ui') +const src = ref(import.meta.env.VITE_GLOB_BASE_URL + '/swagger-ui')