From 5b1efcf1649d83cee8ec4988d0efd835dfbeaf3b Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Sat, 30 Jun 2018 18:12:02 +0800 Subject: [PATCH] no message Former-commit-id: d97c13ae6a0218e0d6b43b698f6ba065ffa9fabe [formerly d97c13ae6a0218e0d6b43b698f6ba065ffa9fabe [formerly d97c13ae6a0218e0d6b43b698f6ba065ffa9fabe [formerly d97c13ae6a0218e0d6b43b698f6ba065ffa9fabe [formerly 8af3b8cf799f5599a7c708a9c03848e07660f713 [formerly 48d537ed7323a9d26fc3baff4a74e6765385a089]]]]] Former-commit-id: 8320e4f21313b27cbe1f15589803ab26dd26a065 Former-commit-id: af143dcf993e384f77dc8ab10f881680b3b9252f Former-commit-id: 4b0bcca697ca8df9084f1cdf1950ff0fc91863ec [formerly 3bb910f2c309c5837f9671fd12663f520d945e41] Former-commit-id: fac37af6297d5c17188ffe1f60cb3dffa9327de8 Former-commit-id: 8a3939bd303dac222a561c46cb8fbbae94b2ad91 Former-commit-id: ef1c1db97b0713386c94fb5a1ecfaf6c570d1235 Former-commit-id: 534253616edbd0471b7966d2e678388a528398ce Former-commit-id: 5c549c5924fbd8d7813802089209023404f116a1 --- src/components/core/d2-layout-main/index.vue | 4 +-- src/libs/db.js | 3 +- src/libs/util.js | 2 +- src/main.js | 1 + src/store/modules/d2admin.js | 33 +++++++------------- 5 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/components/core/d2-layout-main/index.vue b/src/components/core/d2-layout-main/index.vue index 6be0e832..cb29e836 100644 --- a/src/components/core/d2-layout-main/index.vue +++ b/src/components/core/d2-layout-main/index.vue @@ -34,7 +34,7 @@
- + @@ -71,7 +71,7 @@ export default { ...mapState({ themeActive: state => state.d2admin.themeActive, isGrayMode: state => state.d2admin.isGrayMode, - pageCacheList: state => state.d2admin.pageCacheList + pageUseCacheList: state => state.d2admin.pageUseCacheList }), styleLayoutMainGroup () { return { diff --git a/src/libs/db.js b/src/libs/db.js index 604d87eb..869ddd50 100644 --- a/src/libs/db.js +++ b/src/libs/db.js @@ -6,8 +6,7 @@ const db = low(adapter) db.defaults({ themeActive: [], - pageOpenedList: [], - pageCacheList: [] + pageOpenedList: [] }) .write() diff --git a/src/libs/util.js b/src/libs/util.js index 10039d3c..343338e7 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -68,7 +68,7 @@ util.openNewPage = function (vm, name, argu, query) { vm.$store.commit('d2adminTagIncreate', { tag, argu, query }) } } - vm.$store.commit('d2adminPageSetCurrentName', name) + vm.$store.commit('d2adminPageCurrentSet', name) } /** diff --git a/src/main.js b/src/main.js index 8d142afa..43189fb9 100755 --- a/src/main.js +++ b/src/main.js @@ -104,6 +104,7 @@ new Vue({ } push(frameInRoutes) this.$store.commit('d2admintagPoolSet', tagPool) + // d2adminPageUseCacheList } } }) diff --git a/src/store/modules/d2admin.js b/src/store/modules/d2admin.js index bdd91245..ea1d6d4d 100644 --- a/src/store/modules/d2admin.js +++ b/src/store/modules/d2admin.js @@ -19,20 +19,24 @@ export default { ], // 当前页面 pageCurrent: '', - // 使用缓存的页面 (需要在页面中写 name) - pageCacheList: [], - // 不使用缓存的页面 - pageDisableCacheList: [ - 'no-cache' - ] + // 使用缓存的页面 + pageUseCacheList: [] }, mutations: { + /** + * 设置使用缓存的页面 + * @param {state} state vuex state + * @param {array} name pageUseCacheList + */ + d2adminPageUseCacheList (state, list) { + state.pageUseCacheList = list + }, /** * 设置当前激活的页面 name * @param {state} state vuex state * @param {string} name new name */ - d2adminPageSetCurrentName (state, name) { + d2adminPageCurrentSet (state, name) { state.pageCurrent = name }, /** @@ -75,21 +79,6 @@ export default { let newTag = tag newTag.argu = argu || newTag.argu newTag.query = query || newTag.query - // 检查这个页面是不是属于不使用缓存的页面 - if (!util.isOneOf(newTag.name, state.pageDisableCacheList)) { - // 在缓存页面的列表加入这个页面的 name - state.pageCacheList.push(newTag.name) - // 更新设置到数据库 - const setting = db.get('pageCacheList').find({uuid: util.uuid()}) - if (setting.value()) { - setting.assign({value: state.pageCacheList}).write() - } else { - db.get('pageCacheList').push({ - uuid: util.uuid(), - value: state.pageCacheList - }).write() - } - } // 添加进当前显示的页面数组 state.pageOpenedList.push(newTag) // 更新设置到数据库