From 1f508d31d2ff7e8bea91402f586dbea336c0b8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=A5=81?= <593401899@qq.com> Date: Thu, 15 May 2025 12:58:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(infra):=20=E6=96=87=E4=BB=B6=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=94=AF=E6=8C=81=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增使用相对路径的选项和相关配置 - 添加相对路径前缀的输入框- 修改自定义域名的显示逻辑 - 更新 FileConfigApi 接口,增加相对路径相关字段- 在 vite 配置中添加 /file 路径的代理设置 --- src/api/infra/fileConfig/index.ts | 4 ++- src/views/infra/fileConfig/FileConfigForm.vue | 25 ++++++++++++++++--- vite.config.ts | 8 ++++++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/api/infra/fileConfig/index.ts b/src/api/infra/fileConfig/index.ts index acdd2024c..c1ea778bc 100644 --- a/src/api/infra/fileConfig/index.ts +++ b/src/api/infra/fileConfig/index.ts @@ -12,7 +12,9 @@ export interface FileClientConfig { accessKey?: string accessSecret?: string enablePathStyleAccess?: boolean - domain: string + domain: string, + relativePathPrefix?: string, + useRelativePath: boolean } export interface FileConfigVO { diff --git a/src/views/infra/fileConfig/FileConfigForm.vue b/src/views/infra/fileConfig/FileConfigForm.vue index 4f1cc2371..e9dce5c3d 100644 --- a/src/views/infra/fileConfig/FileConfigForm.vue +++ b/src/views/infra/fileConfig/FileConfigForm.vue @@ -94,11 +94,23 @@ - + + + + + + + + + + - + @@ -127,7 +139,9 @@ const formData = ref({ name: '', storage: 0, remark: '', - config: {} as FileConfigApi.FileClientConfig + config: { + useRelativePath: false // 默认值 + } as FileConfigApi.FileClientConfig }) const formRules = reactive({ name: [{ required: true, message: '配置名不能为空', trigger: 'blur' }], @@ -143,6 +157,7 @@ const formRules = reactive({ bucket: [{ required: true, message: '存储 bucket 不能为空', trigger: 'blur' }], accessKey: [{ required: true, message: 'accessKey 不能为空', trigger: 'blur' }], accessSecret: [{ required: true, message: 'accessSecret 不能为空', trigger: 'blur' }], + useRelativePath: [{ required: true, message: '是否使用相对路径不能为空', trigger: 'change'}], enablePathStyleAccess: [ { required: true, message: '是否 PathStyle 访问不能为空', trigger: 'change' } ], @@ -202,7 +217,9 @@ const resetForm = () => { name: '', storage: undefined!, remark: '', - config: {} as FileConfigApi.FileClientConfig + config: { + useRelativePath: false // 默认值 + } as FileConfigApi.FileClientConfig } formRef.value?.resetFields() } diff --git a/vite.config.ts b/vite.config.ts index a10bcfb58..214e7ecf6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -37,6 +37,14 @@ export default ({command, mode}: ConfigEnv): UserConfig => { // rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''), // }, // }, + proxy: { + ['/file']: { + target: env.VITE_BASE_URL, + ws: false, + changeOrigin: true, + rewrite: (path) => path.replace(new RegExp(`^/file`), ''), + }, + }, }, // 项目使用的vite插件。 单独提取到build/vite/plugin中管理 plugins: createVitePlugins(), -- Gitee