Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcjg-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
c961dd90
authored
2023-03-24 17:28:05 +0800
by
任超
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
stytle:菜单
1 parent
a25db879
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
8 deletions
src/layout1/components/Sidebar/SidebarItem.vue
src/layout1/components/Sidebar/index.vue
src/permission.js
src/views/loginsb/index.vue
src/layout1/components/Sidebar/SidebarItem.vue
View file @
c961dd9
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-24 17:10:02
-->
<
template
>
<div
v-if=
"!item.hidden"
>
<template
...
...
@@ -65,9 +70,9 @@ export default {
})
// When there is only one child router, the child router is displayed by default
if
(
showingChildren
.
length
===
1
)
{
return
true
}
//
if (showingChildren.length === 1) {
//
return true
//
}
// Show parent if there are no child router to display
if
(
showingChildren
.
length
===
0
)
{
...
...
src/layout1/components/Sidebar/index.vue
View file @
c961dd9
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-2
3 16:17:4
2
* @LastEditTime: 2023-03-2
4 17:10:3
2
-->
<
template
>
<div>
...
...
@@ -9,7 +9,7 @@
<el-menu
router
:default-active=
"activeMenu"
:background-color=
"variables.menuBg"
:text-color=
"variables.menuText"
:unique-opened=
"true"
:active-text-color=
"variables.menuActiveText"
:collapse-transition=
"false"
mode=
"vertical"
>
<!-- 权限菜单 -->
<sidebar-item
v-for=
"route in permission_routes.slice(
4
)"
:key=
"route.path"
:item=
"route"
<sidebar-item
v-for=
"route in permission_routes.slice(
5
)"
:key=
"route.path"
:item=
"route"
:base-path=
"route.path"
/>
<!-- 菜单全部展示 -->
<!--
<sidebar-item
v-for=
"route in asyncRoutes"
:key=
"route.path"
:item=
"route"
:base-path=
"route.path"
/>
-->
...
...
@@ -50,7 +50,7 @@ export default {
}
},
mounted
()
{
console
.
log
(
this
.
permission_routes
,
'permission_routes
permission_routes'
);
console
.
log
(
this
.
permission_routes
.
slice
(
5
),
'
permission_routes'
);
}
}
</
script
>
...
...
src/permission.js
View file @
c961dd9
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-24 1
6:59:29
* @LastEditTime: 2023-03-24 1
7:24:52
*/
import
Vue
from
'vue'
import
router
from
"./router"
;
...
...
@@ -33,6 +33,7 @@ router.beforeEach(async (to, from, next) => {
if
(
!
hasUser
)
{
store
.
dispatch
(
"user/getUserInfo"
);
}
debugger
if
(
hasAddRoute
)
{
next
();
}
else
{
...
...
src/views/loginsb/index.vue
View file @
c961dd9
...
...
@@ -111,7 +111,7 @@ export default {
let
code
=
this
.
BASE_API
.
CODE
;
localStorage
.
setItem
(
"token"
,
`Bearer
${
res
.
content
}
`
);
const
{
result
:
getMenuData
}
=
(
await
getMenuInfo
(
code
))
||
[];
let
path1
=
JSON
.
parse
(
getMenuData
[
0
].
metadata
)?.
path
+
'/'
+
JSON
.
parse
(
getMenuData
[
0
].
children
[
0
].
metadata
)?.
path
let
path1
=
JSON
.
parse
(
getMenuData
[
1
].
metadata
)?.
path
+
'/'
+
JSON
.
parse
(
getMenuData
[
1
].
children
[
0
].
metadata
)?.
path
//登录成功后需判断有无重定向,没有重定向则跳转首页
const
accessRoutes
=
await
this
.
$store
.
dispatch
(
"permission/generateRoutes"
,
...
...
Please
register
or
sign in
to post a comment