Browse Source

feat:切换路由时确保相应抽屉关闭;

fuyang
YOU 9 months ago
parent
commit
17caa2d3a5
  1. 12
      src/router/index.ts

12
src/router/index.ts

@ -56,6 +56,13 @@ router.beforeEach((to, from, next) => {
const token = getToken(); const token = getToken();
const isPop = to.query.pop === 'true'; //新窗口打开内页 const isPop = to.query.pop === 'true'; //新窗口打开内页
NProgress.start(); NProgress.start();
const overLay: IObject | null = document.querySelector('.el-overlay .modify-form');
if (overLay && overLay.parentNode) {
overLay.parentNode.remove();
}
if (to.path !== '/login') { if (to.path !== '/login') {
if (store.state.routes.length) { if (store.state.routes.length) {
if (to.name === 'error') { if (to.name === 'error') {
@ -176,7 +183,7 @@ router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth) { if (to.meta.requiresAuth) {
next('/login'); next('/login');
} else { } else {
next();
next();
} }
} }
} else { } else {
@ -186,12 +193,11 @@ router.beforeEach((to, from, next) => {
} }
} else { } else {
store.commit('updateState', { appIsReady: true, appIsRender: true }); store.commit('updateState', { appIsReady: true, appIsRender: true });
if (import.meta.env.VITE_APP_API_HOME) {
if (import.meta.env.VITE_APP_API_HOME) {
window.location.href = import.meta.env.VITE_APP_API_HOME; window.location.href = import.meta.env.VITE_APP_API_HOME;
} else { } else {
next(); next();
} }
} }
}); });

Loading…
Cancel
Save