rbac/wwwroot/user/login.ui
yumoqing 7200ee43a0 fix: 手机验证码gen_code按钮用datawidget/datamethod传表单值给script
原script中this.getValue()在toolbar tool事件上下文中拿不到表单数据,
改用datawidget/datamethod机制将表单值通过params传入script。
回写codeid用.bind(this)保持Form引用。
2026-05-28 14:10:37 +08:00

159 lines
7.0 KiB
XML

{
"id": "login_window",
"widgettype": "PopupWindow",
"options": {
"title": "登录/注册",
"auto_open": true,
"anthor": "cc",
"cwidth": 22,
"cheight": 22
},
"subwidgets": [
{
"widgettype": "TabPanel",
"options": {
"tab_wide": "auto",
"height": "100%",
"width": "100%",
"tab_pos": "top",
"items": [
{
"name": "userpasswd",
"label": "用户密码",
"content": {
"widgettype": "Form",
"options": {
"cols": 1,
"fields": [
{
"name": "username",
"label": "用户名",
"uitype": "str"
},
{
"name": "password",
"label": "密码",
"uitype": "password"
}
]
},
"binds": [
{
"wid": "self",
"event": "submit",
"actiontype": "urlwidget",
"target": "self",
"options": {
"method": "POST",
"url": "{{entire_url('up_login.dspy')}}"
}
}
]
}
},
{
"name": "checkcode",
"label": "手机验证码",
"content": {
"widgettype": "Form",
"options": {
"description": "限中国国内手机",
"fields": [
{
"name": "cell_no",
"label": "手机号",
"uitype": "str"
},
{
"name": "codeid",
"uitype": "hide",
"value": ""
},
{
"name": "check_code",
"label": "验证码",
"uitype": "str"
}
],
"toolbar": {
"tools": [
{
"name": "gen_code",
"label": "发送验证码"
}
]
}
},
"binds": [
{
"wid": "self",
"event": "gen_code",
"actiontype": "script",
"datawidget": "self",
"datamethod": "getValue",
"target": "self",
"script": "var cell=params.cell_no;if(!cell){alert('请输入手机号');return;}fetch(bricks.app.baseUrl+'/rbac/gen_sms_code.dspy?cellphone='+encodeURIComponent(cell)).then(function(r){return r.json()}).then(function(d){if(d.status==='ok'){this.setValue({codeid:d.data.key});alert('验证码已发送')}else{alert(d.data.message)}}.bind(this)).catch(function(e){alert('发送失败:'+e)})"
},
{
"wid": "self",
"event": "submit",
"actiontype": "urlwidget",
"target": "self",
"options": {
"method": "POST",
"url": "{{entire_url('code_login.dspy')}}"
}
}
]
}
},
{
"name": "register",
"label": "注册",
"content": {
"widgettype": "Form",
"options": {
"cols": 1,
"fields": [
{
"name": "username",
"label": "用户名",
"uitype": "str"
},
{
"name": "mobile",
"label": "手机号",
"uitype": "str"
},
{
"name": "password",
"label": "密码",
"uitype": "password"
},
{
"name": "cfm_password",
"label": "确认密码",
"uitype": "password"
}
]
},
"binds": [
{
"wid": "self",
"event": "submit",
"actiontype": "urlwidget",
"target": "self",
"options": {
"method": "POST",
"url": "{{entire_url('register.dspy')}}"
}
}
]
}
}
]
}
}
]
}