feat: 🎸 权限管理开发中
This commit is contained in:
@@ -18,6 +18,7 @@ import type { RouteRecordRaw } from 'vue-router'
|
||||
|
||||
const whiteList: string[] = ['/login'] // 不重定向白名单
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
if (wsCache.get(appStore.userInfo)) {
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' })
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// import path from 'path'
|
||||
import { asyncRouterMap, constantRouterMap } from '_p/index/router'
|
||||
import { deepClone } from '@/utils'
|
||||
import store from '../index'
|
||||
@@ -128,16 +127,14 @@ function getFilterRoutes(routes: any[]): any[] {
|
||||
name: route.name,
|
||||
redirect: route.redirect
|
||||
}
|
||||
data.meta = Object.assign({}, route.meta || {}, { title: route.title })
|
||||
data.meta = Object.assign({}, route.meta || {}, { title: route.title || route.meta.title })
|
||||
if (route.component) {
|
||||
// 动态加载路由文件,可根据实际情况进行自定义逻辑
|
||||
data.component = route.component === '#'
|
||||
? Layout
|
||||
: (route.component.includes('##')
|
||||
? getParentLayout(route.component.split('##')[1])
|
||||
: () => new Promise((resolve) => {
|
||||
resolve(import(`${route.component}`))
|
||||
}))
|
||||
: () => import(`@/${route.component}`))
|
||||
}
|
||||
// recursive child routes
|
||||
if (route.children) {
|
||||
|
||||
@@ -81,8 +81,6 @@
|
||||
<script lang="ts">
|
||||
import { setRoleApi, getRoleDetApi } from '../api'
|
||||
import { defineComponent, PropType, ref, reactive, nextTick, unref } from 'vue'
|
||||
import { AppRouteRecordRaw } from '_p/index/router/types'
|
||||
import { isExternal } from '@/utils/validate'
|
||||
import { Message } from '_c/Message'
|
||||
|
||||
const requiredRule = {
|
||||
|
||||
Reference in New Issue
Block a user