优化

pull/51/head
smallbun 2023-09-17 14:19:03 +08:00
parent 1efd21543c
commit 8a7bbf55c6
3 changed files with 21 additions and 6 deletions

View File

@ -42,12 +42,16 @@ export default () => {
}; };
const [tabActiveKey, setTabActiveKey] = useState<string>(); const [tabActiveKey, setTabActiveKey] = useState<string>();
const goUserList = () => {
history.push(`/account/user`);
};
useMount(() => { useMount(() => {
if (!id) { if (!id) {
useApp.message useApp.message
.warning(intl.formatMessage({ id: 'pages.account.user_detail.user_info.not_selected' })) .warning(intl.formatMessage({ id: 'pages.account.user_detail.user_info.not_selected' }))
.then(); .then();
history.push(`/account/user`); goUserList();
return; return;
} }
if (!type || !UserDetailTabs[type]) { if (!type || !UserDetailTabs[type]) {
@ -64,7 +68,7 @@ export default () => {
return ( return (
<PageContainer <PageContainer
onBack={() => { onBack={() => {
history.push('/account/user'); goUserList();
}} }}
tabList={[ tabList={[
{ {
@ -104,6 +108,7 @@ export default () => {
if (success) { if (success) {
useApp.message.success(intl.formatMessage({ id: 'app.operation_success' })); useApp.message.success(intl.formatMessage({ id: 'app.operation_success' }));
confirmed.destroy(); confirmed.destroy();
goUserList();
} }
}, },
}); });

View File

@ -48,12 +48,16 @@ export default () => {
const [tabActiveKey, setTabActiveKey] = useState<string>(); const [tabActiveKey, setTabActiveKey] = useState<string>();
const [loading, setLoading] = useState<boolean>(false); const [loading, setLoading] = useState<boolean>(false);
const goUserGroupList = () => {
history.push('/account/user-group');
};
useMount(() => { useMount(() => {
if (!id) { if (!id) {
message message
.warning(intl.formatMessage({ id: 'pages.account.user_group_detail.use_mount.message' })) .warning(intl.formatMessage({ id: 'pages.account.user_group_detail.use_mount.message' }))
.then(); .then();
history.push(`/account/user-group`); goUserGroupList();
return; return;
} }
if (!type || !UserGroupDetailTabs[type]) { if (!type || !UserGroupDetailTabs[type]) {
@ -140,7 +144,7 @@ export default () => {
return ( return (
<PageContainer <PageContainer
onBack={() => { onBack={() => {
history.push('/account/user-group'); goUserGroupList();
}} }}
title={ title={
loading ? <Skeleton.Input style={{ width: 50 }} active size={'small'} /> : detail?.name loading ? <Skeleton.Input style={{ width: 50 }} active size={'small'} /> : detail?.name
@ -182,6 +186,7 @@ export default () => {
if (success) { if (success) {
message.success(intl.formatMessage({ id: 'app.operation_success' })); message.success(intl.formatMessage({ id: 'app.operation_success' }));
confirmed.destroy(); confirmed.destroy();
goUserGroupList();
} }
}, },
}); });

View File

@ -50,10 +50,14 @@ export default () => {
type: ConfigTabs; type: ConfigTabs;
}; };
const goAppList = () => {
history.push('/app');
};
useAsyncEffect(async () => { useAsyncEffect(async () => {
if (!id) { if (!id) {
message.error(intl.formatMessage({ id: 'pages.app.config.detail.error' })); message.error(intl.formatMessage({ id: 'pages.app.config.detail.error' }));
history.push('/app'); goAppList();
return; return;
} }
if (!type || !ConfigTabs[type]) { if (!type || !ConfigTabs[type]) {
@ -155,7 +159,7 @@ export default () => {
title={loading ? <Skeleton.Input style={{ width: 50 }} active size={'small'} /> : app?.name} title={loading ? <Skeleton.Input style={{ width: 50 }} active size={'small'} /> : app?.name}
style={{ overflow: 'hidden' }} style={{ overflow: 'hidden' }}
onBack={() => { onBack={() => {
history.push('/app'); goAppList();
}} }}
loading={loading} loading={loading}
extra={[ extra={[
@ -182,6 +186,7 @@ export default () => {
if (success) { if (success) {
message.success(intl.formatMessage({ id: 'app.operation_success' })); message.success(intl.formatMessage({ id: 'app.operation_success' }));
confirmed.destroy(); confirmed.destroy();
goAppList();
} }
}, },
}); });