From 14a24e7e06e8873566807eeec227a2d75ee4c471 Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Tue, 2 Sep 2025 19:12:30 +0800 Subject: [PATCH] =?UTF-8?q?refactor(postConsult):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E9=AA=8C=E8=AF=81=E9=80=BB=E8=BE=91=E5=92=8C?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将表单验证和文件上传初始化的逻辑分开处理,更清晰地根据字段类型和必填状态进行初始化。对于文本输入类型,仅在必填时设置验证提示;对于图片上传类型,无论是否必填都初始化fileMapList数组。 --- pages_order/work/postConsult.vue | 15 +++++++++------ uni_modules/employ-front | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) create mode 160000 uni_modules/employ-front diff --git a/pages_order/work/postConsult.vue b/pages_order/work/postConsult.vue index d9ea4fd..bc9bb76 100644 --- a/pages_order/work/postConsult.vue +++ b/pages_order/work/postConsult.vue @@ -181,15 +181,18 @@ this.formList = res.result.employMaterialList res.result.employMaterialList.forEach(n => { - if(n.isFill != 1){ - return - } if(n.type == 0){ - this.verification[n.keyName] = '请输入' + n.title + // 文本输入类型 + if(n.isFill == 1){ + this.verification[n.keyName] = '请输入' + n.title + } this.form[n.keyName] = '' }else{ - this.verification[n.keyName] = '请上传' + n.title - // this.fileMapList[n.keyName] = [] + // 图片上传类型 + if(n.isFill == 1){ + this.verification[n.keyName] = '请上传' + n.title + } + // 无论必填还是非必填,都需要初始化fileMapList this.$set(this.fileMapList, n.keyName, []) } }) diff --git a/uni_modules/employ-front b/uni_modules/employ-front new file mode 160000 index 0000000..a2e1192 --- /dev/null +++ b/uni_modules/employ-front @@ -0,0 +1 @@ +Subproject commit a2e1192746fcce241cd52ac45b04cc8dc96f8499