Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-manage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
finance-oa
finance-manage
Commits
c8df1f5e
Commit
c8df1f5e
authored
Apr 13, 2021
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
布局设置支持保存&重置配置
parent
e71c00e6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
18 deletions
+65
-18
ruoyi-admin/src/main/resources/application-druid.yml
ruoyi-admin/src/main/resources/application-druid.yml
+1
-1
ruoyi-ui/src/components/TopNav/index.vue
ruoyi-ui/src/components/TopNav/index.vue
+18
-6
ruoyi-ui/src/layout/components/Settings/index.vue
ruoyi-ui/src/layout/components/Settings/index.vue
+39
-4
ruoyi-ui/src/settings.js
ruoyi-ui/src/settings.js
+1
-1
ruoyi-ui/src/store/modules/settings.js
ruoyi-ui/src/store/modules/settings.js
+6
-6
No files found.
ruoyi-admin/src/main/resources/application-druid.yml
View file @
c8df1f5e
...
...
@@ -43,7 +43,7 @@ spring:
allow
:
url-pattern
:
/druid/*
# 控制台管理用户名和密码
login-username
:
admin
login-username
:
ruoyi
login-password
:
123456
filter
:
stat
:
...
...
ruoyi-ui/src/components/TopNav/index.vue
View file @
c8df1f5e
...
...
@@ -30,6 +30,9 @@
<
script
>
import
{
constantRoutes
}
from
"
@/router
"
;
// 不需要激活的路由
const
noactiveList
=
[
"
/user/profile
"
,
"
/dict/type
"
,
"
/gen/edit
"
,
"
/job/log
"
];
export
default
{
data
()
{
return
{
...
...
@@ -42,10 +45,13 @@ export default {
computed
:
{
// 顶部显示菜单
topMenus
()
{
return
this
.
routers
.
map
((
menu
)
=>
({
...
menu
,
children
:
undefined
,
}));
let
topMenus
=
[];
this
.
routers
.
map
((
menu
)
=>
{
if
(
menu
.
hidden
===
false
)
{
topMenus
.
push
(
menu
);
}
});
return
topMenus
;
},
// 所有的路由信息
routers
()
{
...
...
@@ -69,6 +75,12 @@ export default {
activeMenu
()
{
const
path
=
this
.
$route
.
path
;
let
activePath
=
this
.
routers
[
0
].
path
;
var
noactive
=
noactiveList
.
some
(
function
(
item
)
{
return
path
.
indexOf
(
item
)
!==
-
1
;
});
if
(
noactive
)
{
return
;
}
if
(
path
.
lastIndexOf
(
"
/
"
)
>
0
)
{
const
tmpPath
=
path
.
substring
(
1
,
path
.
length
);
activePath
=
"
/
"
+
tmpPath
.
substring
(
0
,
tmpPath
.
indexOf
(
"
/
"
));
...
...
@@ -89,7 +101,7 @@ export default {
methods
:
{
// 根据宽度计算设置显示栏数
setVisibleNumber
()
{
const
width
=
document
.
body
.
getBoundingClientRect
().
width
-
20
0
;
const
width
=
document
.
body
.
getBoundingClientRect
().
width
-
38
0
;
const
elWidth
=
this
.
$el
.
getBoundingClientRect
().
width
;
const
menuItemNodes
=
this
.
$el
.
children
;
const
menuWidth
=
Array
.
from
(
menuItemNodes
).
map
(
...
...
@@ -119,7 +131,7 @@ export default {
});
}
this
.
$store
.
commit
(
"
SET_SIDEBAR_ROUTERS
"
,
routes
);
}
,
}
},
};
</
script
>
...
...
ruoyi-ui/src/layout/components/Settings/index.vue
View file @
c8df1f5e
...
...
@@ -62,6 +62,10 @@
<el-switch
v-model=
"sidebarLogo"
class=
"drawer-switch"
/>
</div>
<el-divider/>
<el-button
size=
"small"
type=
"primary"
plain
icon=
"el-icon-document-add"
@
click=
"saveSetting"
>
保存配置
</el-button>
<el-button
size=
"small"
plain
icon=
"el-icon-refresh"
@
click=
"resetSetting"
>
重置配置
</el-button>
</div>
</div>
</
template
>
...
...
@@ -72,15 +76,14 @@ import ThemePicker from '@/components/ThemePicker'
export
default
{
components
:
{
ThemePicker
},
data
()
{
return
{}
return
{
sideTheme
:
this
.
$store
.
state
.
settings
.
sideTheme
};
},
computed
:
{
theme
()
{
return
this
.
$store
.
state
.
settings
.
theme
},
sideTheme
()
{
return
this
.
$store
.
state
.
settings
.
sideTheme
},
fixedHeader
:
{
get
()
{
return
this
.
$store
.
state
.
settings
.
fixedHeader
...
...
@@ -141,6 +144,38 @@ export default {
key
:
'
sideTheme
'
,
value
:
val
})
this
.
sideTheme
=
val
;
},
saveSetting
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
fullscreen
:
false
,
text
:
"
正在保存到本地,请稍后...
"
,
spinner
:
"
el-icon-loading
"
,
background
:
"
rgba(0, 0, 0, 0.7)
"
});
localStorage
.
setItem
(
"
layout-setting
"
,
`{
"topNav":
${
this
.
topNav
}
,
"tagsView":
${
this
.
tagsView
}
,
"fixedHeader":
${
this
.
fixedHeader
}
,
"sidebarLogo":
${
this
.
sidebarLogo
}
,
"sideTheme":"
${
this
.
sideTheme
}
"
}`
);
setTimeout
(
loading
.
close
(),
1000
)
},
resetSetting
()
{
this
.
$loading
({
lock
:
true
,
fullscreen
:
false
,
text
:
"
正在清除设置缓存并刷新,请稍后...
"
,
spinner
:
"
el-icon-loading
"
,
background
:
"
rgba(0, 0, 0, 0.7)
"
});
localStorage
.
removeItem
(
"
layout-setting
"
)
setTimeout
(
"
window.location.reload()
"
,
1000
)
}
}
}
...
...
ruoyi-ui/src/settings.js
View file @
c8df1f5e
...
...
@@ -14,7 +14,7 @@ module.exports = {
/**
* 是否显示顶部导航
*/
topNav
:
tru
e
,
topNav
:
fals
e
,
/**
* 是否显示 tagsView
...
...
ruoyi-ui/src/store/modules/settings.js
View file @
c8df1f5e
...
...
@@ -3,16 +3,16 @@ import defaultSettings from '@/settings'
const
{
sideTheme
,
showSettings
,
topNav
,
tagsView
,
fixedHeader
,
sidebarLogo
}
=
defaultSettings
const
storageSetting
=
JSON
.
parse
(
localStorage
.
getItem
(
'
layout-setting
'
))
||
''
const
state
=
{
theme
:
variables
.
theme
,
sideTheme
:
sideTheme
,
sideTheme
:
s
torageSetting
.
sideTheme
||
s
ideTheme
,
showSettings
:
showSettings
,
topNav
:
topNav
,
tagsView
:
tagsView
,
fixedHeader
:
fixedHeader
,
sidebarLogo
:
sidebarLogo
topNav
:
storageSetting
.
topNav
===
undefined
?
topNav
:
storageSetting
.
topNav
,
tagsView
:
storageSetting
.
tagsView
===
undefined
?
tagsView
:
storageSetting
.
tagsView
,
fixedHeader
:
storageSetting
.
fixedHeader
===
undefined
?
fixedHeader
:
storageSetting
.
fixedHeader
,
sidebarLogo
:
s
torageSetting
.
sidebarLogo
===
undefined
?
sidebarLogo
:
storageSetting
.
s
idebarLogo
}
const
mutations
=
{
CHANGE_SETTING
:
(
state
,
{
key
,
value
})
=>
{
if
(
state
.
hasOwnProperty
(
key
))
{
...
...
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