From 289e582ba1110a19ea7eb665ee951f5c98bab756 Mon Sep 17 00:00:00 2001 From: jinhhanhan <1683105490@qq.com> Date: Fri, 7 Aug 2026 10:35:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor(form):=20=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BC=A9=E8=BF=9B=E4=B8=8E=E6=A0=BC=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8F=90=E4=BA=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 统一模板缩进为制表符,移除冗余日志,将提交数据内联至请求参数以精简代码结构 --- pages_tool/form/formdata.vue | 42 +++++++++++++++--------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/pages_tool/form/formdata.vue b/pages_tool/form/formdata.vue index 2cc2d6d..abd2f62 100644 --- a/pages_tool/form/formdata.vue +++ b/pages_tool/form/formdata.vue @@ -2,22 +2,18 @@ - - - - + + - + @@ -81,7 +77,7 @@ export default { } }, onLoad(options) { - console.log("=====表单页面====",options) + console.log("=====表单页面====", options) if (!options.uniacid) { uni.showModal({ title: this.$lang('form.formdata.tip'), @@ -139,7 +135,7 @@ export default { this.getData() }, - + watch: { storeToken(newVal, oldVal) { newVal && this.getData() @@ -184,22 +180,18 @@ export default { // 因此内部所有 this.xxx 都指向 formdata 实例,不会漂移到子组件。 create(formData) { // 防重复提交:console 在拦截之前,避免日志噪声;拦截后立即置位 - if (this.isRepeat) return + if (this.isRepeat) return; - const data = { - form_id: this.id, - form_data: typeof formData === 'string' ? formData : JSON.stringify(formData), - uniacid: this.uniacid, - url_params: JSON.stringify(this.urlParams), - member_id: this.memberInfo ? this.memberInfo.id : 0 - } - console.log(`=====表单提交====`, data); - - - this.isRepeat = true + this.isRepeat = true; this.$api.sendRequest({ url: '/form/api/form/create', - data, + data: { + form_id: this.id, + form_data: typeof formData === 'string' ? formData : JSON.stringify(formData), + uniacid: this.uniacid, + url_params: JSON.stringify(this.urlParams), + member_id: this.memberInfo ? this.memberInfo.id : 0 + }, success: res => { if (res.code == 0) { this.complete = true