From 53111aa2fd95eb6c72006476d540e5ddb84aa6ea Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 28 May 2026 16:27:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Form.getValue()=E8=BF=94=E5=9B=9EFormDat?= =?UTF-8?q?a=E5=AF=B9=E8=B1=A1=EF=BC=8C=E6=94=B9=E7=94=A8=5FgetValue()?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=99=AE=E9=80=9A=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:bricks Form的getValue()内部调用get_formdata()返回浏览器 原生FormData对象,不支持.cell_no属性访问。 改用_getValue()返回{name:value}普通JS对象。 --- wwwroot/user/login.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wwwroot/user/login.ui b/wwwroot/user/login.ui index 1b169c1..d442512 100644 --- a/wwwroot/user/login.ui +++ b/wwwroot/user/login.ui @@ -105,7 +105,7 @@ "event": "click", "actiontype": "script", "target": "self", - "script": "var form=bricks.getWidgetById('phone_form',bricks.app);if(!form){alert('form not found');return;}var vals=form.getValue();var cell=vals.cell_no;if(!cell){alert('请输入手机号');return;}this.options.label='发送中...';this.el&&(this.el.disabled=true);fetch(bricks.app.baseUrl+'/rbac/gen_sms_code.dspy?_webbricks_=1&cellphone='+encodeURIComponent(cell)).then(function(r){return r.json()}).then(function(d){var btn=bricks.getWidgetById('gen_code_btn',bricks.app);if(d.status==='ok'){form.setValue({codeid:d.data.key});if(btn){btn.options.label='已发送';btn.el&&(btn.el.disabled=false)}}else{alert(d.data.message);if(btn){btn.options.label='发送验证码';btn.el&&(btn.el.disabled=false)}}}).catch(function(e){alert('发送失败:'+e);var btn=bricks.getWidgetById('gen_code_btn',bricks.app);if(btn){btn.options.label='发送验证码';btn.el&&(btn.el.disabled=false)}})" + "script": "var form=bricks.getWidgetById('phone_form',bricks.app);if(!form){alert('form not found');return;}var vals=form._getValue();var cell=vals.cell_no;if(!cell){alert('请输入手机号');return;}this.options.label='发送中...';fetch(bricks.app.baseUrl+'/rbac/gen_sms_code.dspy?_webbricks_=1&cellphone='+encodeURIComponent(cell)).then(function(r){return r.json()}).then(function(d){var btn=bricks.getWidgetById('gen_code_btn',bricks.app);if(d.status==='ok'){form.setValue({codeid:d.data.key});if(btn){btn.options.label='已发送'}}else{alert(d.data.message);if(btn){btn.options.label='发送验证码'}}}).catch(function(e){alert('发送失败:'+e);var btn=bricks.getWidgetById('gen_code_btn',bricks.app);if(btn){btn.options.label='发送验证码'}})" } ] }