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,10 +76,9 @@ export function Page(props: any) {
message.success('草稿保存成功'); message.success('草稿保存成功');
return; return;
} }
if ( if (!view.draft.message) {
view.draft.returnType === 'message' && return;
view.draft.message }
) {
Modal.success({ Modal.success({
title: '草稿保存成功', title: '草稿保存成功',
content: ( content: (
@ -89,14 +88,20 @@ export function Page(props: any) {
}} }}
/> />
), ),
}); onCancel: () => {
} else if (view.draft.returnType === 'redirect') { const path = get(view, 'redirect.name');
const path = get(view, 'draft.redirect.name');
path && history.push(`${path}`); path && history.push(`${path}`);
} },
onOk: () => {
const path = get(view, 'redirect.name');
path && history.push(`${path}`);
},
});
}} }}
onFinish={() => { onFinish={() => {
if (view.returnType === 'message' && view.message) { if (!view.message) {
return;
}
Modal.success({ Modal.success({
title: '提交成功', title: '提交成功',
content: ( content: (
@ -106,11 +111,15 @@ export function Page(props: any) {
}} }}
/> />
), ),
}); onOk: () => {
} else if (view.returnType === 'redirect') {
const path = get(view, 'redirect.name'); const path = get(view, 'redirect.name');
path && history.push(`${path}`); path && history.push(`${path}`);
} },
onCancel: () => {
const path = get(view, 'redirect.name');
path && history.push(`${path}`);
},
});
}} }}
viewName={viewName} viewName={viewName}
/> />