diff --git a/src/views/infra/file/index.vue b/src/views/infra/file/index.vue index 57a89a5c..dba465c5 100644 --- a/src/views/infra/file/index.vue +++ b/src/views/infra/file/index.vue @@ -43,8 +43,7 @@ @@ -83,7 +83,7 @@ import type { UploadInstance, UploadRawFile, UploadProps, UploadFile } from 'ele // 业务相关的 import import { allSchemas } from './fileList.data' import * as FileApi from '@/api/infra/fileList' -import { getAccessToken, getTenantId } from '@/utils/auth' +import { useUpload } from '@/components/UploadFile/src/useUpload' // import { useClipboard } from '@vueuse/core' defineOptions({ name: 'InfraFile' }) @@ -106,8 +106,7 @@ const uploadDialogTitle = ref('上传') const updateSupport = ref(0) const uploadDisabled = ref(false) const uploadRef = ref() -let updateUrl = import.meta.env.VITE_UPLOAD_URL -const uploadHeaders = ref() +const { uploadUrl, httpRequest } = useUpload() // 文件上传之前判断 const beforeUpload = (file: UploadRawFile) => { const isImg = file.type === 'image/jpeg' || 'image/gif' || 'image/png' @@ -124,10 +123,6 @@ const handleFileChange = (uploadFile: UploadFile): void => { } // 文件上传 const submitFileForm = () => { - uploadHeaders.value = { - Authorization: 'Bearer ' + getAccessToken(), - 'tenant-id': getTenantId() - } uploadDisabled.value = true uploadRef.value!.submit() }