Refactor(Modal): Optimize modal code

This commit is contained in:
2024-05-01 16:12:57 +08:00
parent 0ca5d8fc52
commit 80bec52fcd
4 changed files with 14 additions and 11 deletions

View File

@@ -112,8 +112,8 @@ const SignIn = () => {
case PERMISSION_NEED_TWO_FACTOR:
twoFactorForm.resetFields()
void modal.confirm({
title: '双因素验证',
centered: true,
title: '双因素验证',
footer: (_, { OkBtn, CancelBtn }) => (
<>
<OkBtn />

View File

@@ -16,9 +16,9 @@ const Mail = () => {
const handleOnTest = () => {
void modal.confirm({
title: '发送测试邮件',
centered: true,
maskClosable: true,
title: '发送测试邮件',
footer: (_, { OkBtn, CancelBtn }) => (
<>
<OkBtn />

View File

@@ -219,8 +219,9 @@ const Tools = () => {
const handleOnDeleteTool = (tool: ToolVo) => {
modal
.confirm({
title: '删除',
centered: true,
maskClosable: true,
title: '删除',
content: `确定删除工具 ${tool.toolId}:${tool.platform.slice(0, 1)}${tool.platform.slice(1).toLowerCase()}:${tool.ver} 吗?`
})
.then(
@@ -249,9 +250,9 @@ const Tools = () => {
const handleOnUpgradeTool = (tool: ToolVo) => {
void modal.confirm({
title: '更新工具',
centered: true,
maskClosable: true,
title: '更新工具',
footer: (_, { OkBtn, CancelBtn }) => (
<>
<OkBtn />
@@ -361,8 +362,9 @@ const Tools = () => {
const handleOnSubmitTool = (tool: ToolVo) => {
modal
.confirm({
title: '提交审核',
centered: true,
maskClosable: true,
title: '提交审核',
content: `确定提交审核工具 ${tool.name}:${tool.ver} 吗?`
})
.then(
@@ -400,8 +402,9 @@ const Tools = () => {
const handleOnCancelTool = (tool: ToolVo) => {
modal
.confirm({
title: '取消审核',
centered: true,
maskClosable: true,
title: '取消审核',
content: `确定取消审核工具 ${tool.name}:${tool.ver} 吗?`
})
.then(

View File

@@ -89,6 +89,8 @@ const User = () => {
changePasswordForm.resetFields()
void modal.confirm({
centered: true,
maskClosable: true,
icon: <></>,
title: (
<>
@@ -99,8 +101,6 @@ const User = () => {
</>
),
centered: true,
maskClosable: true,
footer: (_, { OkBtn, CancelBtn }) => (
<>
<OkBtn />
@@ -220,10 +220,10 @@ const User = () => {
twoFactorForm.resetFields()
if (enable) {
void modal.confirm({
title: '双因素',
centered: true,
maskClosable: true,
focusTriggerAfterClose: false,
title: '双因素',
footer: (_, { OkBtn, CancelBtn }) => (
<>
<OkBtn />
@@ -233,9 +233,9 @@ const User = () => {
content: '确定解除双因素?',
onOk: () => {
void modal.confirm({
title: '解除双因素',
centered: true,
maskClosable: true,
title: '解除双因素',
footer: (_, { OkBtn, CancelBtn }) => (
<>
<OkBtn />
@@ -313,9 +313,9 @@ const User = () => {
const response = res.data
if (response.success) {
void modal.confirm({
title: '绑定双因素',
centered: true,
maskClosable: true,
title: '绑定双因素',
footer: (_, { OkBtn, CancelBtn }) => (
<>
<OkBtn />