Optimize code

This commit is contained in:
2024-03-01 15:34:01 +08:00
parent 935a1a223a
commit fb94ae6a52
7 changed files with 56 additions and 9 deletions

View File

@@ -46,7 +46,7 @@ const Base = () => {
return ( return (
<> <>
<SettingsCard <SettingsCard
icon={IconOxygenEmail} icon={IconOxygenBase}
title={'基础'} title={'基础'}
loading={loading} loading={loading}
onReset={handleOnReset} onReset={handleOnReset}

View File

@@ -17,6 +17,8 @@ const Mail = () => {
const handleOnTest = () => { const handleOnTest = () => {
void modal.confirm({ void modal.confirm({
title: '发送测试邮件', title: '发送测试邮件',
getContainer: false,
centered: true,
maskClosable: true, maskClosable: true,
content: ( content: (
<> <>
@@ -27,7 +29,11 @@ const Mail = () => {
style={{ marginTop: 10 }} style={{ marginTop: 10 }}
rules={[{ required: true, type: 'email' }]} rules={[{ required: true, type: 'email' }]}
> >
<AntdInput /> <AntdInput
ref={(input) => {
input?.focus()
}}
/>
</AntdForm.Item> </AntdForm.Item>
</AntdForm> </AntdForm>
<AntdTag style={{ whiteSpace: 'normal' }}> <AntdTag style={{ whiteSpace: 'normal' }}>
@@ -56,7 +62,7 @@ const Mail = () => {
}, },
() => { () => {
return new Promise((_, reject) => { return new Promise((_, reject) => {
reject('输入接收者') reject('输入有误')
}) })
} }
) )

View File

@@ -232,6 +232,7 @@ const Base = () => {
compileForm.setFieldValue('entryFileName', undefined) compileForm.setFieldValue('entryFileName', undefined)
void modal.confirm({ void modal.confirm({
title: '编译', title: '编译',
centered: true,
maskClosable: true, maskClosable: true,
content: ( content: (
<> <>
@@ -537,6 +538,8 @@ const Base = () => {
const handleOnAddFile = () => { const handleOnAddFile = () => {
void modal.confirm({ void modal.confirm({
title: '新建文件', title: '新建文件',
getContainer: false,
centered: true,
maskClosable: true, maskClosable: true,
content: ( content: (
<AntdForm form={addFileForm}> <AntdForm form={addFileForm}>
@@ -565,7 +568,11 @@ const Base = () => {
}) })
]} ]}
> >
<AntdInput /> <AntdInput
ref={(input) => {
input?.focus()
}}
/>
</AntdForm.Item> </AntdForm.Item>
</AntdForm> </AntdForm>
), ),
@@ -714,6 +721,8 @@ const Base = () => {
renameFileForm.setFieldValue('fileName', fileName) renameFileForm.setFieldValue('fileName', fileName)
void modal.confirm({ void modal.confirm({
title: '重命名文件', title: '重命名文件',
getContainer: false,
centered: true,
maskClosable: true, maskClosable: true,
content: ( content: (
<AntdForm form={renameFileForm}> <AntdForm form={renameFileForm}>
@@ -745,7 +754,11 @@ const Base = () => {
}) })
]} ]}
> >
<AntdInput /> <AntdInput
ref={(input) => {
input?.focus()
}}
/>
</AntdForm.Item> </AntdForm.Item>
</AntdForm> </AntdForm>
), ),

View File

@@ -399,6 +399,8 @@ const Template = () => {
const handleOnAddFile = () => { const handleOnAddFile = () => {
void modal.confirm({ void modal.confirm({
title: '新建文件', title: '新建文件',
getContainer: false,
centered: true,
maskClosable: true, maskClosable: true,
content: ( content: (
<AntdForm form={addFileForm}> <AntdForm form={addFileForm}>
@@ -427,7 +429,11 @@ const Template = () => {
}) })
]} ]}
> >
<AntdInput /> <AntdInput
ref={(input) => {
input?.focus()
}}
/>
</AntdForm.Item> </AntdForm.Item>
</AntdForm> </AntdForm>
), ),
@@ -579,6 +585,8 @@ const Template = () => {
renameFileForm.setFieldValue('fileName', fileName) renameFileForm.setFieldValue('fileName', fileName)
void modal.confirm({ void modal.confirm({
title: '重命名文件', title: '重命名文件',
getContainer: false,
centered: true,
maskClosable: true, maskClosable: true,
content: ( content: (
<AntdForm form={renameFileForm}> <AntdForm form={renameFileForm}>
@@ -610,7 +618,11 @@ const Template = () => {
}) })
]} ]}
> >
<AntdInput /> <AntdInput
ref={(input) => {
input?.focus()
}}
/>
</AntdForm.Item> </AntdForm.Item>
</AntdForm> </AntdForm>
), ),

View File

@@ -195,6 +195,7 @@ const Tools = () => {
form.setFieldValue('pass', undefined) form.setFieldValue('pass', undefined)
void modal.confirm({ void modal.confirm({
title: '审核', title: '审核',
centered: true,
maskClosable: true, maskClosable: true,
content: ( content: (
<AntdForm form={form}> <AntdForm form={form}>

View File

@@ -336,6 +336,8 @@ const User = () => {
{value.username} {value.username}
</> </>
), ),
getContainer: false,
centered: true,
maskClosable: true, maskClosable: true,
content: ( content: (
<AntdForm <AntdForm
@@ -356,7 +358,11 @@ const User = () => {
} }
]} ]}
> >
<AntdInput.Password /> <AntdInput.Password
ref={(input) => {
input?.focus()
}}
/>
</AntdForm.Item> </AntdForm.Item>
<AntdForm.Item <AntdForm.Item
name={'passwordConfirm'} name={'passwordConfirm'}

View File

@@ -262,6 +262,8 @@ const Tools = () => {
const handleOnUpgradeTool = (tool: ToolVo) => { const handleOnUpgradeTool = (tool: ToolVo) => {
void modal.confirm({ void modal.confirm({
title: '更新工具', title: '更新工具',
getContainer: false,
centered: true,
maskClosable: true, maskClosable: true,
content: ( content: (
<> <>
@@ -285,7 +287,14 @@ const Tools = () => {
} }
]} ]}
> >
<AntdInput maxLength={10} showCount placeholder={'请输入版本'} /> <AntdInput
maxLength={10}
showCount
placeholder={'请输入版本'}
ref={(input) => {
input?.focus()
}}
/>
</AntdForm.Item> </AntdForm.Item>
</AntdForm> </AntdForm>
</> </>