From 045c3142fda3377632bbd512d27fd82d1493cf3d Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Tue, 24 Jul 2018 23:36:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E7=94=A8=E6=95=B0=E6=8D=AE=E5=AD=98?= =?UTF-8?q?=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 1e171a8b29b540b586d28a2e6ff605878c17ef29 [formerly 1e171a8b29b540b586d28a2e6ff605878c17ef29 [formerly 1e171a8b29b540b586d28a2e6ff605878c17ef29 [formerly 1e171a8b29b540b586d28a2e6ff605878c17ef29 [formerly 3663194764875940e0342d24188b03ef360d9ed1 [formerly f672359c16416eea0a517bf8b5597508c8ee82dd]]]]] Former-commit-id: 8ca1db31ab1730fa4ab55777a92fed9021074bae Former-commit-id: e98c933667c600b2090111fcb2dc40265b9465ea Former-commit-id: a6f88887401104a6f9f781622f5384af269e1c88 [formerly 914065cdee57a595ca938f6fc263cc67ce403c30] Former-commit-id: 611088d289ae5649c8ffd5309d59f1de1d8174ca Former-commit-id: 72049e5b5b5207b93c770fad6df9327584cfa0d6 Former-commit-id: ef3d1d5ac840fcf1ea06a117d98c9309e6db36bb Former-commit-id: fa5b7a0121413f864a3a8a510844232e9bc33aeb Former-commit-id: ba5aaa5445fbbb317354de2374bdfdb2778e7109 --- src/libs/db.js | 3 +- src/menu/modules/demo-playground.js | 3 +- src/pages/demo/playground/db/public/index.vue | 121 ++++++++++++++++++ src/pages/demo/playground/db/user/index.vue | 29 ++--- src/router/routes.js.REMOVED.git-id | 2 +- src/store/modules/d2admin.js.REMOVED.git-id | 2 +- 6 files changed, 135 insertions(+), 25 deletions(-) create mode 100644 src/pages/demo/playground/db/public/index.vue diff --git a/src/libs/db.js b/src/libs/db.js index bbe70a39..fb1c92e0 100644 --- a/src/libs/db.js +++ b/src/libs/db.js @@ -11,7 +11,8 @@ db.defaults({ pageOpenedList: [], userInfo: [], isMenuAsideCollapse: [], - database: [] + database: [], + databasePublic: {} }).write() export default db diff --git a/src/menu/modules/demo-playground.js b/src/menu/modules/demo-playground.js index f97b5378..dc10e1ef 100644 --- a/src/menu/modules/demo-playground.js +++ b/src/menu/modules/demo-playground.js @@ -41,7 +41,8 @@ export default { icon: 'database', children: [ { path: `${pre}db/all`, title: '全部数据' }, - { path: `${pre}db/user`, title: '用户数据' } + { path: `${pre}db/user`, title: '用户数据' }, + { path: `${pre}db/public`, title: '公用数据' } ] }, { path: `${pre}env`, title: '环境信息', icon: 'exclamation-circle' } diff --git a/src/pages/demo/playground/db/public/index.vue b/src/pages/demo/playground/db/public/index.vue new file mode 100644 index 00000000..fcceac0e --- /dev/null +++ b/src/pages/demo/playground/db/public/index.vue @@ -0,0 +1,121 @@ + + + diff --git a/src/pages/demo/playground/db/user/index.vue b/src/pages/demo/playground/db/user/index.vue index c800e12e..d61c534c 100644 --- a/src/pages/demo/playground/db/user/index.vue +++ b/src/pages/demo/playground/db/user/index.vue @@ -1,18 +1,14 @@ @@ -63,14 +55,14 @@ export default { }, methods: { ...mapMutations([ - 'd2adminUtilUserDatabase', - 'd2adminUtilUserDatabaseClear' + 'd2adminUtilDatabaseUser', + 'd2adminUtilDatabaseUserClear' ]), /** * 加载本地数据 */ load () { - this.d2adminUtilUserDatabase(database => { + this.d2adminUtilDatabaseUser(database => { this.dataDisplay = JSON.stringify(database.value(), null, 2) this.keyNameList = Object.keys(database.value()).map(k => ({ value: k, @@ -82,7 +74,7 @@ export default { * 删除一个字段 */ handleDelete (name) { - this.d2adminUtilUserDatabase(database => { + this.d2adminUtilDatabaseUser(database => { database .unset(name) .write() @@ -94,12 +86,7 @@ export default { * 清空当前用户的数据 */ handleClear () { - // this.d2adminUtilUserDatabase(database => { - // this.keyNameList.forEach(name => { - // database.unset(name.value).write() - // }) - // }) - this.d2adminUtilUserDatabaseClear() + this.d2adminUtilDatabaseUserClear() this.load() }, /** @@ -110,7 +97,7 @@ export default { this.$message.error('字段名不能为空') return } - this.d2adminUtilUserDatabase(database => { + this.d2adminUtilDatabaseUser(database => { database .set(this.keyNameToSet, this.valueToSet) .write() @@ -121,7 +108,7 @@ export default { * 添加一个随机数据 */ handleSetRandom () { - this.d2adminUtilUserDatabase(database => { + this.d2adminUtilDatabaseUser(database => { const id = day().valueOf() database .set(id, Math.round(id * Math.random())) diff --git a/src/router/routes.js.REMOVED.git-id b/src/router/routes.js.REMOVED.git-id index c9009bcc..fd63df07 100644 --- a/src/router/routes.js.REMOVED.git-id +++ b/src/router/routes.js.REMOVED.git-id @@ -1 +1 @@ -7e12129bbfdbb28bd532c5d4ad03773dd00abad8 \ No newline at end of file +66aff6c09897ee543f6688caff91a0f9b44cb869 \ No newline at end of file diff --git a/src/store/modules/d2admin.js.REMOVED.git-id b/src/store/modules/d2admin.js.REMOVED.git-id index da15139e..bc1d53dd 100644 --- a/src/store/modules/d2admin.js.REMOVED.git-id +++ b/src/store/modules/d2admin.js.REMOVED.git-id @@ -1 +1 @@ -92fc1b2eb9ce2c2ed9bb43f18e05af3231b270dd \ No newline at end of file +78b98e947581eb460627c3091528a74b033a25c9 \ No newline at end of file