diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml
index 423e75f9..1f098e40 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-druid.yml
@@ -43,7 +43,7 @@ spring:
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
- login-username: admin
+ login-username: ruoyi
login-password: 123456
filter:
stat:
diff --git a/ruoyi-ui/src/components/TopNav/index.vue b/ruoyi-ui/src/components/TopNav/index.vue
index fb15c59e..23976283 100644
--- a/ruoyi-ui/src/components/TopNav/index.vue
+++ b/ruoyi-ui/src/components/TopNav/index.vue
@@ -30,6 +30,9 @@
diff --git a/ruoyi-ui/src/layout/components/Settings/index.vue b/ruoyi-ui/src/layout/components/Settings/index.vue
index 7e36d48d..eba81398 100644
--- a/ruoyi-ui/src/layout/components/Settings/index.vue
+++ b/ruoyi-ui/src/layout/components/Settings/index.vue
@@ -62,6 +62,10 @@
+
+
+ 保存配置
+ 重置配置
@@ -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)
}
}
}
diff --git a/ruoyi-ui/src/settings.js b/ruoyi-ui/src/settings.js
index d7e774b6..0e74c710 100644
--- a/ruoyi-ui/src/settings.js
+++ b/ruoyi-ui/src/settings.js
@@ -14,7 +14,7 @@ module.exports = {
/**
* 是否显示顶部导航
*/
- topNav: true,
+ topNav: false,
/**
* 是否显示 tagsView
diff --git a/ruoyi-ui/src/store/modules/settings.js b/ruoyi-ui/src/store/modules/settings.js
index f113e9a8..7192f1c0 100644
--- a/ruoyi-ui/src/store/modules/settings.js
+++ b/ruoyi-ui/src/store/modules/settings.js
@@ -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: storageSetting.sideTheme || sideTheme,
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: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo
}
-
const mutations = {
CHANGE_SETTING: (state, { key, value }) => {
if (state.hasOwnProperty(key)) {