fix: model edit
This commit is contained in:
+29
-23
@@ -1,9 +1,9 @@
|
||||
// @ts-nocheck
|
||||
// This file is generated by Umi automatically
|
||||
// DO NOT CHANGE IT MANUALLY!
|
||||
import { history, useIntl, type IRoute } from '@umijs/max';
|
||||
import { Button, Result } from 'antd';
|
||||
import React from 'react';
|
||||
import { history, type IRoute } from '@umijs/max';
|
||||
import { Result, Button } from 'antd';
|
||||
|
||||
const Exception: React.FC<{
|
||||
children: React.ReactNode;
|
||||
@@ -12,27 +12,33 @@ const Exception: React.FC<{
|
||||
noAccessible?: React.ReactNode;
|
||||
unAccessible?: React.ReactNode;
|
||||
noFound?: React.ReactNode;
|
||||
}> = (props) => (
|
||||
console.log('Exception========', props),
|
||||
}> = (props) => {
|
||||
const intl = useIntl();
|
||||
// render custom 404
|
||||
(!props.route && (props.noFound || props.notFound)) ||
|
||||
// render custom 403
|
||||
(props.route?.unaccessible && (props.unAccessible || props.noAccessible)) ||
|
||||
// render default exception
|
||||
((!props.route || props.route?.unaccessible) && (
|
||||
<Result
|
||||
status={props.route ? '403' : '404'}
|
||||
title={props.route ? '403' : '404'}
|
||||
subTitle={props.route ? '抱歉,你无权访问该页面' : '抱歉,你访问的页面不存在'}
|
||||
extra={
|
||||
<Button type="primary" onClick={() => history.push('/')}>
|
||||
返回首页
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
)) ||
|
||||
// normal render
|
||||
props.children
|
||||
);
|
||||
return (
|
||||
(!props.route && (props.noFound || props.notFound)) ||
|
||||
// render custom 403
|
||||
(props.route?.unaccessible && (props.unAccessible || props.noAccessible)) ||
|
||||
// render default exception
|
||||
((!props.route || props.route?.unaccessible) && (
|
||||
<Result
|
||||
status={props.route ? '403' : '404'}
|
||||
title={props.route ? '403' : '404'}
|
||||
subTitle={
|
||||
props.route
|
||||
? intl.formatMessage({ id: 'common.permission.403' })
|
||||
: intl.formatMessage({ id: 'common.permission.404' })
|
||||
}
|
||||
extra={
|
||||
<Button type="primary" onClick={() => history.push('/')}>
|
||||
{intl.formatMessage({ id: 'common.button.back' })}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
)) ||
|
||||
// normal render
|
||||
props.children
|
||||
);
|
||||
};
|
||||
|
||||
export default Exception;
|
||||
|
||||
Reference in New Issue
Block a user