From 253ed14c872f343c34abb31dafc516adaca1bfe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wei=5F=E4=BD=B3?= Date: Tue, 2 Dec 2025 16:39:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E4=B8=8A=E4=BC=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A2=9E=E5=8A=A0=E4=BA=86=E6=96=87=E4=BB=B6=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E5=92=8C=E5=A4=A7=E5=B0=8F=E9=99=90=E5=88=B6=E5=8F=8A?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=89=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web1/src/views/pages/index.vue | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/web1/src/views/pages/index.vue b/web1/src/views/pages/index.vue index 558a4e0..462c909 100644 --- a/web1/src/views/pages/index.vue +++ b/web1/src/views/pages/index.vue @@ -298,7 +298,9 @@ @@ -402,9 +404,11 @@
@@ -435,9 +439,11 @@
@@ -933,6 +939,8 @@ const steps = [ ] const loading = ref(false) const actionUrl = 'https://value.cdcee.net/api/v1/upload/file' +const uploadLimit = 10 +const uploadMaxSize = 20 * 1024 * 1024 const currentStep = ref(0) const historyList = ref([]) const modalForm = reactive({ @@ -1411,10 +1419,28 @@ const handleFinish2 = (file) => { modalForm.pattern_images.push({ url: response.data.url, id: file.file.batchId }) } const handleFinish3 = (file) => { - console.log(file) let response = JSON.parse(file.event.target.response) modalForm.inheritor_certificates.push({ url: response.data.url, id: file.file.batchId }) } +type UploadKey = 'inheritor_certificates' | 'patent_certificates' | 'pattern_images' +const handleBeforeUpload = (options: any, key: UploadKey) => { + const map: Record = { + inheritor_certificates: modalForm.inheritor_certificates, + patent_certificates: modalForm.patent_certificates, + pattern_images: modalForm.pattern_images, + } + const currentList = map[key] || [] + if (currentList.length >= uploadLimit) { + message.error(`最多上传${uploadLimit}张`) + return false + } + const size = options?.file?.file?.size || 0 + if (size > uploadMaxSize) { + message.error('单张文件大小不能超过20M') + return false + } + return true +} const delete1 = (file) => { const index = modalForm.patent_certificates.findIndex((item) => item.id === file.file.batchId) if (index !== -1) { @@ -1432,7 +1458,6 @@ const delete3 = (file) => { if (index !== -1) { modalForm.inheritor_certificates.splice(index, 1) } - console.log(modalForm.inheritor_certificates) } const previousStep = () => { console.log(modalForm)