From a7c37bce14e79a9513ac1082cb67868e791a6141 Mon Sep 17 00:00:00 2001 From: shizhong <124974919@qq.com> Date: Mon, 11 Mar 2024 12:59:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E8=AE=BE=E6=96=BD=EF=BC=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=89=8D=E7=AB=AF=E7=9B=B4=E8=BF=9E=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=96=87=E4=BB=B6=E5=88=B0S3=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/infra/file/index.vue | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) 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() }