Commit 32fa2af7 authored by trumansdo's avatar trumansdo
Browse files

开始进行登录逻辑和用户权限部分修改

加入jwt登录控制,取消配置文件中userid和orgid配置
parent 18144407
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>admin-console</artifactId> <artifactId>admin-console</artifactId>
...@@ -23,12 +24,9 @@ ...@@ -23,12 +24,9 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version> <version>${mysql.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId> <artifactId>spring-boot-starter-log4j2</artifactId>
<version>2.1.7.RELEASE</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -111,5 +111,11 @@ ...@@ -111,5 +111,11 @@
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
<version>3.17</version> <version>3.17</version>
</dependency> </dependency>
<!-- jwt 的Java库,根据JSON Web Token 官网推荐 -->
<dependency>
<groupId>org.bitbucket.b_c</groupId>
<artifactId>jose4j</artifactId>
<version>0.6.5</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
package com.ibeetl.admin.core.conf; package com.ibeetl.admin.core.conf;
import org.beetl.core.Context; import com.ibeetl.admin.core.entity.CoreOrg;
import org.beetl.core.Function; import com.ibeetl.admin.core.entity.CoreUser;
import com.ibeetl.admin.core.service.CorePlatformService;
import com.ibeetl.admin.core.service.CoreUserService;
import com.ibeetl.admin.core.util.HttpRequestLocal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.beetl.core.GroupTemplate; import org.beetl.core.GroupTemplate;
import org.beetl.ext.spring.BeetlGroupUtilConfiguration; import org.beetl.ext.spring.BeetlGroupUtilConfiguration;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.format.FormatterRegistry; import org.springframework.format.FormatterRegistry;
import org.springframework.format.datetime.DateFormatter; import org.springframework.format.datetime.DateFormatter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.validation.MessageCodesResolver;
import org.springframework.validation.Validator;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.ibeetl.admin.core.entity.CoreOrg;
import com.ibeetl.admin.core.entity.CoreUser;
import com.ibeetl.admin.core.service.CorePlatformService;
import com.ibeetl.admin.core.service.CoreUserService;
import com.ibeetl.admin.core.util.HttpRequestLocal;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Configuration @Configuration
public class MVCConf implements WebMvcConfigurer, InitializingBean { public class MVCConf implements WebMvcConfigurer, InitializingBean {
......
...@@ -3,7 +3,7 @@ package com.ibeetl.admin.core.util; ...@@ -3,7 +3,7 @@ package com.ibeetl.admin.core.util;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
/** /**
* 用户Controller对应的功能 {@link MVCConf} * 用户Controller对应的功能 {@link com.ibeetl.admin.core.conf.MVCConf}
* *
* @author lijiazhi * @author lijiazhi
*/ */
......
package com.ibeetl.admin.core.util;
import org.jose4j.lang.JoseException;
/**
* 基于jose4j的jwt库工具类。
* 包括:生成,反生成
* @author 一日看尽长安花
* */
public class JoseJwtUtil {
public Object generateJwtJson() throws JoseException {
return null;
}
public Object degenerateJwtJson() throws JoseException {
return null;
}
}
...@@ -57,6 +57,12 @@ ...@@ -57,6 +57,12 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId> <artifactId>spring-boot-starter-quartz</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
......
...@@ -30,6 +30,7 @@ module.exports = { ...@@ -30,6 +30,7 @@ module.exports = {
'no-debugger': 'off', 'no-debugger': 'off',
'no-unused-vars': 'off', 'no-unused-vars': 'off',
'vue/no-unused-vars': 'off', 'vue/no-unused-vars': 'off',
'no-useless-escape': 'off',
quotes: [ quotes: [
2, 2,
'single', 'single',
......
// Just a mock data,模拟后台发送的路由表 // Just a mock data,模拟后台发送的路由表
/*
后端路由表中单个路由应该具有的信息
{
"path": "/profile",
"name": "router-name",
"meta": {
"title": "Profile",
"roles": ["admin", "editor"],
"icon": "user"
},
"children": []
}
*/
export const constantRoutes = [] export const constantRoutes = []
export const asyncRoutes = [ export const asyncRoutes = [
{
path: '/permission',
name: 'Permission',
meta: {
title: 'Permission',
icon: 'lock',
roles: ['admin', 'editor'] // you can set roles in root nav
},
children: [
{
path: 'page',
name: 'PagePermission',
meta: {
title: 'Page Permission',
roles: ['admin'] // or you can only set roles in sub nav
}
},
{
path: 'directive',
name: 'DirectivePermission',
meta: {
title: 'Directive Permission'
// if do not set roles, means: this page does not require permission
}
},
{
path: 'role',
name: 'RolePermission',
meta: {
title: 'Role Permission',
roles: ['admin']
}
}
]
},
{
path: '/icon',
children: [
{
path: 'index',
name: 'Icons',
meta: { title: 'Icons', icon: 'icon' }
}
]
},
{
path: '/components',
name: 'ComponentDemo',
meta: {
title: 'Components',
icon: 'component'
},
children: [
{
path: 'tinymce',
name: 'TinymceDemo',
meta: { title: 'Tinymce' }
},
{
path: 'markdown',
name: 'MarkdownDemo',
meta: { title: 'Markdown' }
},
{
path: 'json-editor',
name: 'JsonEditorDemo',
meta: { title: 'JSON Editor' }
},
{
path: 'split-pane',
name: 'SplitpaneDemo',
meta: { title: 'SplitPane' }
},
{
path: 'avatar-upload',
name: 'AvatarUploadDemo',
meta: { title: 'Upload' }
},
{
path: 'dropzone',
name: 'DropzoneDemo',
meta: { title: 'Dropzone' }
},
{
path: 'sticky',
name: 'StickyDemo',
meta: { title: 'Sticky' }
},
{
path: 'count-to',
name: 'CountToDemo',
meta: { title: 'Count To' }
},
{
path: 'mixin',
name: 'ComponentMixinDemo',
meta: { title: 'Component Mixin' }
},
{
path: 'back-to-top',
name: 'BackToTopDemo',
meta: { title: 'Back To Top' }
},
{
path: 'drag-dialog',
name: 'DragDialogDemo',
meta: { title: 'Drag Dialog' }
},
{
path: 'drag-select',
name: 'DragSelectDemo',
meta: { title: 'Drag Select' }
},
{
path: 'dnd-list',
name: 'DndListDemo',
meta: { title: 'Dnd List' }
},
{
path: 'drag-kanban',
name: 'DragKanbanDemo',
meta: { title: 'Drag Kanban' }
}
]
},
{
path: '/charts',
name: 'Charts',
meta: {
title: 'Charts',
icon: 'chart'
},
children: [
{
path: 'keyboard',
name: 'KeyboardChart',
meta: { title: 'Keyboard Chart' }
},
{
path: 'line',
name: 'LineChart',
meta: { title: 'Line Chart' }
},
{
path: 'mix-chart',
name: 'MixChart',
meta: { title: 'Mix Chart' }
}
]
},
{
path: '/nested',
name: 'Nested',
meta: {
title: 'Nested Routes',
icon: 'nested'
},
children: [
{
path: 'menu1',
name: 'Menu1',
meta: { title: 'Menu 1' },
children: [
{
path: 'menu1-1',
name: 'Menu1-1',
meta: { title: 'Menu 1-1' }
},
{
path: 'menu1-2',
name: 'Menu1-2',
meta: { title: 'Menu 1-2' },
children: [
{
path: 'menu1-2-1',
name: 'Menu1-2-1',
meta: { title: 'Menu 1-2-1' }
},
{
path: 'menu1-2-2',
name: 'Menu1-2-2',
meta: { title: 'Menu 1-2-2' }
}
]
},
{
path: 'menu1-3',
name: 'Menu1-3',
meta: { title: 'Menu 1-3' }
}
]
},
{
path: 'menu2',
name: 'Menu2',
meta: { title: 'Menu 2' }
}
]
},
{ {
path: '/table', path: '/table',
name: 'Table', name: 'Table',
...@@ -11,11 +227,191 @@ export const asyncRoutes = [ ...@@ -11,11 +227,191 @@ export const asyncRoutes = [
icon: 'table' icon: 'table'
}, },
children: [ children: [
{
path: 'dynamic-table',
name: 'DynamicTable',
meta: { title: 'Dynamic Table' }
},
{
path: 'drag-table',
name: 'DragTable',
meta: { title: 'Drag Table' }
},
{
path: 'inline-edit-table',
name: 'InlineEditTable',
meta: { title: 'Inline Edit' }
},
{ {
path: 'complex-table', path: 'complex-table',
name: 'ComplexTable', name: 'ComplexTable',
meta: { title: 'Complex Table' } meta: { title: 'Complex Table' }
} }
] ]
},
{
path: '/example',
name: 'Example',
meta: {
title: 'Example',
icon: 'example'
},
children: [
{
path: 'create',
name: 'CreateArticle',
meta: { title: 'Create Article', icon: 'edit' }
},
{
path: 'edit/:id(\\d+)',
name: 'EditArticle',
meta: {
title: 'Edit Article',
} }
},
{
path: 'list',
name: 'ArticleList',
meta: { title: 'Article List', icon: 'list' }
}
]
},
{
path: '/tab',
children: [
{
path: 'index',
name: 'Tab',
meta: { title: 'Tab', icon: 'tab' }
}
]
},
{
path: '/error',
name: 'ErrorPages',
meta: {
title: 'Error Pages',
icon: '404'
},
children: [
{
path: '401',
name: 'Page401',
meta: { title: '401' }
},
{
path: '404',
name: 'Page404',
meta: { title: '404' }
}
]
},
{
path: '/error-log',
children: [
{
path: 'log',
name: 'ErrorLog',
meta: { title: 'Error Log', icon: 'bug' }
}
]
},
{
path: '/excel',
name: 'Excel',
meta: {
title: 'Excel',
icon: 'excel'
},
children: [
{
path: 'export-excel',
name: 'ExportExcel',
meta: { title: 'Export Excel' }
},
{
path: 'export-selected-excel',
name: 'SelectExcel',
meta: { title: 'Export Selected' }
},
{
path: 'export-merge-header',
name: 'MergeHeader',
meta: { title: 'Merge Header' }
},
{
path: 'upload-excel',
name: 'UploadExcel',
meta: { title: 'Upload Excel' }
}
]
},
{
path: '/zip',
name: 'Zip',
meta: { title: 'Zip', icon: 'zip' },
children: [
{
path: 'download',
name: 'ExportZip',
meta: { title: 'Export Zip' }
}
]
},
{
path: '/pdf',
children: [
{
path: 'index',
name: 'PDF',
meta: { title: 'PDF', icon: 'pdf' }
}
]
},
{
path: '/pdf/download',
hidden: true
},
{
path: '/theme',
children: [
{
path: 'index',
name: 'Theme',
meta: { title: 'Theme', icon: 'theme' }
}
]
},
{
path: '/clipboard',
children: [
{
path: 'index',
name: 'ClipboardDemo',
meta: { title: 'Clipboard', icon: 'clipboard' }
}
]
},
{
path: 'external-link',
children: [
{
path: 'https://github.com/PanJiaChen/vue-element-admin',
meta: { title: 'External Link', icon: 'link' }
}
]
},
// 404 page must be placed at the end !!!
{ path: '*', redirect: '/404', hidden: true }
] ]
...@@ -66,7 +66,7 @@ export const constantRoutes = [ ...@@ -66,7 +66,7 @@ export const constantRoutes = [
path: 'index', path: 'index',
component: () => import('@/views/documentation/index'), component: () => import('@/views/documentation/index'),
name: 'Documentation', name: 'Documentation',
meta: { title: 'Documentation', icon: 'documentation', affix: true } meta: { title: 'Documentation', icon: 'documentation', affix: false }
} }
] ]
}, },
......
/** When your routing table is too long, you can split it into small modules**/
import Layout from '@/layout'
const chartsRouter = {
path: '/charts',
component: Layout,
redirect: 'noRedirect',
name: 'Charts',
children: [
{
path: 'keyboard',
component: () => import('@/views/charts/keyboard'),
name: 'KeyboardChart',
meta: { noCache: true }
},
{
path: 'line',
component: () => import('@/views/charts/line'),
name: 'LineChart',
meta: { noCache: true }
},
{
path: 'mix-chart',
component: () => import('@/views/charts/mix-chart'),
name: 'MixChart',
meta: { noCache: true }
}
]
}
export default chartsRouter
/** When your routing table is too long, you can split it into small modules **/
import Layout from '@/layout'
const componentsRouter = {
path: '/components',
component: Layout,
redirect: 'noRedirect',
name: 'ComponentDemo',
children: [
{
path: 'tinymce',
component: () => import('@/views/components-demo/tinymce'),
name: 'TinymceDemo'
},
{
path: 'markdown',
component: () => import('@/views/components-demo/markdown'),
name: 'MarkdownDemo'
},
{
path: 'json-editor',
component: () => import('@/views/components-demo/json-editor'),
name: 'JsonEditorDemo'
},
{
path: 'split-pane',
component: () => import('@/views/components-demo/split-pane'),
name: 'SplitpaneDemo'
},
{
path: 'avatar-upload',
component: () => import('@/views/components-demo/avatar-upload'),
name: 'AvatarUploadDemo'
},
{
path: 'dropzone',
component: () => import('@/views/components-demo/dropzone'),
name: 'DropzoneDemo'
},
{
path: 'sticky',
component: () => import('@/views/components-demo/sticky'),
name: 'StickyDemo'
},
{
path: 'count-to',
component: () => import('@/views/components-demo/count-to'),
name: 'CountToDemo'
},
{
path: 'mixin',
component: () => import('@/views/components-demo/mixin'),
name: 'ComponentMixinDemo'
},
{
path: 'back-to-top',
component: () => import('@/views/components-demo/back-to-top'),
name: 'BackToTopDemo'
},
{
path: 'drag-dialog',
component: () => import('@/views/components-demo/drag-dialog'),
name: 'DragDialogDemo'
},
{
path: 'drag-select',
component: () => import('@/views/components-demo/drag-select'),
name: 'DragSelectDemo'
},
{
path: 'dnd-list',
component: () => import('@/views/components-demo/dnd-list'),
name: 'DndListDemo'
},
{
path: 'drag-kanban',
component: () => import('@/views/components-demo/drag-kanban'),
name: 'DragKanbanDemo'
}
]
}
export default componentsRouter
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
/* Layout */ /* Layout */
import Layout from '@/layout' import Layout from '@/layout'
/* Router Modules */ /* Router Map Modules */
// import componentsRouter from './modules/components' import componentsRouter from './components'
// import chartsRouter from './modules/charts' import chartsRouter from './charts'
// import tableRouter from './modules/table' import tableRouter from './table'
// import nestedRouter from './modules/nested' import nestedRouter from './nested'
/** /**
* Note: sub-menu only appear when route children.length >= 1 * Note: sub-menu only appear when route children.length >= 1
...@@ -40,21 +40,211 @@ import Layout from '@/layout' ...@@ -40,21 +40,211 @@ import Layout from '@/layout'
*/ */
export const asyncRoutesMap = [ export const asyncRoutesMap = [
{ {
path: '/table', path: '/permission',
component: Layout, component: Layout,
redirect: '/table/complex-table', redirect: '/permission/page',
alwaysShow: true, // will always show the root menu
name: 'Permission',
children: [
{
path: 'page',
component: () => import('@/views/permission/page'),
name: 'PagePermission'
},
{
path: 'directive',
component: () => import('@/views/permission/directive'),
name: 'DirectivePermission'
},
{
path: 'role',
component: () => import('@/views/permission/role'),
name: 'RolePermission'
}
]
},
{
path: '/icon',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/icons/index'),
name: 'Icons',
meta: { noCache: true }
}
]
},
/** when your routing map is too long, you can split it into small modules **/
componentsRouter,
chartsRouter,
nestedRouter,
tableRouter,
{
path: '/example',
component: Layout,
redirect: '/example/list',
name: 'Example',
children: [
{
path: 'create',
component: () => import('@/views/example/create'),
name: 'CreateArticle'
},
{
path: 'edit/:id(\\d+)',
component: () => import('@/views/example/edit'),
name: 'EditArticle',
meta: { noCache: true, activeMenu: '/example/list' },
hidden: true
},
{
path: 'list',
component: () => import('@/views/example/list'),
name: 'ArticleList'
}
]
},
{
path: '/tab',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/tab/index'),
name: 'Tab'
}
]
},
{
path: '/error',
component: Layout,
redirect: 'noRedirect',
name: 'ErrorPages',
children: [
{
path: '401',
component: () => import('@/views/error-page/401'),
name: 'Page401',
meta: { noCache: true }
},
{
path: '404',
component: () => import('@/views/error-page/404'),
name: 'Page404',
meta: { noCache: true }
}
]
},
{
path: '/error-log',
component: Layout,
children: [
{
path: 'log',
component: () => import('@/views/error-log/index'),
name: 'ErrorLog'
}
]
},
{
path: '/excel',
component: Layout,
redirect: '/excel/export-excel',
name: 'Excel',
children: [
{
path: 'export-excel',
component: () => import('@/views/excel/export-excel'),
name: 'ExportExcel'
},
{
path: 'export-selected-excel',
component: () => import('@/views/excel/select-excel'),
name: 'SelectExcel'
},
{
path: 'export-merge-header',
component: () => import('@/views/excel/merge-header'),
name: 'MergeHeader'
},
{
path: 'upload-excel',
component: () => import('@/views/excel/upload-excel'),
name: 'UploadExcel'
}
]
},
{
path: '/zip',
component: Layout,
redirect: '/zip/download',
alwaysShow: true, alwaysShow: true,
name: 'Table', name: 'Zip',
meta: { children: [
noCache: true, {
affix: false, path: 'download',
breadcrumb: false component: () => import('@/views/zip/index'),
name: 'ExportZip'
}
]
},
{
path: '/pdf',
component: Layout,
redirect: '/pdf/index',
children: [
{
path: 'index',
component: () => import('@/views/pdf/index'),
name: 'PDF'
}
]
},
{
path: '/pdf/download',
component: () => import('@/views/pdf/download'),
hidden: true
}, },
{
path: '/theme',
component: Layout,
children: [ children: [
{ {
path: 'complex-table', path: 'index',
component: () => import('@/views/table/complex-table'), component: () => import('@/views/theme/index'),
name: 'ComplexTable' name: 'Theme'
}
]
},
{
path: '/clipboard',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/clipboard/index'),
name: 'ClipboardDemo'
}
]
},
{
path: 'external-link',
component: Layout,
children: [
{
path: 'https://github.com/PanJiaChen/vue-element-admin'
} }
] ]
}, },
...@@ -63,7 +253,7 @@ export const asyncRoutesMap = [ ...@@ -63,7 +253,7 @@ export const asyncRoutesMap = [
{ path: '*', redirect: '/404', hidden: true } { path: '*', redirect: '/404', hidden: true }
] ]
/* /*
前端路由表中单个路由映射全部具有的信息 前端路由映射表中单个路由映射全部具有的信息
{ {
"path": "/profile", "path": "/profile",
"component": "Layout", "component": "Layout",
...@@ -90,8 +280,4 @@ export const asyncRoutesMap = [ ...@@ -90,8 +280,4 @@ export const asyncRoutesMap = [
}, },
"children": [] "children": []
} }
*/ */
/** When your routing table is too long, you can split it into small modules **/
import Layout from '@/layout'
const nestedRouter = {
path: '/nested',
component: Layout,
redirect: '/nested/menu1/menu1-1',
name: 'Nested',
children: [
{
path: 'menu1',
component: () => import('@/views/nested/menu1/index'), // Parent router-view
name: 'Menu1',
redirect: '/nested/menu1/menu1-1',
children: [
{
path: 'menu1-1',
component: () => import('@/views/nested/menu1/menu1-1'),
name: 'Menu1-1'
},
{
path: 'menu1-2',
component: () => import('@/views/nested/menu1/menu1-2'),
name: 'Menu1-2',
redirect: '/nested/menu1/menu1-2/menu1-2-1',
children: [
{
path: 'menu1-2-1',
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
name: 'Menu1-2-1'
},
{
path: 'menu1-2-2',
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
name: 'Menu1-2-2'
}
]
},
{
path: 'menu1-3',
component: () => import('@/views/nested/menu1/menu1-3'),
name: 'Menu1-3'
}
]
},
{
path: 'menu2',
name: 'Menu2',
component: () => import('@/views/nested/menu2/index')
}
]
}
export default nestedRouter
/** When your routing table is too long, you can split it into small modules **/
import Layout from '@/layout'
const tableRouter = {
path: '/table',
component: Layout,
redirect: '/table/complex-table',
name: 'Table',
children: [
{
path: 'dynamic-table',
component: () => import('@/views/table/dynamic-table/index'),
name: 'DynamicTable'
},
{
path: 'drag-table',
component: () => import('@/views/table/drag-table'),
name: 'DragTable'
},
{
path: 'inline-edit-table',
component: () => import('@/views/table/inline-edit-table'),
name: 'InlineEditTable'
},
{
path: 'complex-table',
component: () => import('@/views/table/complex-table'),
name: 'ComplexTable'
}
]
}
export default tableRouter
import { constantRoutes } from '@/router' import { constantRoutes } from '@/router'
import { getRoutes } from '@/api/role' import { getRoutes } from '@/api/role'
import { asyncRoutesMap } from '@/router/route_map' import { asyncRoutesMap } from '@/router/maps/index'
import { deepClone, objectMerge } from '@/utils/index' import { deepClone, objectMerge } from '@/utils/index'
/** /**
...@@ -30,11 +30,11 @@ export function filterAsyncRoutes(routesMap, routes, roles) { ...@@ -30,11 +30,11 @@ export function filterAsyncRoutes(routesMap, routes, roles) {
let tempRoute = { ...route } let tempRoute = { ...route }
let tempRouteMap let tempRouteMap
for (let rm of routesMap) { for (let rm of routesMap) {
if (!rm.name || !route.name | !rm.path | !route.path) { if ( !rm.path || !route.path) {
console.error(`检查路由表中 ${rm.name} 信息`) console.error(`检查路由表中 ${rm.name} 的path信息,path必须在同级唯一`)
continue continue
} }
if (rm.name === route.name) { if (rm.path === route.path) {
tempRouteMap = { ...rm } tempRouteMap = { ...rm }
break break
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment