diff --git a/vue/full/package-lock.json b/vue/full/package-lock.json index 149071b..563e610 100644 --- a/vue/full/package-lock.json +++ b/vue/full/package-lock.json @@ -4535,9 +4535,9 @@ "dev": true }, "el-admin-layout": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/el-admin-layout/-/el-admin-layout-0.0.2.tgz", - "integrity": "sha512-F+5n9HzlbGyD3EbQi4Uk7RdMlZbSLmPAsw5aoK5pYmEtLJktZCOC70bGMNRESc38bGpADa7Cv1+8bwCruG1/uw==" + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/el-admin-layout/-/el-admin-layout-0.3.0.tgz", + "integrity": "sha512-mqETeYK9XxTTI7VHD5NIIjORRxzsdE4HPfae8PmaTZVhJH+BlzmFf8OpOmXvei4Z3C35/2BiYCxmbMw9XeiGjQ==" }, "electron-to-chromium": { "version": "1.3.633", @@ -7685,9 +7685,9 @@ "dev": true }, "pako": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.0.2.tgz", - "integrity": "sha512-9e8DRI3+dRLomCmMBAH30B2ejh+blwXr7VmMEx/pVFZlSDA7oyI8uKMhKXr8IrZpoxBF2YlxUvhqRXzTT1i0NA==" + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" }, "param-case": { "version": "3.0.4", diff --git a/vue/full/package.json b/vue/full/package.json index da1fa4c..233ef7c 100644 --- a/vue/full/package.json +++ b/vue/full/package.json @@ -10,12 +10,12 @@ "dependencies": { "axios": "^0.21.1", "decimal.js": "^10.2.1", - "el-admin-layout": "0.0.2", + "el-admin-layout": "^0.3.0", "element-ui": "^2.14.1", "file-saver": "^2.0.5", "js-md5": "^0.7.3", "nprogress": "^0.2.0", - "pako": "^2.0.2", + "pako": "^1.0.11", "socket.io-client": "2.3.1", "vue": "^2.6.12", "vue-count-to": "^1.0.13", diff --git a/vue/full/src/layout/component/SettingDrawer/index.vue b/vue/full/src/layout/component/SettingDrawer/index.vue index 28ee53e..4d28abb 100644 --- a/vue/full/src/layout/component/SettingDrawer/index.vue +++ b/vue/full/src/layout/component/SettingDrawer/index.vue @@ -1,6 +1,6 @@ 导航模式 - + - 页面设置 + 导航栏设置 - 分层结构 + 主题风格 - - + + - - 显示logo - - - - 显示页头 - - - - 显示返回顶部按钮 - - 侧边栏设置 主题风格 @@ -62,10 +48,9 @@ 汉堡包位置 @@ -73,83 +58,98 @@ 手风琴效果 - + 折叠 - + 折叠时显示上级 - + 自动隐藏 - + 显示搜索框 - + - 导航栏设置 + 页面设置 - 主题风格 + 分层结构 - - + + + + 显示logo + + + + 显示页头 + + + + 显示页脚 + + + + 显示返回顶部按钮 + + 多页签设置 启用 - + + + + 启用缓存 + 启用快捷键切换 - + 持久化 - + diff --git a/vue/full/src/layout/mixin/tagsViewPersistent.js b/vue/full/src/layout/component/SettingDrawer/mixin/tagsViewPersistent.js similarity index 63% rename from vue/full/src/layout/mixin/tagsViewPersistent.js rename to vue/full/src/layout/component/SettingDrawer/mixin/tagsViewPersistent.js index 492f108..90fcb4f 100644 --- a/vue/full/src/layout/mixin/tagsViewPersistent.js +++ b/vue/full/src/layout/component/SettingDrawer/mixin/tagsViewPersistent.js @@ -10,11 +10,11 @@ import {getTagsView, setTagsView} from "@/util/storage" export default { computed: { - shouldPersistent: () => tagsViewGetters.persistent + visitedViews: () => tagsViewGetters.visitedViews }, watch: { - shouldPersistent: { + 'setting.tagsView.persistent': { immediate: true, handler(v) { //尝试清除之前的watch @@ -27,7 +27,7 @@ export default { if (!v) return setTagsView() //启用时先存储一次(仅在mounted后,否则此时页签数据不完整) - this._isMounted && this.persistentTagsView(tagsViewGetters.visitedViews) + this._isMounted && this.persistentTagsView(this.visitedViews) this.watchVisitedViewsCallback = this.$watch('visitedViews', this.persistentTagsView) } @@ -35,13 +35,18 @@ export default { }, beforeCreate() { - this.persistentTagsView = debounce(setTagsView) + this.persistentTagsView = debounce(views => { + setTagsView(views.map(v => ({fullPath: v.fullPath, meta: v.meta}))) + }) }, mounted() { - if (!this.shouldPersistent) return + if (!this.setting.tagsView.persistent) return const tags = getTagsView() - Array.isArray(tags) && tags.forEach(tagsViewMutations.addTagOnly) + Array.isArray(tags) && tags.forEach(({fullPath, meta}) => { + const {route} = this.getRoot().$router.resolve(fullPath) + route && tagsViewMutations.addTagOnly({...route, meta: {...route.meta, ...meta}}) + }) } } diff --git a/vue/full/src/layout/mixin/tagsViewShortcut.js b/vue/full/src/layout/component/SettingDrawer/mixin/tagsViewShortcut.js similarity index 55% rename from vue/full/src/layout/mixin/tagsViewShortcut.js rename to vue/full/src/layout/component/SettingDrawer/mixin/tagsViewShortcut.js index 358d414..66b3f8a 100644 --- a/vue/full/src/layout/mixin/tagsViewShortcut.js +++ b/vue/full/src/layout/component/SettingDrawer/mixin/tagsViewShortcut.js @@ -7,14 +7,8 @@ import {tagsViewGetters} from "el-admin-layout" export default { - computed: { - shouldBindKeydownEvent() { - return tagsViewGetters.shortcut - } - }, - watch: { - shouldBindKeydownEvent: { + 'setting.tagsView.shortcut': { immediate: true, handler(v) { //尝试移除之前可能添加的事件 @@ -26,38 +20,26 @@ export default { }, methods: { - //上一个页签 - gotoViewFront() { - const views = tagsViewGetters.visitedViews - - if (views.length <= 1) return - - let index = views.findIndex(view => view.path === this.$route.path) - - if (index < 0) return - - if (index === 0) { - index = views.length - } - - return this.$router.push({path: views[index - 1].path}) - }, + gotoViewByDirection(direction) { + const root = this.getRoot() + if (!root) return - //下一个页签 - gotoViewBehind() { const views = tagsViewGetters.visitedViews - if (views.length <= 1) return - let index = views.findIndex(view => view.path === this.$route.path) - + let index = views.findIndex(view => view.path === root.$route.path) if (index < 0) return - if (index + 1 > views.length - 1) { - index = -1 + //上一个页签 + if (direction === 'front') { + index = index === 0 ? views.length - 1 : index - 1 + } + //下一个页签 + else if (direction === 'behind') { + index = index > views.length - 2 ? 0 : index + 1 } - return this.$router.push({path: views[index + 1].path}) + return root.$router.push({path: views[index].path}) }, //快捷键监听 @@ -67,11 +49,11 @@ export default { //ctrl + → case 'ArrowRight': e.preventDefault() - return this.gotoViewBehind() + return this.gotoViewByDirection('behind') //ctrl + ← case 'ArrowLeft': e.preventDefault() - return this.gotoViewFront() + return this.gotoViewByDirection('front') } } } diff --git a/vue/full/src/layout/index.vue b/vue/full/src/layout/index.vue index fdd3d5c..7b6bf13 100644 --- a/vue/full/src/layout/index.vue +++ b/vue/full/src/layout/index.vue @@ -5,13 +5,11 @@ diff --git a/vue/full/src/view/admin/system/category/component/List.vue b/vue/full/src/view/admin/system/category/component/List.vue index 59a6e07..a664720 100644 --- a/vue/full/src/view/admin/system/category/component/List.vue +++ b/vue/full/src/view/admin/system/category/component/List.vue @@ -14,7 +14,7 @@