提交 b7563731 authored 作者: vipcxj's avatar vipcxj

增加模块页面跳转的钩子

上级 2a832840
...@@ -156,9 +156,8 @@ const createRoutes = async (app, modules, groups, basePath) => { ...@@ -156,9 +156,8 @@ const createRoutes = async (app, modules, groups, basePath) => {
route.onEnter = (nextState, replace, cb) => { route.onEnter = (nextState, replace, cb) => {
if (get(nextState, 'location.pathname') === route.fullPath) { if (get(nextState, 'location.pathname') === route.fullPath) {
getUser() getUser()
.then(u => u && u.id) .then(u => (u ? [u.id, histories.getLatest('module', u.id)] : [null, null]))
.then((uid) => { .then(([uid, lastModule]) => {
const lastModule = histories.getLatest('module', uid);
const currentModule = { const currentModule = {
name, name,
showName, showName,
...@@ -188,9 +187,8 @@ const createRoutes = async (app, modules, groups, basePath) => { ...@@ -188,9 +187,8 @@ const createRoutes = async (app, modules, groups, basePath) => {
route.onEnter = (nextState, replace, cb) => { route.onEnter = (nextState, replace, cb) => {
if (get(nextState, 'location.pathname') === route.fullPath) { if (get(nextState, 'location.pathname') === route.fullPath) {
getUser() getUser()
.then(u => u && u.id) .then(u => (u ? [u.id, histories.getLatest('module', u.id)] : [null, null]))
.then((uid) => { .then(([uid, lastModule]) => {
const lastModule = histories.getLatest('module', uid);
const currentModule = { const currentModule = {
name, name,
showName, showName,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论