优化

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

View File

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

View File

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