From 33dc67244057e9be58f3bb1b726441070196f7f1 Mon Sep 17 00:00:00 2001 From: Mrx <18278715334@163.com> Date: Mon, 6 Apr 2026 17:34:42 +0800 Subject: [PATCH] f --- .../components/EnterpriseInfo.vue | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/pages/certification/components/EnterpriseInfo.vue b/src/pages/certification/components/EnterpriseInfo.vue index 6da8fac..3d71ea3 100644 --- a/src/pages/certification/components/EnterpriseInfo.vue +++ b/src/pages/certification/components/EnterpriseInfo.vue @@ -121,7 +121,7 @@ - +
请在非 IE 浏览器下上传大小不超过 1M 的图片,最多 10 张,需体现门楣 LOGO、办公设备与工作人员。
@@ -303,7 +303,7 @@ - +
请在非 IE 浏览器下上传大小不超过 1M 的图片,最多 10 张后台应用截图。
@@ -493,6 +493,24 @@ const validatePhone = (rule, value, callback) => { callback() } +// 数组字段必填验证(至少上传/选择一项) +const validateRequiredArray = (message) => (rule, value, callback) => { + if (!Array.isArray(value) || value.length === 0) { + callback(new Error(message)) + return + } + callback() +} + +// 授权代表身份证要求:正反面都必须上传 +const validateAuthorizedRepIDImages = (rule, value, callback) => { + if (!Array.isArray(value) || value.length < 2) { + callback(new Error('请上传授权代表身份证正反面图片')) + return + } + callback() +} + // 表单验证规则 const enterpriseRules = { companyName: [ @@ -527,11 +545,17 @@ const enterpriseRules = { businessLicenseImageURL: [ { required: true, message: '请上传营业执照图片', trigger: 'change' } ], + officePlaceImageURLs: [ + { validator: validateRequiredArray('请上传办公场地照片'), trigger: 'change' } + ], // 暂时隐藏的表单项,校验已关闭,恢复显示时请还原 apiUsage: [ { required: true, message: '请填写接口用途', trigger: 'blur' }, { min: 5, max: 500, message: '接口用途长度应在5-500个字符之间', trigger: 'blur' } ], + scenarioAttachmentURLs: [ + { validator: validateRequiredArray('请上传应用场景附件'), trigger: 'change' } + ], authorizedRepName: [ { required: true, message: '请输入授权代表姓名', trigger: 'blur' }, { min: 2, max: 20, message: '授权代表姓名长度应在2-20个字符之间', trigger: 'blur' } @@ -545,7 +569,7 @@ const enterpriseRules = { { validator: validatePhone, trigger: 'blur' } ], authorizedRepIDImageURLs: [ - { required: true, message: '请上传授权代表身份证正反面图片', trigger: 'change' } + { validator: validateAuthorizedRepIDImages, trigger: 'change' } ] } @@ -798,6 +822,7 @@ const updateAuthorizedRepIDImageURLs = () => { if (frontUrl) urls.push(frontUrl) if (backUrl) urls.push(backUrl) form.value.authorizedRepIDImageURLs = urls + enterpriseFormRef.value?.validateField('authorizedRepIDImageURLs') } // 办公场地图片变更:选择即上传 @@ -807,11 +832,13 @@ const handleOfficePlaceChange = async (file, fileList) => { await uploadFileOnceSelected(file) } form.value.officePlaceImageURLs = extractUrls(fileList) + enterpriseFormRef.value?.validateField('officePlaceImageURLs') } const handleOfficePlaceRemove = (file, fileList) => { officePlaceFileList.value = fileList form.value.officePlaceImageURLs = extractUrls(fileList) + enterpriseFormRef.value?.validateField('officePlaceImageURLs') } // 应用场景附件图片变更:选择即上传 @@ -821,11 +848,13 @@ const handleScenarioChange = async (file, fileList) => { await uploadFileOnceSelected(file) } form.value.scenarioAttachmentURLs = extractUrls(fileList) + enterpriseFormRef.value?.validateField('scenarioAttachmentURLs') } const handleScenarioRemove = (file, fileList) => { scenarioFileList.value = fileList form.value.scenarioAttachmentURLs = extractUrls(fileList) + enterpriseFormRef.value?.validateField('scenarioAttachmentURLs') } // 提交表单