diff --git a/packages/app/src/components/pages/Page/index.tsx b/packages/app/src/components/pages/Page/index.tsx index 5d7378ed9..aae9e5d74 100644 --- a/packages/app/src/components/pages/Page/index.tsx +++ b/packages/app/src/components/pages/Page/index.tsx @@ -76,41 +76,50 @@ export function Page(props: any) { message.success('草稿保存成功'); return; } - if ( - view.draft.returnType === 'message' && - view.draft.message - ) { - Modal.success({ - title: '草稿保存成功', - content: ( -
- ), - }); - } else if (view.draft.returnType === 'redirect') { - const path = get(view, 'draft.redirect.name'); - path && history.push(`${path}`); + if (!view.draft.message) { + return; } + Modal.success({ + title: '草稿保存成功', + content: ( +
+ ), + onCancel: () => { + const path = get(view, 'redirect.name'); + path && history.push(`${path}`); + }, + onOk: () => { + const path = get(view, 'redirect.name'); + path && history.push(`${path}`); + }, + }); }} onFinish={() => { - if (view.returnType === 'message' && view.message) { - Modal.success({ - title: '提交成功', - content: ( -
- ), - }); - } else if (view.returnType === 'redirect') { - const path = get(view, 'redirect.name'); - path && history.push(`${path}`); + if (!view.message) { + return; } + Modal.success({ + title: '提交成功', + content: ( +
+ ), + onOk: () => { + const path = get(view, 'redirect.name'); + path && history.push(`${path}`); + }, + onCancel: () => { + const path = get(view, 'redirect.name'); + path && history.push(`${path}`); + }, + }); }} viewName={viewName} />