浏览器刷新后打开缓存的页签
This commit is contained in:
parent
2215356adb
commit
eb5b81eebf
|
@ -201,9 +201,9 @@ export default {
|
|||
value: false,
|
||||
});
|
||||
}
|
||||
this.$router.push({
|
||||
path: url,
|
||||
});
|
||||
// this.$router.push({
|
||||
// path: url,
|
||||
// });
|
||||
} else {
|
||||
this.$store.dispatch("settings/changeSetting", {
|
||||
key: "showTagsView",
|
||||
|
@ -211,9 +211,9 @@ export default {
|
|||
});
|
||||
setMenuNode("/index");
|
||||
this.$store.commit("SET_CURRENT_MENU_NODE", "/index");
|
||||
this.$router.push({
|
||||
path: "/index",
|
||||
});
|
||||
// this.$router.push({
|
||||
// path: "/index",
|
||||
// });
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
@ -3,7 +3,7 @@ import store from './store'
|
|||
import { Message } from 'element-ui'
|
||||
import NProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'
|
||||
import { getToken, getCompanyId } from '@/utils/auth'
|
||||
import { getToken, getCompanyId, getMenuNode,setMenuNode } from '@/utils/auth'
|
||||
import { isRelogin, getButtonLish } from '@/utils/request'
|
||||
import { authApi } from '@/api/apis/auth'
|
||||
import { getInfo } from '@/utils/auth'
|
||||
|
@ -11,7 +11,8 @@ import { getInfo } from '@/utils/auth'
|
|||
NProgress.configure({
|
||||
showSpinner: false
|
||||
})
|
||||
|
||||
//判断是否第一次进入页面
|
||||
let isFirst = true;
|
||||
const whiteList = [
|
||||
'/login',
|
||||
'/test',
|
||||
|
@ -27,6 +28,32 @@ const whiteList = [
|
|||
]
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
let reloaded = sessionStorage.getItem('reloaded')
|
||||
//网站第一次进来逻辑 当from为空
|
||||
if (from.path === '/' && !reloaded && isFirst) {
|
||||
isFirst = false
|
||||
setMenuNode("/index");
|
||||
store.commit("SET_CURRENT_MENU_NODE", "/index");
|
||||
next({
|
||||
path: '/index',
|
||||
})
|
||||
return
|
||||
}
|
||||
//网站刷新后逻辑
|
||||
if (reloaded === 'true' && !whiteList.includes(to.path)) {
|
||||
sessionStorage.setItem('reloaded', 'false')
|
||||
let url = getMenuNode();
|
||||
if (url) {
|
||||
next({
|
||||
path: url,
|
||||
})
|
||||
} else {
|
||||
next({
|
||||
path: '/index',
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
NProgress.start()
|
||||
if (getToken()) {
|
||||
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
|
||||
|
|
Loading…
Reference in New Issue