diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 538a4438a..a61064b73 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -11,7 +11,6 @@ const globalStore = GlobalStore(); const config = { baseURL: import.meta.env.VITE_API_URL as string, timeout: ResultEnum.TIMEOUT as number, - // 跨域时候允许携带凭证 withCredentials: true, }; @@ -81,6 +80,9 @@ class RequestHttp { download(url: string, params?: object, _object = {}): Promise { return this.service.post(url, params, _object); } + upload(url: string, params: object = {}, config: AxiosRequestConfig): Promise { + return this.service.post(url, params, config); + } } export default new RequestHttp(config); diff --git a/frontend/src/api/modules/files.ts b/frontend/src/api/modules/files.ts index bc78ef289..699c33104 100644 --- a/frontend/src/api/modules/files.ts +++ b/frontend/src/api/modules/files.ts @@ -1,5 +1,6 @@ import { File } from '@/api/interface/file'; import http from '@/api'; +import { AxiosRequestConfig } from 'axios'; export const GetFilesList = (params: File.ReqFile) => { return http.post('files/search', params); @@ -37,8 +38,8 @@ export const SaveFileContent = (params: File.FileEdit) => { return http.post('files/save', params); }; -export const UploadFileData = (params: FormData) => { - return http.post('files/upload', params); +export const UploadFileData = (params: FormData, config: AxiosRequestConfig) => { + return http.upload('files/upload', params, config); }; export const RenameRile = (params: File.FileRename) => { diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index dcdcfb2a0..14ac17395 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -244,5 +244,6 @@ export default { copy: 'Cpoy', calculate: 'Calculate', canNotDeCompress: 'Can not DeCompress this File', + uploadSuccess: 'Upload Success!', }, }; diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 06d364feb..170e6b2b5 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -244,5 +244,6 @@ export default { copy: '复制', calculate: '计算', canNotDeCompress: '无法解压此文件', + uploadSuccess: '上传成功!', }, }; diff --git a/frontend/src/views/host/file-management/upload/index.vue b/frontend/src/views/host/file-management/upload/index.vue index f975fa38f..f9bea047f 100644 --- a/frontend/src/views/host/file-management/upload/index.vue +++ b/frontend/src/views/host/file-management/upload/index.vue @@ -1,14 +1,24 @@