Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
中汽测评-信息安全测评系统
web
Commits
841dd0d2
Commit
841dd0d2
authored
Mar 11, 2024
by
jiaxu.yan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://gitlab.91isoft.com:90/car-test/web
into develop
parents
bb2cab8e
8d869221
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
index.vue
src/components/Breadcrumb/index.vue
+21
-6
permission.js
src/store/modules/permission.js
+9
-1
No files found.
src/components/Breadcrumb/index.vue
View file @
841dd0d2
...
@@ -36,19 +36,34 @@ export default {
...
@@ -36,19 +36,34 @@ export default {
},
},
methods
:
{
methods
:
{
getBreadcrumb
()
{
getBreadcrumb
()
{
// only show routes with meta.title
//
//
only show routes with meta.title
let
matched
=
this
.
$route
.
matched
.
filter
(
let
matched
=
this
.
$route
.
matched
.
filter
(
item
=>
item
.
meta
&&
item
.
meta
.
title
item
=>
item
.
meta
&&
item
.
meta
.
title
)
)
const
first
=
matched
[
0
]
const
first
=
matched
[
0
]
if
(
!
this
.
isDashboard
(
first
))
{
if
(
!
this
.
isDashboard
(
first
))
{
matched
=
[{
path
:
'/index'
,
meta
:
{
title
:
'首页'
}
}].
concat
(
matched
)
matched
=
[{
path
:
'/index'
,
meta
:
{
title
:
'首页'
}
}].
concat
(
matched
)
}
}
const
temp
=
matched
.
filter
(
item
=>
item
.
meta
&&
item
.
meta
.
title
&&
item
.
meta
.
breadcrumb
!==
false
)
this
.
levelList
=
matched
.
filter
(
// 为三级面包屑提供逻辑 从$route parentName取值
item
=>
item
.
meta
&&
item
.
meta
.
title
&&
item
.
meta
.
breadcrumb
!==
false
if
(
this
.
$route
.
meta
.
secondaryMenuName
)
{
)
temp
.
splice
(
-
1
,
0
,
{
redirect
:
'noRedirect'
,
meta
:
{
title
:
this
.
$route
.
meta
.
secondaryMenuName
},
path
:
'secondaryMenuName'
})
}
this
.
levelList
=
this
.
removeDuplicateTitles
(
temp
)
},
// 去除同名title的面包屑
removeDuplicateTitles
(
arr
)
{
const
titles
=
new
Set
()
// 用于存储已经遇到的title值
const
result
=
[]
// 存储最终的结果数组
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
const
title
=
arr
[
i
].
meta
.
title
console
.
log
(
'面包屑'
,
title
)
if
(
!
titles
.
has
(
title
))
{
titles
.
add
(
title
)
result
.
push
(
arr
[
i
])
}
}
return
result
},
},
isDashboard
(
route
)
{
isDashboard
(
route
)
{
const
name
=
route
&&
route
.
name
const
name
=
route
&&
route
.
name
...
...
src/store/modules/permission.js
View file @
841dd0d2
...
@@ -37,14 +37,22 @@ const permission = {
...
@@ -37,14 +37,22 @@ const permission = {
const
sdata
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
const
sdata
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
const
rdata
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
const
rdata
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
const
sidebarRoutes
=
filterAsyncRouter
(
sdata
)
const
sidebarRoutes
=
filterAsyncRouter
(
sdata
)
sidebarRoutes
.
forEach
(
item
=>
{
if
(
item
.
children
&&
item
.
children
.
length
>
0
){
item
.
children
.
forEach
(
c
=>
{
c
.
meta
[
'activeMenu'
]
=
`
${
item
.
path
===
'/'
?
''
:
item
.
path
}
/
${
item
.
children
[
0
].
path
}
`
})
}
})
const
rewriteRoutes
=
filterAsyncRouter
(
rdata
,
false
,
true
)
const
rewriteRoutes
=
filterAsyncRouter
(
rdata
,
false
,
true
)
console
.
log
(
'rewriteRoutes'
,
rewriteRoutes
)
rewriteRoutes
.
forEach
(
item
=>
{
rewriteRoutes
.
forEach
(
item
=>
{
if
(
item
.
children
&&
item
.
children
.
length
>
0
){
if
(
item
.
children
&&
item
.
children
.
length
>
0
){
for
(
let
i
=
0
;
i
<
item
.
children
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
item
.
children
.
length
;
i
++
)
{
// 将parentName字段放入meta中
// 将parentName字段放入meta中
if
(
item
.
children
[
i
].
secondaryMenuName
)
{
if
(
item
.
children
[
i
].
secondaryMenuName
)
{
item
.
children
[
i
].
meta
[
'secondaryMenuName'
]
=
item
.
children
[
i
].
secondaryMenuName
item
.
children
[
i
].
meta
[
'secondaryMenuName'
]
=
item
.
children
[
i
].
secondaryMenuName
// item.children[i - 1].meta['activeMenu'] = `${item.path === '/' ? '' : item.path}/${item.children[i
].path}`
item
.
children
[
i
].
meta
[
'activeMenu'
]
=
`
${
item
.
path
===
'/'
?
''
:
item
.
path
}
/
${
item
.
children
[
i
+
1
].
path
}
`
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment