提交 4c513959 authored 作者: vipcxj's avatar vipcxj

不存在模块历史记录的时候不自动调整到快速导航页面

上级 e06a5fcc
import { routerRedux } from 'dva/router'; import { routerRedux } from 'dva/router';
import { fetchDomains, switchDomain, currentDomain } from '../services/domain'; import { fetchDomains, switchDomain, currentDomain } from '../services/domain';
import { fullPath } from '../utils/helper'; import { fullPath } from '../utils/helper';
import { getDomain, setDomain } from '../utils/auth'; import { getDomain, histories, setDomain } from '../utils/auth';
import config from '../utils/config'; import config from '../utils/config';
export default { export default {
...@@ -31,7 +31,8 @@ export default { ...@@ -31,7 +31,8 @@ export default {
const { path, name } = yield call(currentDomain); const { path, name } = yield call(currentDomain);
yield call(setDomain, name, path); yield call(setDomain, name, path);
yield put({ type: 'queryInit', payload: path }); yield put({ type: 'queryInit', payload: path });
if (config.fastNavigationPage) { const latest = histories.getLatest('module');
if (latest && config.fastNavigationPage) {
yield put(routerRedux.push(fullPath('/fastNav'))); yield put(routerRedux.push(fullPath('/fastNav')));
} else { } else {
yield put(routerRedux.push(fullPath('/main'))); yield put(routerRedux.push(fullPath('/main')));
......
...@@ -41,7 +41,8 @@ export default { ...@@ -41,7 +41,8 @@ export default {
yield call(switchDomain, path); yield call(switchDomain, path);
const { name } = yield call(currentDomain); const { name } = yield call(currentDomain);
yield call(setDomain, name, path); yield call(setDomain, name, path);
if (config.fastNavigationPage) { const latest = histories.getLatest('module');
if (latest && config.fastNavigationPage) {
yield put(routerRedux.push(fullPath('/fastNav'))); yield put(routerRedux.push(fullPath('/fastNav')));
} else { } else {
yield put(routerRedux.push(fullPath('/main'))); yield put(routerRedux.push(fullPath('/main')));
......
...@@ -159,11 +159,13 @@ function RouterConfig({ history, app }) { ...@@ -159,11 +159,13 @@ function RouterConfig({ history, app }) {
component: App, component: App,
indexRoute: { indexRoute: {
onEnter: (nextState, replace) => { onEnter: (nextState, replace) => {
if (config.fastNavigationPage) { histories.getLatest('module').then((latest) => {
replace(`${contextPath}/fastNav`); if (latest && config.fastNavigationPage) {
} else { replace(`${contextPath}/fastNav`);
replace(`${contextPath}/main`); } else {
} replace(`${contextPath}/main`);
}
});
}, },
}, },
childRoutes: [ childRoutes: [
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论