|
@@ -19,13 +19,10 @@ import {userInfoStore} from "@/utils/store-public";
|
|
|
import {stringIsBlank} from "@/utils/blank-utils";
|
|
|
import XEUtils from "xe-utils";
|
|
|
|
|
|
-const whiteNameRouting = []
|
|
|
|
|
|
function dashboardRouter(data: Array<RouteRecordRaw>) {
|
|
|
data.forEach((item) => {
|
|
|
XEUtils.set(item, "meta.needToken", false)
|
|
|
- XEUtils.set(item, "meta.needToken", false)
|
|
|
- whiteNameRouting.push(item.path)
|
|
|
if (item.children && item.children.length > 0) {
|
|
|
dashboardRouter(item.children)
|
|
|
}
|
|
@@ -136,6 +133,7 @@ router.beforeEach(async (to, _from, next) => {
|
|
|
NProgress.start();
|
|
|
|
|
|
function tmpNext(...arg) {
|
|
|
+ console.log(123)
|
|
|
to.meta.title && changeTitle(to.meta.title)
|
|
|
if (to.meta.needToken && stringIsBlank(userInfoStore.value.token)) {
|
|
|
next('/login')
|
|
@@ -144,12 +142,9 @@ router.beforeEach(async (to, _from, next) => {
|
|
|
next(...arg);
|
|
|
}
|
|
|
|
|
|
- for (let i = 0; i < whiteNameRouting.length; i++) {
|
|
|
- const tmp: string = whiteNameRouting[i]
|
|
|
- if (tmp.startsWith(to.path)) {
|
|
|
- tmpNext()
|
|
|
- return
|
|
|
- }
|
|
|
+ if (XEUtils.has(to, 'meta.needToken') && !to.meta.needToken) {
|
|
|
+ tmpNext()
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
if (!asyncFinished) {
|