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