Unverified Commit 243cc7e3 authored by 陈帅's avatar 陈帅 Committed by GitHub

feat : fix #4565, add 404 page (#4588)

* fix #4565,add 404 page

* fix codacy warning

* add 404 in fetch:blocks

* rm NoticeIconView import
parent 4a10734d
...@@ -93,8 +93,14 @@ export default { ...@@ -93,8 +93,14 @@ export default {
icon: 'smile', icon: 'smile',
component: './Welcome', component: './Welcome',
}, },
{
component: './404',
},
], ],
}, },
{
component: './404',
},
], ],
// Theme for antd: https://ant.design/docs/react/customize-theme-cn // Theme for antd: https://ant.design/docs/react/customize-theme-cn
theme: { theme: {
......
...@@ -41,6 +41,9 @@ const findAllInstallRouter = router => { ...@@ -41,6 +41,9 @@ const findAllInstallRouter = router => {
const filterParentRouter = (router, layout) => { const filterParentRouter = (router, layout) => {
return [...router] return [...router]
.map(item => { .map(item => {
if (!item.path && item.component === '404') {
return item;
}
if (item.routes && (!router.component || layout)) { if (item.routes && (!router.component || layout)) {
return { ...item, routes: filterParentRouter(item.routes, false) }; return { ...item, routes: filterParentRouter(item.routes, false) };
} }
......
...@@ -19,6 +19,7 @@ export interface NoticeIconTabProps { ...@@ -19,6 +19,7 @@ export interface NoticeIconTabProps {
emptyText?: string; emptyText?: string;
clearText?: string; clearText?: string;
viewMoreText?: string; viewMoreText?: string;
list: NoticeIconData[];
onViewMore?: (e: any) => void; onViewMore?: (e: any) => void;
} }
const NoticeList: React.SFC<NoticeIconTabProps> = ({ const NoticeList: React.SFC<NoticeIconTabProps> = ({
......
...@@ -117,7 +117,7 @@ export default class NoticeIcon extends Component<NoticeIconProps> { ...@@ -117,7 +117,7 @@ export default class NoticeIcon extends Component<NoticeIconProps> {
}, },
); );
return ( return (
<Spin spinning={loading} delay={0}> <Spin spinning={loading} delay={300}>
<Tabs className={styles.tabs} onChange={this.onTabChange}> <Tabs className={styles.tabs} onChange={this.onTabChange}>
{panes} {panes}
</Tabs> </Tabs>
......
...@@ -7,6 +7,7 @@ import { queryNotices } from '@/services/user'; ...@@ -7,6 +7,7 @@ import { queryNotices } from '@/services/user';
export interface NoticeItem extends NoticeIconData { export interface NoticeItem extends NoticeIconData {
id: string; id: string;
type: string; type: string;
status: string;
} }
export interface GlobalModelState { export interface GlobalModelState {
......
import React from 'react';
import { Button } from 'antd';
// 这里应该使用 antd 的 404 result 组件,
// 但是还没发布,先来个简单的。
const NoFoundPage: React.FC<{}> = () => (
<div
style={{
height: '100vh',
padding: 80,
textAlign: 'center',
}}
>
<img src="https://gw.alipayobjects.com/zos/antfincdn/wsE2Pw%243%26L/noFound.svg" alt="404" />
<br />
<br />
<h1>404</h1>
<p>Sorry, the page you visited does not exist.</p>
<Button type="primary">Back Home</Button>
</div>
);
export default NoFoundPage;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment