From 733e393cc1712bfff002161001d097efde89b726 Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Thu, 14 Sep 2023 16:04:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=B4=A2=E5=8A=A1=E6=8F=90?= =?UTF-8?q?=E7=8E=B0=E7=94=B3=E8=AF=B7=E5=AE=A1=E6=89=B9=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 ++-- .env.production | 2 +- src/views/finance/audit.vue | 14 +++++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.env.development b/.env.development index 8668941..7fd34e6 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,5 @@ NODE_ENV = 'development' -VITE_APP_BASE_URL = 'https://ceshi-worker-task.lihaink.cn/' +VITE_APP_BASE_URL = 'https://ceshi-worker-task.lihaink.cn' -# VITE_APP_BASE_URL = 'https://worker-task.lihaink.cn/' \ No newline at end of file +# VITE_APP_BASE_URL = 'https://worker-task.lihaink.cn' \ No newline at end of file diff --git a/.env.production b/.env.production index 59e8371..30a420c 100644 --- a/.env.production +++ b/.env.production @@ -2,4 +2,4 @@ VITE_APP_BASE_URL = '' -# VITE_APP_BASE_URL = 'https://worker-task.lihaink.cn/' \ No newline at end of file +# VITE_APP_BASE_URL = 'https://worker-task.lihaink.cn' \ No newline at end of file diff --git a/src/views/finance/audit.vue b/src/views/finance/audit.vue index 4330e94..b7d2907 100644 --- a/src/views/finance/audit.vue +++ b/src/views/finance/audit.vue @@ -66,7 +66,7 @@ style="width: 100%" drag :headers="{ Token: userStore.token }" - :action="base_url + '/upload/file'" + :action="actionUrl" :limit="1" :on-success="handleFile" :on-exceed="handleExceed" @@ -186,6 +186,10 @@ const getDetail = async (row: Record<string, any>) => { setFormData(data); }; +// 文件选择 +const upload = ref(null); +// 文件上传地址 +const actionUrl = ref(""); const fileTypeList = [ "application/pdf", "image/jpeg", @@ -198,10 +202,14 @@ const beforeUpload = (rawFile: UploadRawFile) => { ElMessage.error("请上传JPG/JPEG/PNG/GIF/PDF文件"); return false; } + if (rawFile.type != "application/pdf") { + actionUrl.value = base_url + "/upload/image"; + } else { + actionUrl.value = base_url + "/upload/file"; + } + return true; }; -// 文件选择 -const upload = ref(null); const handleExceed = (files: any) => { upload.value!.clearFiles(); const file = files[0] as UploadRawFile;