From 5bfa0a114bab39918f99c511cd45f8981bbd8239 Mon Sep 17 00:00:00 2001 From: lorne <1991wangliang@gmail.com> Date: Wed, 13 Aug 2025 12:05:18 +0800 Subject: [PATCH] update from --- admin-ui/src/pages/form/index.tsx | 306 +++++++++++++++-------------- mobile-ui/src/pages/form/index.tsx | 294 +++++++++++++-------------- 2 files changed, 307 insertions(+), 293 deletions(-) diff --git a/admin-ui/src/pages/form/index.tsx b/admin-ui/src/pages/form/index.tsx index 6936ad58..10046232 100644 --- a/admin-ui/src/pages/form/index.tsx +++ b/admin-ui/src/pages/form/index.tsx @@ -143,13 +143,6 @@ const FooterButtons: React.FC<{ formInstance: FormInstance }> = ({formInstance}) name: ['user', 'name'], label: '姓名', placeholder: '请输入姓名', - validateFunction: async (content) => { - const value = content.value; - if (value) { - return [] - } - return ['姓名不能为空'] - } }, type: 'input' }, 0); @@ -172,13 +165,6 @@ const FormPage = () => { name: ['user', 'name'], label: '姓名', placeholder: '请输入姓名', - validateFunction: async (content) => { - const value = content.value; - if (value) { - return [] - } - return ['姓名不能为空'] - } } }, { @@ -197,13 +183,6 @@ const FormPage = () => { name: ['user', 'password'], label: '银行卡密码', placeholder: '请输入银行卡密码', - validateFunction: async (content) => { - const value = content.value; - if (value) { - return [] - } - return ['银行卡密码不能为空'] - } } }, { @@ -406,196 +385,229 @@ const FormPage = () => { /> )} > - { - const value = content.value; - if (value) { - return [] + rules={[ + { + required: true, + message: '姓名不能为空' } - return ['姓名不能为空'] - }} - /> + ]} + > + + - + > + + + - { - const value = content.value; - if (value) { - return [] - } - return ['银行卡密码不能为空'] - }} - /> + > + + - { - console.log('refresh captcha') - return { - url: '/captcha.jpeg', - code: '123' - } - }} - /> + > + { + console.log('refresh captcha') + return { + url: '/captcha.jpeg', + code: '123' + } + }} + /> + - + > + + - + > + + - + > + + - + > + + - + > + + - + > + + - + > + + - + > + + - + > + + - + > + + - + > + + - + > + + diff --git a/mobile-ui/src/pages/form/index.tsx b/mobile-ui/src/pages/form/index.tsx index 0d202e81..6abe269e 100644 --- a/mobile-ui/src/pages/form/index.tsx +++ b/mobile-ui/src/pages/form/index.tsx @@ -21,7 +21,6 @@ import { import {FormField, FormInstance} from "@codingapi/ui-framework"; - const FooterButtons: React.FC<{ formInstance: FormInstance }> = ({formInstance}) => { const data = { user: { @@ -140,13 +139,6 @@ const FooterButtons: React.FC<{ formInstance: FormInstance }> = ({formInstance}) name: ['user', 'name'], label: '姓名', placeholder: '请输入姓名', - validateFunction: async (content) => { - const value = content.value; - if (value) { - return [] - } - return ['姓名不能为空'] - } }, type: 'input' }, 0); @@ -157,7 +149,7 @@ const FooterButtons: React.FC<{ formInstance: FormInstance }> = ({formInstance}) ) } -const FormPage = ()=>{ +const FormPage = () => { const [activeKey, setActiveKey] = React.useState("left"); @@ -172,13 +164,6 @@ const FormPage = ()=>{ name: ['user', 'name'], label: '姓名', placeholder: '请输入姓名', - validateFunction: async (content) => { - const value = content.value; - if (value) { - return [] - } - return ['姓名不能为空'] - } } }, { @@ -197,13 +182,6 @@ const FormPage = ()=>{ name: ['user', 'password'], label: '银行卡密码', placeholder: '请输入银行卡密码', - validateFunction: async (content) => { - const value = content.value; - if (value) { - return [] - } - return ['银行卡密码不能为空'] - } } }, { @@ -366,7 +344,7 @@ const FormPage = ()=>{
Form表单
{ + onChange={(value) => { setActiveKey(value); }} > @@ -374,12 +352,12 @@ const FormPage = ()=>{ - {activeKey ==='left' && ( + {activeKey === 'left' && ( <>
{ + onFinish={async (values) => { Toast.show(JSON.stringify(values)); }} footer={( @@ -393,12 +371,12 @@ const FormPage = ()=>{ )} - {activeKey ==='right' && ( + {activeKey === 'right' && ( <> { + onFinish={async (values) => { Toast.show(JSON.stringify(values)); }} footer={( @@ -407,172 +385,196 @@ const FormPage = ()=>{ /> )} > - { - const value = content.value; - if (value) { - return [] - } - return ['姓名不能为空'] - }} - /> - - + + + + + + > + + - { - const value = content.value; - if (value) { - return [] - } - return ['银行卡密码不能为空'] - }} - /> - - + + + + { - console.log('refresh captcha') - return { - url: '/captcha.jpeg', - code: '123' - } - }} - /> - - + { + console.log('refresh captcha') + return { + url: '/captcha.jpeg', + code: '123' + } + }} + /> + + + - - + + + + - - + + + + + > + + - + > + + - + > + + - + > + + - + > + + - - - + + + + - - + + + + - + > + + )}