Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
micro-portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8039de4d
authored
Jun 03, 2021
by
冒粤蓉
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fux
1 parent
086a7a41
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
11 deletions
src/components/DesktopLeftSider/Sub/Menu.vue
src/micro/index.js
src/utils/common/common.js
src/components/DesktopLeftSider/Sub/Menu.vue
View file @
8039de4
...
...
@@ -85,6 +85,7 @@ import { useStore } from 'vuex';
import
MenuService
from
'services/Menu'
;
import
{
menuTree
as
menuTreeLocalList
}
from
'config/menuTree'
;
import
{
Common
}
from
'@/utils/common/common'
;
export
default
{
name
:
'Menu'
,
...
...
@@ -210,19 +211,27 @@ export default {
curBreadcrumb
=
JSON
.
parse
(
curBreadcrumb
);
}
// 同步激活样式
resData
.
forEach
((
item
,
index
)
=>
{
item
.
showSubList
=
item
.
origin
.
menuName
===
curBreadcrumb
[
0
].
name
;
resData
.
forEach
((
item
)
=>
{
const
{
menuName
:
pMenuName
}
=
item
.
origin
;
item
.
showSubList
=
pMenuName
===
curBreadcrumb
[
0
].
name
;
item
.
children
.
forEach
((
cItem
,
cIndex
)
=>
{
c
onst
{
frontRoute
}
=
cItem
;
cItem
.
subItemActive
=
curBreadcrumb
[
1
]
?
cItem
.
origin
.
menuName
===
curBreadcrumb
[
1
].
name
:
false
;
if
(
!
frontRoute
)
{
c
Item
.
frontRoute
=
'/noData'
;
c
Item
.
subItemActive
=
false
;
if
(
cItem
.
origin
.
menuName
===
curBreadcrumb
[
1
].
name
)
{
cItem
.
subItemActive
=
true
;
c
urBreadcrumb
[
1
].
id
=
cItem
.
id
;
}
})
});
// history.pushState(null, thisPath, thisPath);
// store.dispatch('menu/setBreadCrumb', state.curBreadCrumb);
if
(
isInit
&&
curBreadcrumb
)
{
let
thisBread
=
curBreadcrumb
[
curBreadcrumb
.
length
-
1
];
let
path
=
thisBread
.
path
||
'/noData'
;
let
name
=
thisBread
.
name
||
''
;
let
id
=
thisBread
.
id
||
''
;
name
&&
getMenuAuth
(
id
,
name
);
history
.
pushState
(
null
,
path
,
path
);
}
}
},
err
=>
{
...
...
@@ -260,7 +269,7 @@ export default {
titleClick
,
cItemClick
,
subMenuClicked
,
updateMenu
,
updateMenu
}
}
...
...
src/micro/index.js
View file @
8039de4
import
{
registerMicroApps
,
start
,
addGlobalUncaughtErrorHandler
,
setDefaultMountApp
,
initGlobalState
}
from
'qiankun'
;
import
store
from
'@/store'
;
import
router
from
'@/router'
;
import
{
Common
as
common
}
from
'@/utils/common/common'
;
// import apps from './apps';
const
showLoading
=
status
=>
{
...
...
@@ -19,14 +20,15 @@ const qianKunStart = (config, baseURL) => {
activeRule
:
i
.
activeRule
})
});
// props和container之后也要做动态配置
apps
.
map
(
i
=>
{
i
.
props
=
{
data
:
{
store
,
router
,
baseURL
baseURL
,
common
}
}
});
...
...
src/utils/common/common.js
0 → 100644
View file @
8039de4
import
store
from
'@/store/index'
;
export
const
Common
=
{
setAuthBtn
(
resData
)
{
let
data
=
resData
||
store
.
getters
.
curMenuAuth
.
data
;
const
authBtnEl
=
document
.
getElementsByTagName
(
'button'
);
const
authStringArr
=
[
'新增'
,
'编辑'
,
'删除'
,
'导出'
,
'导入'
,
'修改'
];
if
(
authBtnEl
&&
authBtnEl
.
length
>
0
)
{
if
(
data
&&
data
.
length
>
0
)
{
authBtnEl
.
forEach
(
elItem
=>
{
let
flag
=
true
;
let
authFlag
=
false
;
const
elText
=
elItem
.
innerText
;
authStringArr
.
forEach
(
authItem
=>
{
if
(
elText
.
includes
(
authItem
)){
authFlag
=
true
;
return
;
}
})
if
(
authFlag
)
{
data
.
forEach
(
labelItem
=>
{
if
(
flag
)
{
elItem
.
style
.
display
=
'none'
;
if
(
elText
.
includes
(
labelItem
.
label
))
{
elItem
.
style
.
display
=
'block'
;
flag
=
false
;
}
}
})
}
});
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment