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

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

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