feat: 🎸 权限管理开发中
This commit is contained in:
parent
6d7ea6694d
commit
38f521174b
|
@ -14,10 +14,5 @@ module.exports = {
|
||||||
'styleLibraryName': 'theme-chalk'
|
'styleLibraryName': 'theme-chalk'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
],
|
]
|
||||||
'env': {
|
|
||||||
'development': {
|
|
||||||
'plugins': ['dynamic-import-node']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
export const checkedRoleNodes = [{
|
export const checkedRoleNodes = [
|
||||||
|
{
|
||||||
path: '/components-demo',
|
path: '/components-demo',
|
||||||
component: '#',
|
component: '#',
|
||||||
redirect: '/components-demo/echarts',
|
redirect: '/components-demo/echarts',
|
||||||
|
@ -8,7 +9,8 @@ export const checkedRoleNodes = [{
|
||||||
icon: 'component',
|
icon: 'component',
|
||||||
alwaysShow: true
|
alwaysShow: true
|
||||||
},
|
},
|
||||||
children: [{
|
children: [
|
||||||
|
{
|
||||||
path: 'echarts',
|
path: 'echarts',
|
||||||
component: 'pages/index/views/components-demo/echarts/index.vue',
|
component: 'pages/index/views/components-demo/echarts/index.vue',
|
||||||
name: 'EchartsDemo',
|
name: 'EchartsDemo',
|
||||||
|
@ -281,14 +283,16 @@ export const checkedRoleNodes = [{
|
||||||
icon: 'clipboard',
|
icon: 'clipboard',
|
||||||
alwaysShow: true
|
alwaysShow: true
|
||||||
},
|
},
|
||||||
children: [{
|
children: [
|
||||||
path: 'clipboard',
|
{
|
||||||
component: 'pages/index/views/directives-demo/clipboard/index.vue',
|
path: 'clipboard',
|
||||||
name: 'ClipboardDemo',
|
component: 'pages/index/views/directives-demo/clipboard/index.vue',
|
||||||
meta: {
|
name: 'ClipboardDemo',
|
||||||
title: 'Clipboard'
|
meta: {
|
||||||
|
title: 'Clipboard'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/hooks-demo',
|
path: '/hooks-demo',
|
||||||
|
@ -300,7 +304,8 @@ export const checkedRoleNodes = [{
|
||||||
icon: 'international',
|
icon: 'international',
|
||||||
alwaysShow: true
|
alwaysShow: true
|
||||||
},
|
},
|
||||||
children: [{
|
children: [
|
||||||
|
{
|
||||||
path: 'watermark',
|
path: 'watermark',
|
||||||
component: 'pages/index/views/hooks-demo/useWatermark/index.vue',
|
component: 'pages/index/views/hooks-demo/useWatermark/index.vue',
|
||||||
name: 'UseWatermarkDemo',
|
name: 'UseWatermarkDemo',
|
||||||
|
@ -326,15 +331,17 @@ export const checkedRoleNodes = [{
|
||||||
title: '图标',
|
title: '图标',
|
||||||
icon: 'icon'
|
icon: 'icon'
|
||||||
},
|
},
|
||||||
children: [{
|
children: [
|
||||||
path: 'index',
|
{
|
||||||
component: 'pages/index/views/icons/index.vue',
|
path: 'index',
|
||||||
name: 'Icons',
|
component: 'pages/index/views/icons/index.vue',
|
||||||
meta: {
|
name: 'Icons',
|
||||||
title: '图标',
|
meta: {
|
||||||
icon: 'icon'
|
title: '图标',
|
||||||
|
icon: 'icon'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/level',
|
path: '/level',
|
||||||
|
@ -345,7 +352,8 @@ export const checkedRoleNodes = [{
|
||||||
title: '多级菜单缓存',
|
title: '多级菜单缓存',
|
||||||
icon: 'nested'
|
icon: 'nested'
|
||||||
},
|
},
|
||||||
children: [{
|
children: [
|
||||||
|
{
|
||||||
path: 'menu1',
|
path: 'menu1',
|
||||||
name: 'Menu1Demo',
|
name: 'Menu1Demo',
|
||||||
component: '##Menu1Demo',
|
component: '##Menu1Demo',
|
||||||
|
@ -353,7 +361,8 @@ export const checkedRoleNodes = [{
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Menu1'
|
title: 'Menu1'
|
||||||
},
|
},
|
||||||
children: [{
|
children: [
|
||||||
|
{
|
||||||
path: 'menu1-1',
|
path: 'menu1-1',
|
||||||
name: 'Menu11Demo',
|
name: 'Menu11Demo',
|
||||||
component: '##Menu11Demo',
|
component: '##Menu11Demo',
|
||||||
|
@ -362,14 +371,16 @@ export const checkedRoleNodes = [{
|
||||||
title: 'Menu1-1',
|
title: 'Menu1-1',
|
||||||
alwaysShow: true
|
alwaysShow: true
|
||||||
},
|
},
|
||||||
children: [{
|
children: [
|
||||||
path: 'menu1-1-1',
|
{
|
||||||
name: 'Menu111Demo',
|
path: 'menu1-1-1',
|
||||||
component: 'pages/index/views/level/Menu111.vue',
|
name: 'Menu111Demo',
|
||||||
meta: {
|
component: 'pages/index/views/level/Menu111.vue',
|
||||||
title: 'Menu1-1-1'
|
meta: {
|
||||||
|
title: 'Menu1-1-1'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'menu1-2',
|
path: 'menu1-2',
|
||||||
|
@ -401,7 +412,8 @@ export const checkedRoleNodes = [{
|
||||||
icon: 'example',
|
icon: 'example',
|
||||||
title: '综合实例'
|
title: '综合实例'
|
||||||
},
|
},
|
||||||
children: [{
|
children: [
|
||||||
|
{
|
||||||
path: 'example-dialog',
|
path: 'example-dialog',
|
||||||
component: 'pages/index/views/example-demo/example-dialog/index.vue',
|
component: 'pages/index/views/example-demo/example-dialog/index.vue',
|
||||||
name: 'ExampleDialog',
|
name: 'ExampleDialog',
|
||||||
|
@ -468,7 +480,8 @@ export const checkedRoleNodes = [{
|
||||||
icon: 'user',
|
icon: 'user',
|
||||||
alwaysShow: true
|
alwaysShow: true
|
||||||
},
|
},
|
||||||
children: [{
|
children: [
|
||||||
|
{
|
||||||
path: 'user',
|
path: 'user',
|
||||||
component: 'pages/index/views/role-demo/user/index.vue',
|
component: 'pages/index/views/role-demo/user/index.vue',
|
||||||
name: 'User',
|
name: 'User',
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
"@vue/eslint-config-typescript": "^5.0.2",
|
"@vue/eslint-config-typescript": "^5.0.2",
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-plugin-component": "^1.1.1",
|
"babel-plugin-component": "^1.1.1",
|
||||||
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||||
"babel-plugin-import": "^1.13.1",
|
"babel-plugin-import": "^1.13.1",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
|
|
|
@ -18,6 +18,7 @@ import type { RouteRecordRaw } from 'vue-router'
|
||||||
|
|
||||||
const whiteList: string[] = ['/login'] // 不重定向白名单
|
const whiteList: string[] = ['/login'] // 不重定向白名单
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
|
NProgress.start()
|
||||||
if (wsCache.get(appStore.userInfo)) {
|
if (wsCache.get(appStore.userInfo)) {
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
next({ path: '/' })
|
next({ path: '/' })
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// import path from 'path'
|
|
||||||
import { asyncRouterMap, constantRouterMap } from '_p/index/router'
|
import { asyncRouterMap, constantRouterMap } from '_p/index/router'
|
||||||
import { deepClone } from '@/utils'
|
import { deepClone } from '@/utils'
|
||||||
import store from '../index'
|
import store from '../index'
|
||||||
|
@ -128,16 +127,14 @@ function getFilterRoutes(routes: any[]): any[] {
|
||||||
name: route.name,
|
name: route.name,
|
||||||
redirect: route.redirect
|
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) {
|
if (route.component) {
|
||||||
// 动态加载路由文件,可根据实际情况进行自定义逻辑
|
// 动态加载路由文件,可根据实际情况进行自定义逻辑
|
||||||
data.component = route.component === '#'
|
data.component = route.component === '#'
|
||||||
? Layout
|
? Layout
|
||||||
: (route.component.includes('##')
|
: (route.component.includes('##')
|
||||||
? getParentLayout(route.component.split('##')[1])
|
? getParentLayout(route.component.split('##')[1])
|
||||||
: () => new Promise((resolve) => {
|
: () => import(`@/${route.component}`))
|
||||||
resolve(import(`${route.component}`))
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
// recursive child routes
|
// recursive child routes
|
||||||
if (route.children) {
|
if (route.children) {
|
||||||
|
|
|
@ -81,8 +81,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { setRoleApi, getRoleDetApi } from '../api'
|
import { setRoleApi, getRoleDetApi } from '../api'
|
||||||
import { defineComponent, PropType, ref, reactive, nextTick, unref } from 'vue'
|
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'
|
import { Message } from '_c/Message'
|
||||||
|
|
||||||
const requiredRule = {
|
const requiredRule = {
|
||||||
|
|
Loading…
Reference in New Issue