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) => { 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;