|
@@ -2,13 +2,24 @@ 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
|
|
|
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
NProgress.start();
|
|
|
+ //在路由跳转前判断是否为不需要全屏加载的二级路由界面(目前项目中只有pro-step界面涉及)
|
|
|
+ const isShow = inject("isShow");
|
|
|
+ const route = useRoute();
|
|
|
+ if (
|
|
|
+ !(
|
|
|
+ route.fullPath.substr(0, 11) == "/pro-steps/" &&
|
|
|
+ to.fullPath.substr(0, 11) == "/pro-steps/"
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ //@ts-ignore
|
|
|
+ isShow.value = true;
|
|
|
+ }
|
|
|
const hasToken = localStorage.getItem("token");
|
|
|
if (hasToken) {
|
|
|
if (to.path === "/login") {
|
|
@@ -50,6 +61,13 @@ export function setupPermission() {
|
|
|
});
|
|
|
|
|
|
router.afterEach(() => {
|
|
|
+ const isShow = inject("isShow");
|
|
|
+ const route = useRoute();
|
|
|
+ //@ts-ignore
|
|
|
+ if (isShow.value == true) {
|
|
|
+ //@ts-ignore
|
|
|
+ isShow.value = false;
|
|
|
+ }
|
|
|
NProgress.done();
|
|
|
});
|
|
|
}
|