feat: jump to page after successful form submission

This commit is contained in:
chenos 2021-04-25 11:54:23 +08:00
parent 3268267ccd
commit 6c75950b6a

View File

@ -76,41 +76,50 @@ export function Page(props: any) {
message.success('草稿保存成功');
return;
}
if (
view.draft.returnType === 'message' &&
view.draft.message
) {
Modal.success({
title: '草稿保存成功',
content: (
<div
dangerouslySetInnerHTML={{
__html: markdown(view.draft.message),
}}
/>
),
});
} 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: (
<div
dangerouslySetInnerHTML={{
__html: markdown(view.draft.message),
}}
/>
),
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: (
<div
dangerouslySetInnerHTML={{
__html: markdown(view.message),
}}
/>
),
});
} else if (view.returnType === 'redirect') {
const path = get(view, 'redirect.name');
path && history.push(`${path}`);
if (!view.message) {
return;
}
Modal.success({
title: '提交成功',
content: (
<div
dangerouslySetInnerHTML={{
__html: markdown(view.message),
}}
/>
),
onOk: () => {
const path = get(view, 'redirect.name');
path && history.push(`${path}`);
},
onCancel: () => {
const path = get(view, 'redirect.name');
path && history.push(`${path}`);
},
});
}}
viewName={viewName}
/>