|
@@ -12,8 +12,6 @@ export function setupPermission() {
|
|
const whiteList = [""];
|
|
const whiteList = [""];
|
|
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
router.beforeEach(async (to, from, next) => {
|
|
- const path = to.fullPath.split("/")[1];
|
|
|
|
- console.log(to.fullPath, path, "2222");
|
|
|
|
NProgress.start();
|
|
NProgress.start();
|
|
const hasToken = localStorage.getItem("token");
|
|
const hasToken = localStorage.getItem("token");
|
|
|
|
|
|
@@ -52,7 +50,8 @@ export function setupPermission() {
|
|
accessRoutes.forEach((route) => {
|
|
accessRoutes.forEach((route) => {
|
|
router.addRoute(route);
|
|
router.addRoute(route);
|
|
});
|
|
});
|
|
- next({ path: path ? path : "" });
|
|
|
|
|
|
+
|
|
|
|
+ next({ path: to.fullPath });
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error("beforeEach error", error);
|
|
console.error("beforeEach error", error);
|
|
// 移除 token 并跳转登录页
|
|
// 移除 token 并跳转登录页
|
|
@@ -80,7 +79,7 @@ export function setupPermission() {
|
|
accessRoutes.forEach((route) => {
|
|
accessRoutes.forEach((route) => {
|
|
router.addRoute(route);
|
|
router.addRoute(route);
|
|
});
|
|
});
|
|
- next({ path: path });
|
|
|
|
|
|
+ next({ path: to.fullPath });
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error("beforeEach error", error);
|
|
console.error("beforeEach error", error);
|
|
// 移除 token 并跳转登录页
|
|
// 移除 token 并跳转登录页
|