mirror of https://gitee.com/topiam/eiam
⚡ 优化代码
parent
4f52d44966
commit
cc804d0d2e
|
@ -48,8 +48,10 @@ export default (props: {
|
||||||
preserve={false}
|
preserve={false}
|
||||||
width="500px"
|
width="500px"
|
||||||
open={visible}
|
open={visible}
|
||||||
onOpenChange={() => {
|
onOpenChange={(visible) => {
|
||||||
|
if (visible) {
|
||||||
form.setFieldsValue({ code: random(9) });
|
form.setFieldsValue({ code: random(9) });
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
modalProps={{
|
modalProps={{
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
@ -58,9 +60,9 @@ export default (props: {
|
||||||
}}
|
}}
|
||||||
onFinish={async (values: AccountAPI.BaseUserGroup) => {
|
onFinish={async (values: AccountAPI.BaseUserGroup) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const result = await onFinish(values);
|
await onFinish(values).finally(() => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
return !!result;
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Spin spinning={loading}>
|
<Spin spinning={loading}>
|
||||||
|
|
|
@ -39,6 +39,7 @@ import CreateAdministrator from './components/CreateAdministrator';
|
||||||
import UpdateAdministrator from './components/UpdateAdministrator';
|
import UpdateAdministrator from './components/UpdateAdministrator';
|
||||||
import ResetPassword from './components/ResetAdministratorPassword';
|
import ResetPassword from './components/ResetAdministratorPassword';
|
||||||
import Avatar from '@/components/UserAvatar';
|
import Avatar from '@/components/UserAvatar';
|
||||||
|
import { AdministratorList } from './data';
|
||||||
|
|
||||||
export const Administrator = () => {
|
export const Administrator = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
@ -49,7 +50,7 @@ export const Administrator = () => {
|
||||||
const [resetPasswordVisible, setResetPasswordVisible] = useState<boolean>(false);
|
const [resetPasswordVisible, setResetPasswordVisible] = useState<boolean>(false);
|
||||||
const [id, setId] = useState<string>();
|
const [id, setId] = useState<string>();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const columns: ProColumns<SettingAPI.AdministratorList>[] = [
|
const columns: ProColumns<AdministratorList>[] = [
|
||||||
{
|
{
|
||||||
title: intl.formatMessage({ id: 'pages.setting.administrator.table.columns.username' }),
|
title: intl.formatMessage({ id: 'pages.setting.administrator.table.columns.username' }),
|
||||||
dataIndex: 'username',
|
dataIndex: 'username',
|
||||||
|
@ -289,7 +290,7 @@ export const Administrator = () => {
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
<ProTable<SettingAPI.AdministratorList>
|
<ProTable<AdministratorList>
|
||||||
actionRef={actionRef}
|
actionRef={actionRef}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey={'id'}
|
rowKey={'id'}
|
||||||
|
|
|
@ -99,27 +99,20 @@ export default {
|
||||||
'pages.setting.storage_provider.minio.bucket.rule.0.message': 'MinIO Bucket为必填项',
|
'pages.setting.storage_provider.minio.bucket.rule.0.message': 'MinIO Bucket为必填项',
|
||||||
'pages.setting.storage_provider.provider.s3': 'S3',
|
'pages.setting.storage_provider.provider.s3': 'S3',
|
||||||
'pages.setting.storage_provider.provider.s3.endpoint': 'S3 域名',
|
'pages.setting.storage_provider.provider.s3.endpoint': 'S3 域名',
|
||||||
'pages.setting.storage_provider.provider.s3.endpoint.placeholder':
|
'pages.setting.storage_provider.provider.s3.endpoint.placeholder': '请输入 S3 域名',
|
||||||
'请输入 S3 域名',
|
|
||||||
'pages.setting.storage_provider.provider.qiniu_kodo.endpoint.rule.0.message':
|
'pages.setting.storage_provider.provider.qiniu_kodo.endpoint.rule.0.message':
|
||||||
'七牛云Kodo S3 域名为必填项',
|
'七牛云Kodo S3 域名为必填项',
|
||||||
'pages.setting.storage_provider.provider.s3.domain': '外链域名',
|
'pages.setting.storage_provider.provider.s3.domain': '外链域名',
|
||||||
'pages.setting.storage_provider.provider.s3.domain.placeholder':
|
'pages.setting.storage_provider.provider.s3.domain.placeholder': '请输入S3 外链域名',
|
||||||
'请输入S3 外链域名',
|
'pages.setting.storage_provider.provider.s3.domain.rule.0.message': 'S3 外链域名为必填项',
|
||||||
'pages.setting.storage_provider.provider.s3.domain.rule.0.message':
|
'pages.setting.storage_provider.provider.s3.access_key_id.placeholder': '请输入S3 AccessKeyId',
|
||||||
'S3 外链域名为必填项',
|
|
||||||
'pages.setting.storage_provider.provider.s3.access_key_id.placeholder':
|
|
||||||
'请输入S3 AccessKeyId',
|
|
||||||
'pages.setting.storage_provider.provider.s3.access_key_id.rule.0.message':
|
'pages.setting.storage_provider.provider.s3.access_key_id.rule.0.message':
|
||||||
'S3 AccessKeyId为必填项',
|
'S3 AccessKeyId为必填项',
|
||||||
'pages.setting.storage_provider.provider.s3.secret_access_key.placeholder':
|
'pages.setting.storage_provider.provider.s3.secret_access_key.placeholder':
|
||||||
'请输入S3 SecretAccessKey',
|
'请输入S3 SecretAccessKey',
|
||||||
'pages.setting.storage_provider.provider.s3.secret_access_key.rule.0.message':
|
'pages.setting.storage_provider.provider.s3.secret_access_key.rule.0.message':
|
||||||
'S3 SecretAccessKey为必填项',
|
'S3 SecretAccessKey为必填项',
|
||||||
'pages.setting.storage_provider.provider.s3.region.placeholder':
|
'pages.setting.storage_provider.provider.s3.region.placeholder': '请输入S3 Region',
|
||||||
'请输入S3 Region',
|
'pages.setting.storage_provider.provider.s3.bucket.placeholder': '请输入S3 Bucket',
|
||||||
'pages.setting.storage_provider.provider.s3.bucket.placeholder':
|
'pages.setting.storage_provider.provider.s3.bucket.rule.0.message': 'S3 Bucket为必填项',
|
||||||
'请输入S3 Bucket',
|
|
||||||
'pages.setting.storage_provider.provider.s3.bucket.rule.0.message':
|
|
||||||
'S3 Bucket为必填项',
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,15 +45,15 @@ const AccountSettings = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [initConfig, setInitConfig] = useState<AccountSettingState>({
|
const [initConfig, setInitConfig] = useState<AccountSettingState>({
|
||||||
mode: 'inline',
|
mode: 'inline',
|
||||||
selectKey: AccountSettingsStateKey.BASE,
|
selectKey: AccountSettingsStateKey.base,
|
||||||
});
|
});
|
||||||
|
|
||||||
useAsyncEffect(async () => {
|
useAsyncEffect(async () => {
|
||||||
if (!type || !AccountSettingsStateKey[type.toUpperCase()]) {
|
if (!type || !AccountSettingsStateKey[type]) {
|
||||||
setInitConfig({ ...initConfig, selectKey: AccountSettingsStateKey.BASE });
|
setInitConfig({ ...initConfig, selectKey: AccountSettingsStateKey.base });
|
||||||
history.replace({
|
history.replace({
|
||||||
pathname: location.pathname,
|
pathname: location.pathname,
|
||||||
search: queryString.stringify({ type: AccountSettingsStateKey.BASE }),
|
search: queryString.stringify({ type: AccountSettingsStateKey.base }),
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -62,19 +62,19 @@ const AccountSettings = () => {
|
||||||
|
|
||||||
const menu: ItemType[] = [
|
const menu: ItemType[] = [
|
||||||
{
|
{
|
||||||
key: AccountSettingsStateKey.BASE,
|
key: AccountSettingsStateKey.base,
|
||||||
label: intl.formatMessage({
|
label: intl.formatMessage({
|
||||||
id: 'page.account.menu.base',
|
id: 'page.account.menu.base',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: AccountSettingsStateKey.SECURITY,
|
key: AccountSettingsStateKey.security,
|
||||||
label: intl.formatMessage({
|
label: intl.formatMessage({
|
||||||
id: 'page.account.menu.security',
|
id: 'page.account.menu.security',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: AccountSettingsStateKey.BIND,
|
key: AccountSettingsStateKey.bind,
|
||||||
label: intl.formatMessage({
|
label: intl.formatMessage({
|
||||||
id: 'page.account.menu.bind',
|
id: 'page.account.menu.bind',
|
||||||
}),
|
}),
|
||||||
|
@ -113,11 +113,11 @@ const AccountSettings = () => {
|
||||||
const renderChildren = () => {
|
const renderChildren = () => {
|
||||||
const { selectKey } = initConfig;
|
const { selectKey } = initConfig;
|
||||||
switch (selectKey) {
|
switch (selectKey) {
|
||||||
case AccountSettingsStateKey.BASE:
|
case AccountSettingsStateKey.base:
|
||||||
return <BaseView />;
|
return <BaseView />;
|
||||||
case AccountSettingsStateKey.SECURITY:
|
case AccountSettingsStateKey.security:
|
||||||
return <SecurityView />;
|
return <SecurityView />;
|
||||||
case AccountSettingsStateKey.BIND:
|
case AccountSettingsStateKey.bind:
|
||||||
return <BindingView />;
|
return <BindingView />;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue