|
@@ -2,6 +2,7 @@ import router from "@/router";
|
|
|
import NProgress from "@/utils/nprogress";
|
|
|
import { useDictionaryStore } from "@/store/modules/dictionary";
|
|
|
import { getUserDicts } from "@/api/auth";
|
|
|
+
|
|
|
export function setupPermission() {
|
|
|
// 白名单路由
|
|
|
const whiteList: string[] = ["client-traceability"]; //由于包含动态路由,这里面存储的是路由的name而不是path
|
|
@@ -23,8 +24,10 @@ export function setupPermission() {
|
|
|
const hasToken = localStorage.getItem("token");
|
|
|
if (hasToken) {
|
|
|
if (to.path === "/login") {
|
|
|
- // 如果已登录,跳转首页
|
|
|
- next({ path: "/" });
|
|
|
+ // 如果已登录,跳转首页,并且清空token
|
|
|
+ localStorage.setItem("token", "");
|
|
|
+ next();
|
|
|
+ // next({ path: "/" });
|
|
|
NProgress.done();
|
|
|
} else {
|
|
|
const dictStore = useDictionaryStore();
|