diff --git a/vue/src/asset/style/index.scss b/vue/src/asset/style/index.scss index d2fc467..d5b599d 100644 --- a/vue/src/asset/style/index.scss +++ b/vue/src/asset/style/index.scss @@ -81,7 +81,7 @@ a:hover { height: calc(100vh - #{$page-view-margin * 2}); } -.has-header { +.has-nav { .max-view-height { height: calc(100vh - #{$nav-height} - #{$page-view-margin * 2}); } diff --git a/vue/src/layout/component/Header.vue b/vue/src/layout/component/Header.vue index b5f1ebb..b765e1f 100644 --- a/vue/src/layout/component/Header.vue +++ b/vue/src/layout/component/Header.vue @@ -34,7 +34,7 @@ export default { }, hideHeader(v) { - this.$store.commit('app/hasHeader', !v) + this.$store.commit('app/hasNav', !v) v ? this.addEvent() : this.removeEvent() } }, diff --git a/vue/src/layout/index.vue b/vue/src/layout/index.vue index 1b2892d..298df46 100644 --- a/vue/src/layout/index.vue +++ b/vue/src/layout/index.vue @@ -30,7 +30,7 @@ export default { components: {VMain, VSidebar, VHeader}, computed: { - ...mapState('app', ['device', 'hasHeader']), + ...mapState('app', ['device', 'hasNav']), ...mapState('setting', ['useTagsView', 'sidebarCollapse']), @@ -38,7 +38,7 @@ export default { return { 'el-container': true, 'main-container': true, - 'has-header': this.hasHeader, + 'has-nav': this.hasNav, 'has-tags-view': this.useTagsView } }, diff --git a/vue/src/router/index.js b/vue/src/router/index.js index 02a223f..bf2958b 100644 --- a/vue/src/router/index.js +++ b/vue/src/router/index.js @@ -131,12 +131,12 @@ function iframeControl(to, from) { if (from.meta.noCache || to.path === `/redirect${from.path}`) { del = true } - store.dispatch(`iframe/close`, {src: from.meta.iframe, del}) + store.dispatch('iframe/close', {src: from.meta.iframe, del}) } //跳转至iframe页面时,打开iframe if (to.meta.iframe) { - store.dispatch(`iframe/open`, {src: to.meta.iframe}) + store.dispatch('iframe/open', {src: to.meta.iframe}) } } diff --git a/vue/src/store/module/app.js b/vue/src/store/module/app.js index 70bbe0c..cc52246 100644 --- a/vue/src/store/module/app.js +++ b/vue/src/store/module/app.js @@ -11,8 +11,8 @@ const state = { //登陆页背景动画 loginBackgroundAnimation: 'sparkRain', - //右侧块是否含有头部,这里初始值是为了转为boolean类型 - hasHeader: !!!localSettings.headerAutoHidden + //右侧块是否含有导航栏,这里初始值是为了转为boolean类型 + hasNav: !!!localSettings.headerAutoHidden } const mutations = createMutations(state) diff --git a/vue/src/store/module/setting.js b/vue/src/store/module/setting.js index 4f51e26..33dcfc2 100644 --- a/vue/src/store/module/setting.js +++ b/vue/src/store/module/setting.js @@ -5,8 +5,6 @@ import {isEmpty} from "@/util" import {getLocalPersonalSettings, setLocalPersonalSettings} from "@/util/storage" -const localSettings = getLocalPersonalSettings() - const state = { //是否显示logo showLogo: true, @@ -37,6 +35,7 @@ const state = { } //state填入初始值 +const localSettings = getLocalPersonalSettings() Object.keys(state).forEach(key => { if (!isEmpty(localSettings[key])) state[key] = localSettings[key] }) @@ -61,6 +60,13 @@ const mutations = { } } +export default { + namespaced: true, + state, + mutations +} + +//每次修改个人设置时,同步到localStorage function createMutations(state) { return Object.keys(state).reduce((mutations, key) => { mutations[key] = (ref, data) => { @@ -70,9 +76,3 @@ function createMutations(state) { return mutations }, {}) } - -export default { - namespaced: true, - state, - mutations -}