Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cocktail-party-server
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
cocktail-party
cocktail-party-server
Commits
9aac65ff
提交
9aac65ff
authored
4月 12, 2021
作者:
RuoYi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增菜单导航显示风格TopNav(false为左侧导航菜单,true为顶部导航菜单)
上级
5f235056
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
204 行增加
和
8 行删除
+204
-8
ruoyi.scss
ruoyi-ui/src/assets/styles/ruoyi.scss
+6
-0
sidebar.scss
ruoyi-ui/src/assets/styles/sidebar.scss
+0
-3
index.vue
ruoyi-ui/src/components/TopNav/index.vue
+143
-0
Navbar.vue
ruoyi-ui/src/layout/components/Navbar.vue
+9
-1
index.vue
ruoyi-ui/src/layout/components/Settings/index.vue
+19
-0
settings.js
ruoyi-ui/src/settings.js
+5
-0
getters.js
ruoyi-ui/src/store/getters.js
+2
-0
permission.js
ruoyi-ui/src/store/modules/permission.js
+18
-3
settings.js
ruoyi-ui/src/store/modules/settings.js
+2
-1
没有找到文件。
ruoyi-ui/src/assets/styles/ruoyi.scss
浏览文件 @
9aac65ff
...
@@ -176,6 +176,12 @@
...
@@ -176,6 +176,12 @@
color
:
#FFFFFF
;
color
:
#FFFFFF
;
}
}
/* submenu item */
.el-menu--horizontal
>
.el-submenu
.el-submenu__title
{
height
:
50px
!
important
;
line-height
:
50px
!
important
;
}
/* text color */
/* text color */
.text-navy
{
.text-navy
{
color
:
#1ab394
;
color
:
#1ab394
;
...
...
ruoyi-ui/src/assets/styles/sidebar.scss
浏览文件 @
9aac65ff
...
@@ -135,9 +135,6 @@
...
@@ -135,9 +135,6 @@
margin-left
:
20px
;
margin-left
:
20px
;
}
}
.el-submenu__icon-arrow
{
display
:
none
;
}
}
}
}
}
...
...
ruoyi-ui/src/components/TopNav/index.vue
0 → 100644
浏览文件 @
9aac65ff
<
template
>
<el-menu
:default-active=
"activeMenu"
mode=
"horizontal"
@
select=
"handleSelect"
>
<template
v-for=
"(item, index) in topMenus"
>
<el-menu-item
:index=
"item.path"
:key=
"index"
v-if=
"index
<
visibleNumber
"
><svg-icon
:icon-class=
"item.meta.icon"
/>
{{
item
.
meta
.
title
}}
</el-menu-item
>
</
template
>
<!-- 顶部菜单超出数量折叠 -->
<el-submenu
index=
"more"
v-if=
"topMenus.length > visibleNumber"
>
<
template
slot=
"title"
>
更多菜单
</
template
>
<
template
v-for=
"(item, index) in topMenus"
>
<el-menu-item
:index=
"item.path"
:key=
"index"
v-if=
"index >= visibleNumber"
><svg-icon
:icon-class=
"item.meta.icon"
/>
{{
item
.
meta
.
title
}}
</el-menu-item
>
</
template
>
</el-submenu>
</el-menu>
</template>
<
script
>
import
{
constantRoutes
}
from
"@/router"
;
export
default
{
data
()
{
return
{
// 顶部栏初始数
visibleNumber
:
5
,
// 是否为首次加载
isFrist
:
false
,
};
},
computed
:
{
// 顶部显示菜单
topMenus
()
{
return
this
.
routers
.
map
((
menu
)
=>
({
...
menu
,
children
:
undefined
,
}));
},
// 所有的路由信息
routers
()
{
return
this
.
$store
.
state
.
permission
.
topbarRouters
;
},
// 设置子路由
childrenMenus
()
{
var
childrenMenus
=
[];
this
.
routers
.
map
((
router
)
=>
{
for
(
var
item
in
router
.
children
)
{
if
(
router
.
children
[
item
].
parentPath
===
undefined
)
{
router
.
children
[
item
].
path
=
router
.
path
+
"/"
+
router
.
children
[
item
].
path
;
router
.
children
[
item
].
parentPath
=
router
.
path
;
}
childrenMenus
.
push
(
router
.
children
[
item
]);
}
});
return
constantRoutes
.
concat
(
childrenMenus
);
},
// 默认激活的菜单
activeMenu
()
{
const
path
=
this
.
$route
.
path
;
let
activePath
=
this
.
routers
[
0
].
path
;
if
(
path
.
lastIndexOf
(
"/"
)
>
0
)
{
const
tmpPath
=
path
.
substring
(
1
,
path
.
length
);
activePath
=
"/"
+
tmpPath
.
substring
(
0
,
tmpPath
.
indexOf
(
"/"
));
}
else
if
(
"/index"
==
path
||
""
==
path
)
{
if
(
!
this
.
isFrist
)
{
this
.
isFrist
=
true
;
}
else
{
activePath
=
"index"
;
}
}
this
.
activeRoutes
(
activePath
);
return
activePath
;
},
},
mounted
()
{
this
.
setVisibleNumber
();
},
methods
:
{
// 根据宽度计算设置显示栏数
setVisibleNumber
()
{
const
width
=
document
.
body
.
getBoundingClientRect
().
width
-
200
;
const
elWidth
=
this
.
$el
.
getBoundingClientRect
().
width
;
const
menuItemNodes
=
this
.
$el
.
children
;
const
menuWidth
=
Array
.
from
(
menuItemNodes
).
map
(
(
i
)
=>
i
.
getBoundingClientRect
().
width
);
this
.
visibleNumber
=
(
parseInt
(
width
-
elWidth
)
/
parseInt
(
menuWidth
)
).
toFixed
(
0
);
},
// 菜单选择事件
handleSelect
(
key
,
keyPath
)
{
if
(
key
.
indexOf
(
"http://"
)
!==
-
1
||
key
.
indexOf
(
"https://"
)
!==
-
1
)
{
// http(s):// 路径新窗口打开
window
.
open
(
key
,
"_blank"
);
}
else
{
this
.
activeRoutes
(
key
);
}
},
// 当前激活的路由
activeRoutes
(
key
)
{
var
routes
=
[];
if
(
this
.
childrenMenus
&&
this
.
childrenMenus
.
length
>
0
)
{
this
.
childrenMenus
.
map
((
item
)
=>
{
if
(
key
==
item
.
parentPath
||
(
key
==
"index"
&&
""
==
item
.
path
))
{
routes
.
push
(
item
);
}
});
}
this
.
$store
.
commit
(
"SET_SIDEBAR_ROUTERS"
,
routes
);
},
},
};
</
script
>
<
style
lang=
"scss"
scoped
>
.el-menu--horizontal
>
.el-menu-item
{
float
:
left
;
height
:
50px
;
line-height
:
50px
;
margin
:
0
;
border-bottom
:
3px
solid
transparent
;
color
:
#999093
;
padding
:
0
5px
;
margin
:
0
10px
;
}
.el-menu--horizontal
>
.el-menu-item.is-active
{
border-bottom
:
3px
solid
#409eff
;
color
:
#303133
;
}
</
style
>
ruoyi-ui/src/layout/components/Navbar.vue
浏览文件 @
9aac65ff
...
@@ -2,7 +2,8 @@
...
@@ -2,7 +2,8 @@
<div
class=
"navbar"
>
<div
class=
"navbar"
>
<hamburger
id=
"hamburger-container"
:is-active=
"sidebar.opened"
class=
"hamburger-container"
@
toggleClick=
"toggleSideBar"
/>
<hamburger
id=
"hamburger-container"
:is-active=
"sidebar.opened"
class=
"hamburger-container"
@
toggleClick=
"toggleSideBar"
/>
<breadcrumb
id=
"breadcrumb-container"
class=
"breadcrumb-container"
/>
<breadcrumb
id=
"breadcrumb-container"
class=
"breadcrumb-container"
v-if=
"!topNav"
/>
<top-nav
id=
"topmenu-container"
class=
"breadcrumb-container"
v-if=
"topNav"
/>
<div
class=
"right-menu"
>
<div
class=
"right-menu"
>
<template
v-if=
"device!=='mobile'"
>
<template
v-if=
"device!=='mobile'"
>
...
@@ -48,6 +49,7 @@
...
@@ -48,6 +49,7 @@
<
script
>
<
script
>
import
{
mapGetters
}
from
'vuex'
import
{
mapGetters
}
from
'vuex'
import
Breadcrumb
from
'@/components/Breadcrumb'
import
Breadcrumb
from
'@/components/Breadcrumb'
import
TopNav
from
'@/components/TopNav'
import
Hamburger
from
'@/components/Hamburger'
import
Hamburger
from
'@/components/Hamburger'
import
Screenfull
from
'@/components/Screenfull'
import
Screenfull
from
'@/components/Screenfull'
import
SizeSelect
from
'@/components/SizeSelect'
import
SizeSelect
from
'@/components/SizeSelect'
...
@@ -58,6 +60,7 @@ import RuoYiDoc from '@/components/RuoYi/Doc'
...
@@ -58,6 +60,7 @@ import RuoYiDoc from '@/components/RuoYi/Doc'
export
default
{
export
default
{
components
:
{
components
:
{
Breadcrumb
,
Breadcrumb
,
TopNav
,
Hamburger
,
Hamburger
,
Screenfull
,
Screenfull
,
SizeSelect
,
SizeSelect
,
...
@@ -81,6 +84,11 @@ export default {
...
@@ -81,6 +84,11 @@ export default {
value
:
val
value
:
val
})
})
}
}
},
topNav
:
{
get
()
{
return
this
.
$store
.
state
.
settings
.
topNav
}
}
}
},
},
methods
:
{
methods
:
{
...
...
ruoyi-ui/src/layout/components/Settings/index.vue
浏览文件 @
9aac65ff
...
@@ -41,6 +41,11 @@
...
@@ -41,6 +41,11 @@
<el-divider/>
<el-divider/>
<h3
class=
"drawer-title"
>
系统布局配置
</h3>
<h3
class=
"drawer-title"
>
系统布局配置
</h3>
<div
class=
"drawer-item"
>
<span>
开启 TopNav
</span>
<el-switch
v-model=
"topNav"
class=
"drawer-switch"
/>
</div>
<div
class=
"drawer-item"
>
<div
class=
"drawer-item"
>
<span>
开启 Tags-Views
</span>
<span>
开启 Tags-Views
</span>
...
@@ -87,6 +92,20 @@ export default {
...
@@ -87,6 +92,20 @@ export default {
})
})
}
}
},
},
topNav
:
{
get
()
{
return
this
.
$store
.
state
.
settings
.
topNav
},
set
(
val
)
{
this
.
$store
.
dispatch
(
'settings/changeSetting'
,
{
key
:
'topNav'
,
value
:
val
})
if
(
!
val
)
{
this
.
$store
.
commit
(
"SET_SIDEBAR_ROUTERS"
,
this
.
$store
.
state
.
permission
.
defaultRoutes
);
}
}
},
tagsView
:
{
tagsView
:
{
get
()
{
get
()
{
return
this
.
$store
.
state
.
settings
.
tagsView
return
this
.
$store
.
state
.
settings
.
tagsView
...
...
ruoyi-ui/src/settings.js
浏览文件 @
9aac65ff
...
@@ -11,6 +11,11 @@ module.exports = {
...
@@ -11,6 +11,11 @@ module.exports = {
*/
*/
showSettings
:
false
,
showSettings
:
false
,
/**
* 是否显示顶部导航
*/
topNav
:
true
,
/**
/**
* 是否显示 tagsView
* 是否显示 tagsView
*/
*/
...
...
ruoyi-ui/src/store/getters.js
浏览文件 @
9aac65ff
...
@@ -11,6 +11,8 @@ const getters = {
...
@@ -11,6 +11,8 @@ const getters = {
roles
:
state
=>
state
.
user
.
roles
,
roles
:
state
=>
state
.
user
.
roles
,
permissions
:
state
=>
state
.
user
.
permissions
,
permissions
:
state
=>
state
.
user
.
permissions
,
permission_routes
:
state
=>
state
.
permission
.
routes
,
permission_routes
:
state
=>
state
.
permission
.
routes
,
topbarRouters
:
state
=>
state
.
permission
.
topbarRouters
,
defaultRoutes
:
state
=>
state
.
permission
.
defaultRoutes
,
sidebarRouters
:
state
=>
state
.
permission
.
sidebarRouters
,
sidebarRouters
:
state
=>
state
.
permission
.
sidebarRouters
,
}
}
export
default
getters
export
default
getters
ruoyi-ui/src/store/modules/permission.js
浏览文件 @
9aac65ff
...
@@ -7,6 +7,8 @@ const permission = {
...
@@ -7,6 +7,8 @@ const permission = {
state
:
{
state
:
{
routes
:
[],
routes
:
[],
addRoutes
:
[],
addRoutes
:
[],
defaultRoutes
:
[],
topbarRouters
:
[],
sidebarRouters
:
[]
sidebarRouters
:
[]
},
},
mutations
:
{
mutations
:
{
...
@@ -14,8 +16,19 @@ const permission = {
...
@@ -14,8 +16,19 @@ const permission = {
state
.
addRoutes
=
routes
state
.
addRoutes
=
routes
state
.
routes
=
constantRoutes
.
concat
(
routes
)
state
.
routes
=
constantRoutes
.
concat
(
routes
)
},
},
SET_SIDEBAR_ROUTERS
:
(
state
,
routers
)
=>
{
SET_DEFAULT_ROUTES
:
(
state
,
routes
)
=>
{
state
.
sidebarRouters
=
constantRoutes
.
concat
(
routers
)
state
.
defaultRoutes
=
constantRoutes
.
concat
(
routes
)
},
SET_TOPBAR_ROUTES
:
(
state
,
routes
)
=>
{
// 顶部导航菜单默认添加统计报表栏指向首页
const
index
=
[{
path
:
'index'
,
meta
:
{
title
:
'统计报表'
,
icon
:
'dashboard'
}
}]
state
.
topbarRouters
=
routes
.
concat
(
index
);
},
SET_SIDEBAR_ROUTERS
:
(
state
,
routes
)
=>
{
state
.
sidebarRouters
=
routes
},
},
},
},
actions
:
{
actions
:
{
...
@@ -30,7 +43,9 @@ const permission = {
...
@@ -30,7 +43,9 @@ const permission = {
const
rewriteRoutes
=
filterAsyncRouter
(
rdata
,
false
,
true
)
const
rewriteRoutes
=
filterAsyncRouter
(
rdata
,
false
,
true
)
rewriteRoutes
.
push
({
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
})
rewriteRoutes
.
push
({
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
})
commit
(
'SET_ROUTES'
,
rewriteRoutes
)
commit
(
'SET_ROUTES'
,
rewriteRoutes
)
commit
(
'SET_SIDEBAR_ROUTERS'
,
sidebarRoutes
)
commit
(
'SET_SIDEBAR_ROUTERS'
,
constantRoutes
.
concat
(
sidebarRoutes
))
commit
(
'SET_DEFAULT_ROUTES'
,
sidebarRoutes
)
commit
(
'SET_TOPBAR_ROUTES'
,
sidebarRoutes
)
resolve
(
rewriteRoutes
)
resolve
(
rewriteRoutes
)
})
})
})
})
...
...
ruoyi-ui/src/store/modules/settings.js
浏览文件 @
9aac65ff
import
variables
from
'@/assets/styles/element-variables.scss'
import
variables
from
'@/assets/styles/element-variables.scss'
import
defaultSettings
from
'@/settings'
import
defaultSettings
from
'@/settings'
const
{
sideTheme
,
showSettings
,
tagsView
,
fixedHeader
,
sidebarLogo
}
=
defaultSettings
const
{
sideTheme
,
showSettings
,
t
opNav
,
t
agsView
,
fixedHeader
,
sidebarLogo
}
=
defaultSettings
const
state
=
{
const
state
=
{
theme
:
variables
.
theme
,
theme
:
variables
.
theme
,
sideTheme
:
sideTheme
,
sideTheme
:
sideTheme
,
showSettings
:
showSettings
,
showSettings
:
showSettings
,
topNav
:
topNav
,
tagsView
:
tagsView
,
tagsView
:
tagsView
,
fixedHeader
:
fixedHeader
,
fixedHeader
:
fixedHeader
,
sidebarLogo
:
sidebarLogo
sidebarLogo
:
sidebarLogo
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论