Commit b1ef8d42 authored by 陈帅's avatar 陈帅

bugfix: Fix trigger page

parent ac4dfc12
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
{ path: '/exception/403', component: './Exception/403' }, { path: '/exception/403', component: './Exception/403' },
{ path: '/exception/404', component: './Exception/404' }, { path: '/exception/404', component: './Exception/404' },
{ path: '/exception/500', component: './Exception/500' }, { path: '/exception/500', component: './Exception/500' },
{ path: '/exception/trigger', component: './Exception/triggerException' },
// account // account
{ {
path: '/account/center', path: '/account/center',
......
...@@ -18,7 +18,6 @@ export default class GlobalHeaderRight extends PureComponent { ...@@ -18,7 +18,6 @@ export default class GlobalHeaderRight extends PureComponent {
if (newNotice.datetime) { if (newNotice.datetime) {
newNotice.datetime = moment(notice.datetime).fromNow(); newNotice.datetime = moment(notice.datetime).fromNow();
} }
// transform id to item key
if (newNotice.id) { if (newNotice.id) {
newNotice.key = newNotice.id; newNotice.key = newNotice.id;
} }
...@@ -154,6 +153,7 @@ export default class GlobalHeaderRight extends PureComponent { ...@@ -154,6 +153,7 @@ export default class GlobalHeaderRight extends PureComponent {
)} )}
<Button <Button
size="small" size="small"
ghost={theme === 'dark'}
onClick={() => { onClick={() => {
this.changLang(); this.changLang();
}} }}
......
...@@ -40,9 +40,11 @@ export default { ...@@ -40,9 +40,11 @@ export default {
yield put(routerRedux.replace(redirect || '/')); yield put(routerRedux.replace(redirect || '/'));
} }
}, },
*getCaptcha({ payload }, { call }) { *getCaptcha({ payload }, { call }) {
yield call(getFakeCaptcha, payload); yield call(getFakeCaptcha, payload);
}, },
*logout(_, { put }) { *logout(_, { put }) {
yield put({ yield put({
type: 'changeLoginStatus', type: 'changeLoginStatus',
......
import React from 'react';
import { Link } from 'dva/router';
import Exception from 'components/Exception';
export default () => (
<Exception type="404" style={{ minHeight: 500, height: '80%' }} linkElement={Link} />
);
...@@ -29,6 +29,7 @@ const { check } = Authorized; ...@@ -29,6 +29,7 @@ const { check } = Authorized;
* @param {Object} routerData 路由配置 * @param {Object} routerData 路由配置
*/ */
const getBreadcrumbNameMap = memoizeOne((meun, router) => { const getBreadcrumbNameMap = memoizeOne((meun, router) => {
console.log(meun, router);
const routerMap = {}; const routerMap = {};
const mergeMeunAndRouter = meunData => { const mergeMeunAndRouter = meunData => {
meunData.forEach(meunItem => { meunData.forEach(meunItem => {
...@@ -71,6 +72,7 @@ class BasicLayout extends React.PureComponent { ...@@ -71,6 +72,7 @@ class BasicLayout extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
const { routerData, menuData } = this.props; const { routerData, menuData } = this.props;
this.getPageTitle = memoizeOne(this.getPageTitle);
this.breadcrumbNameMap = getBreadcrumbNameMap(menuData, routerData); this.breadcrumbNameMap = getBreadcrumbNameMap(menuData, routerData);
} }
...@@ -148,19 +150,14 @@ class BasicLayout extends React.PureComponent { ...@@ -148,19 +150,14 @@ class BasicLayout extends React.PureComponent {
}; };
render() { render() {
// TODO remove old router code
const { const {
isMobile, isMobile,
// redirectData,
// routerData,
silderTheme, silderTheme,
layout: PropsLayout, layout: PropsLayout,
children, children,
location: { pathname }, location: { pathname },
} = this.props; } = this.props;
const isTop = PropsLayout === 'topmenu'; const isTop = PropsLayout === 'topmenu';
// const bashRedirect = this.getBashRedirect();
// const myRedirectData = redirectData || [];
const layout = ( const layout = (
<Layout> <Layout>
{isTop && !isMobile ? null : ( {isTop && !isMobile ? null : (
...@@ -174,33 +171,14 @@ class BasicLayout extends React.PureComponent { ...@@ -174,33 +171,14 @@ class BasicLayout extends React.PureComponent {
)} )}
<Layout style={this.getLayoutStyle()}> <Layout style={this.getLayoutStyle()}>
<Header handleMenuCollapse={this.handleMenuCollapse} logo={logo} {...this.props} /> <Header handleMenuCollapse={this.handleMenuCollapse} logo={logo} {...this.props} />
<Content style={this.getContentStyle()}> <Content style={this.getContentStyle()}>{children}</Content>
{children}
{/* <Switch> TODO remove
{myRedirectData.map(item => (
<Redirect key={item.from} exact from={item.from} to={item.to} />
))}
{getRoutes(match.path, routerData).map(item => (
<AuthorizedRoute
key={item.key}
path={item.path}
component={item.component}
exact={item.exact}
authority={item.authority}
redirectPath="/exception/403"
/>
))}
<Redirect exact from="/" to={bashRedirect} />
<Route render={NotFound} />
</Switch> */}
</Content>
<Footer /> <Footer />
</Layout> </Layout>
</Layout> </Layout>
); );
const getPageTitle = memoizeOne(this.getPageTitle);
return ( return (
<DocumentTitle title={getPageTitle(pathname)}> <DocumentTitle title={this.getPageTitle(pathname)}>
<ContainerQuery query={query}> <ContainerQuery query={query}>
{params => ( {params => (
<Context.Provider value={this.getContext()}> <Context.Provider value={this.getContext()}>
......
import fetch from 'dva/fetch'; import fetch from 'dva/fetch';
import { notification } from 'antd'; import { notification } from 'antd';
import { routerRedux } from 'dva/router'; import router from 'umi/router';
// TODO set store
// import store from '../global';
// use global store
const store = window.g_app._store
const codeMessage = { const codeMessage = {
200: '服务器成功返回请求的数据。', 200: '服务器成功返回请求的数据。',
...@@ -81,24 +76,24 @@ export default function request(url, options) { ...@@ -81,24 +76,24 @@ export default function request(url, options) {
return response.json(); return response.json();
}) })
.catch(e => { .catch(e => {
const { dispatch } = store;
const status = e.name; const status = e.name;
if (status === 401) { if (status === 401) {
dispatch({ /* eslint-disable no-underscore-dangle */
window.g_app._store.dispatch({
type: 'login/logout', type: 'login/logout',
}); });
return; return;
} }
if (status === 403) { if (status === 403) {
dispatch(routerRedux.push('/exception/403')); router.push('/exception/403');
return; return;
} }
if (status <= 504 && status >= 500) { if (status <= 504 && status >= 500) {
dispatch(routerRedux.push('/exception/500')); router.push('/exception/500');
return; return;
} }
if (status >= 404 && status < 422) { if (status >= 404 && status < 422) {
dispatch(routerRedux.push('/exception/404')); router.push('/exception/404');
} }
}); });
} }
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