File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 1- import { hasPermission } from '@/utils/permission/index'
1+ import { hasPermission , set_next_route } from '@/utils/permission/index'
22import NProgress from 'nprogress'
33import {
44 createRouter ,
@@ -42,6 +42,7 @@ router.beforeEach(
4242 await user . profile ( )
4343 }
4444 }
45+ set_next_route ( to )
4546 // 判断是否有菜单权限
4647 if ( to . meta . permission ? hasPermission ( to . meta . permission as any , 'OR' ) : true ) {
4748 next ( )
Original file line number Diff line number Diff line change @@ -45,8 +45,11 @@ const hasPermissionChild = (
4545 const roleOk = roleList . some ( ( r ) =>
4646 role . includes ( isFunction ( r ) ? ( r as CRF ) ( ) . toString ( ) : r . toString ( ) ) ,
4747 )
48- const editionList = permission . editionList
49- const editionOK = permission . editionList . length > 0 ?editionList . some ( e => edition . toString ( ) == e . toString ( ) ) :true
48+ const editionList = permission . editionList
49+ const editionOK =
50+ permission . editionList . length > 0
51+ ? editionList . some ( ( e ) => edition . toString ( ) == e . toString ( ) )
52+ : true
5053
5154 return permission . compare === 'AND'
5255 ? permissionOk && roleOk && editionOK
@@ -84,3 +87,14 @@ export const hasPermission = (
8487 return hasPermissionChild ( permission )
8588 }
8689}
90+
91+ const R = {
92+ to : null ,
93+ }
94+ export const get_next_route = ( ) => {
95+ return R . to
96+ }
97+
98+ export const set_next_route = ( to : any ) => {
99+ R . to = to
100+ }
You can’t perform that action at this time.
0 commit comments