From 5cd91cc35dc09a875e28413a29bf6d149bfb13a3 Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Tue, 7 Aug 2018 23:50:45 +0800 Subject: [PATCH 01/31] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=20=E4=B8=BA=E5=90=8E=E7=BB=AD=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=8C=96=E5=81=9A=E5=87=86=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 7ac8ff67cfc714c7c5f3c1835c6a3585d2898cf5 [formerly 7ac8ff67cfc714c7c5f3c1835c6a3585d2898cf5 [formerly 7ac8ff67cfc714c7c5f3c1835c6a3585d2898cf5 [formerly 7ac8ff67cfc714c7c5f3c1835c6a3585d2898cf5 [formerly 585db786441b989eff439912ab47bf5f3c41a749 [formerly 1aa58fed969861d42b797dd3e06929132a3da912]]]]] Former-commit-id: e277625851c94916eb9572636fb902666a88f808 Former-commit-id: ac4b8e1028d4647af2d3620bac6fc6caf1d01472 Former-commit-id: ddef88f77f257902e153d63300e5cc164ee741e6 [formerly e3c281ff3e3c4bfb39f93a8c778616e2408f53b1] Former-commit-id: 53dcc046428da982a0a85367e0327c8a9d846619 Former-commit-id: db2d3dd5aa11586c35a7574c975005cf17e8cd35 Former-commit-id: 54ca2b1d019e0126cfffa847c751597f3137a3cd Former-commit-id: 695755b41f0b2b7fe1961e20936da22e6a10b424 Former-commit-id: 459c83348032db43ef835634400897db180ac35c --- src/store/modules/d2admin.js.REMOVED.git-id | 1 - src/store/modules/d2admin/index.js.REMOVED.git-id | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 src/store/modules/d2admin.js.REMOVED.git-id create mode 100644 src/store/modules/d2admin/index.js.REMOVED.git-id diff --git a/src/store/modules/d2admin.js.REMOVED.git-id b/src/store/modules/d2admin.js.REMOVED.git-id deleted file mode 100644 index b4b3064d..00000000 --- a/src/store/modules/d2admin.js.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -efda2b963ee9b9d9fe1b30d4fdfeac80d127bb31 \ No newline at end of file diff --git a/src/store/modules/d2admin/index.js.REMOVED.git-id b/src/store/modules/d2admin/index.js.REMOVED.git-id new file mode 100644 index 00000000..412de3df --- /dev/null +++ b/src/store/modules/d2admin/index.js.REMOVED.git-id @@ -0,0 +1 @@ +fd12a77558dbfc4645076ab263171bba16fca77c \ No newline at end of file From 129732558f6b807dab66d8f42ca29f16434f927d Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Wed, 8 Aug 2018 07:59:52 +0800 Subject: [PATCH 02/31] =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=90=8D=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 1a0c7d8b50fec573a7aadeceb45091d912bcc1ef [formerly 1a0c7d8b50fec573a7aadeceb45091d912bcc1ef [formerly 1a0c7d8b50fec573a7aadeceb45091d912bcc1ef [formerly 1a0c7d8b50fec573a7aadeceb45091d912bcc1ef [formerly c2fbf3841957c808ada8d1ac6ea5e99445b9a752 [formerly 5ab8ff3ab01480b7aacdc88c6580b45e48b96ee4]]]]] Former-commit-id: 61174d35787e83c7c25ce01359d68a12ef17d7f7 Former-commit-id: da2d36e071a049cf6bb1f9091c80d5183d324ad1 Former-commit-id: 9cc4b408474b2152a4e33937fb1afef51eb3db73 [formerly 8a101ad6b9db7aec74971ff3572192d92be60245] Former-commit-id: 3ff22e65803fc966799c30c11f8f9958a3317090 Former-commit-id: 4e74b514a1e3051c18daaa258d98e2c32e18b4c8 Former-commit-id: e6c0d144a8d8d05f01f8d7086a347d2aba7022b4 Former-commit-id: e5f1805494b931e26afcbccf48a782f1ea495f9a Former-commit-id: 8cf2f5dc12765d3262645d6ccd30704a25fa9b74 --- src/store/modules/d2admin/index.js.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/modules/d2admin/index.js.REMOVED.git-id b/src/store/modules/d2admin/index.js.REMOVED.git-id index 412de3df..f8ca85be 100644 --- a/src/store/modules/d2admin/index.js.REMOVED.git-id +++ b/src/store/modules/d2admin/index.js.REMOVED.git-id @@ -1 +1 @@ -fd12a77558dbfc4645076ab263171bba16fca77c \ No newline at end of file +b8a23a986004dadbc5824f16111da212f777bb27 \ No newline at end of file From b1459f100d6f670fce6d8f594b0ccc1c4c68d0fc Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Wed, 8 Aug 2018 09:19:11 +0800 Subject: [PATCH 03/31] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 63fcb6e8af280eb6aa1847600c096fb48cf53ea1 [formerly 63fcb6e8af280eb6aa1847600c096fb48cf53ea1 [formerly 63fcb6e8af280eb6aa1847600c096fb48cf53ea1 [formerly 63fcb6e8af280eb6aa1847600c096fb48cf53ea1 [formerly 632d40c9d0643c6a24abfb7b58b999d829d4f4e5 [formerly 57132b61c7b2f326d08dbe138fda1fac4cb83c62]]]]] Former-commit-id: c0cb71135408e03add94e219759ae37cfb75f31b Former-commit-id: 7f8209eae78f59e644c204712c31dff787899384 Former-commit-id: b08fbd31671e552da8012eb3ee901edf4f89c0e9 [formerly bb7abe3cc56f2f376a59413c370032d896b50c38] Former-commit-id: 0872ac8e17b45829eee426dc5f80f25e37c85ea3 Former-commit-id: 373b0874ce730b26f256600de55a39b2e40d5f9f Former-commit-id: 472309b468a04d5e57a1a917a6472061668cc7f0 Former-commit-id: 88ad7d087a7382d66523f481b7e1476c21f2830d Former-commit-id: 6557698b7db15cc1b62cf9c3976521de6cc194cd --- src/components/d2-error-log-list/index.vue | 6 +-- .../components/header-error-log/index.vue | 28 ++++++------ .../components/header-fullscreen/index.vue | 12 ++--- .../components/d2-theme-list/index.vue | 14 +++--- .../components/header-user/index.vue | 12 ++--- .../components/menu-header/index.vue | 6 +-- .../components/menu-side/index.vue | 8 ++-- .../header-aside/components/tabs/index.vue | 30 ++++++------- src/layout/header-aside/layout.vue | 32 +++++++------- src/libs/util.js | 4 +- src/main.js | 12 ++--- src/pages/demo/playground/db/public/index.vue | 16 +++---- src/pages/demo/playground/db/user/index.vue | 16 +++---- .../playground/store/fullscreen/index.vue | 14 +++--- .../demo/playground/store/gray/index.vue | 22 +++++----- .../demo/playground/store/menu/index.vue | 30 ++++++------- src/pages/demo/playground/store/sys/index.vue | 44 +++++++++---------- .../demo/playground/store/theme/index.vue | 14 +++--- src/pages/demo/playground/store/ua/index.vue | 6 +-- src/pages/login/page.vue | 6 +-- src/plugin/error/index.js | 2 +- src/plugin/log/index.js | 2 +- src/router/index.js | 2 +- .../modules/d2admin/index.js.REMOVED.git-id | 2 +- 24 files changed, 170 insertions(+), 170 deletions(-) diff --git a/src/components/d2-error-log-list/index.vue b/src/components/d2-error-log-list/index.vue index 34a93065..666fac97 100644 --- a/src/components/d2-error-log-list/index.vue +++ b/src/components/d2-error-log-list/index.vue @@ -136,9 +136,9 @@ export default { ExpandItem }, computed: { - ...mapState({ - log: state => state.d2admin.log - }), + ...mapState('d2admin', [ + 'log' + ]), logReverse () { // 直接 reverse 的话有点问题 const res = [] diff --git a/src/layout/header-aside/components/header-error-log/index.vue b/src/layout/header-aside/components/header-error-log/index.vue index d95c6e1e..b031d8c5 100644 --- a/src/layout/header-aside/components/header-error-log/index.vue +++ b/src/layout/header-aside/components/header-error-log/index.vue @@ -9,12 +9,12 @@ type="text" @click="handleClick"> + :value="logErrorLength" + :is-dot="logErrorLength === 0"> 0 - ? ` | 包含 ${this.d2adminLogErrorLength} 个异常` + : `${this.logLength} 条日志${this.logErrorLength > 0 + ? ` | 包含 ${this.logErrorLength} 个异常` : ''}` } }, methods: { - ...mapMutations([ - 'd2adminLogClean' + ...mapMutations('d2admin', [ + 'logClean' ]), handleClick () { - if (this.d2adminLogLength > 0) { + if (this.logLength > 0) { this.dialogVisible = true } }, handleLogClean () { this.dialogVisible = false - this.d2adminLogClean() + this.logClean() } } } diff --git a/src/layout/header-aside/components/header-fullscreen/index.vue b/src/layout/header-aside/components/header-fullscreen/index.vue index 68f801be..8e6ed7ea 100644 --- a/src/layout/header-aside/components/header-fullscreen/index.vue +++ b/src/layout/header-aside/components/header-fullscreen/index.vue @@ -3,7 +3,7 @@ effect="dark" :content="isFullScreen ? '退出全屏' : '全屏'" placement="bottom"> - + @@ -14,13 +14,13 @@ import { mapState, mapMutations } from 'vuex' export default { computed: { - ...mapState({ - isFullScreen: state => state.d2admin.isFullScreen - }) + ...mapState('d2admin', [ + 'isFullScreen' + ]) }, methods: { - ...mapMutations([ - 'd2adminFullScreenToggle' + ...mapMutations('d2admin', [ + 'fullScreenToggle' ]) } } diff --git a/src/layout/header-aside/components/header-theme/components/d2-theme-list/index.vue b/src/layout/header-aside/components/header-theme/components/d2-theme-list/index.vue index 9038b29b..8b81cc76 100644 --- a/src/layout/header-aside/components/header-theme/components/d2-theme-list/index.vue +++ b/src/layout/header-aside/components/header-theme/components/d2-theme-list/index.vue @@ -30,17 +30,17 @@ export default { } }, computed: { - ...mapState({ - themeList: state => state.d2admin.themeList, - themeActiveName: state => state.d2admin.themeActiveName - }) + ...mapState('d2admin', [ + 'themeList', + 'themeActiveName' + ]) }, methods: { - ...mapMutations([ - 'd2adminThemeSet' + ...mapMutations('d2admin', [ + 'themeSet' ]), handleSelectTheme (name) { - this.d2adminThemeSet(name) + this.themeSet(name) } } } diff --git a/src/layout/header-aside/components/header-user/index.vue b/src/layout/header-aside/components/header-user/index.vue index 7ed24019..3cc270b0 100644 --- a/src/layout/header-aside/components/header-user/index.vue +++ b/src/layout/header-aside/components/header-user/index.vue @@ -14,19 +14,19 @@ import { mapState, mapActions } from 'vuex' export default { computed: { - ...mapState({ - userInfo: state => state.d2admin.userInfo - }) + ...mapState('d2admin', [ + 'userInfo' + ]) }, methods: { - ...mapActions([ - 'd2adminLogout' + ...mapActions('d2admin', [ + 'logout' ]), /** * @description 登出 */ logOff () { - this.d2adminLogout({ + this.logout({ vm: this, confirm: true }) diff --git a/src/layout/header-aside/components/menu-header/index.vue b/src/layout/header-aside/components/menu-header/index.vue index a52d4e5d..0d634f27 100644 --- a/src/layout/header-aside/components/menu-header/index.vue +++ b/src/layout/header-aside/components/menu-header/index.vue @@ -22,9 +22,9 @@ export default { 'd2-layout-header-aside-menu-sub': d2LayoutMainMenuSub }, computed: { - ...mapState({ - menuHeader: state => state.d2admin.menuHeader - }) + ...mapState('d2admin', [ + 'menuHeader' + ]) } } diff --git a/src/layout/header-aside/components/menu-side/index.vue b/src/layout/header-aside/components/menu-side/index.vue index e387b810..cae75156 100644 --- a/src/layout/header-aside/components/menu-side/index.vue +++ b/src/layout/header-aside/components/menu-side/index.vue @@ -41,10 +41,10 @@ export default { } }, computed: { - ...mapState({ - menuAside: state => state.d2admin.menuAside, - isMenuAsideCollapse: state => state.d2admin.isMenuAsideCollapse - }) + ...mapState('d2admin', [ + 'menuAside', + 'isMenuAsideCollapse' + ]) }, watch: { // 折叠和展开菜单的时候销毁 better scroll diff --git a/src/layout/header-aside/components/tabs/index.vue b/src/layout/header-aside/components/tabs/index.vue index 9111f38b..36b8753e 100644 --- a/src/layout/header-aside/components/tabs/index.vue +++ b/src/layout/header-aside/components/tabs/index.vue @@ -82,17 +82,17 @@ export default { } }, computed: { - ...mapState({ - pageOpenedList: state => state.d2admin.pageOpenedList, - pageCurrent: state => state.d2admin.pageCurrent - }) + ...mapState('d2admin', [ + 'pageOpenedList', + 'pageCurrent' + ]) }, methods: { - ...mapMutations([ - 'd2adminTagCloseLeft', - 'd2adminTagCloseRight', - 'd2adminTagCloseOther', - 'd2adminTagCloseAll' + ...mapMutations('d2admin', [ + 'tagCloseLeft', + 'tagCloseRight', + 'tagCloseOther', + 'tagCloseAll' ]), /** * @description 右键菜单功能点击 @@ -136,16 +136,16 @@ export default { } switch (command) { case 'left': - this.d2adminTagCloseLeft(params) + this.tagCloseLeft(params) break case 'right': - this.d2adminTagCloseRight(params) + this.tagCloseRight(params) break case 'other': - this.d2adminTagCloseOther(params) + this.tagCloseOther(params) break case 'all': - this.d2adminTagCloseAll(this) + this.tagCloseAll(this) break default: this.$message.error('无效的操作') @@ -156,7 +156,7 @@ export default { * @description 接收点击关闭控制上按钮的事件 */ handleControlBtnClick () { - this.d2adminTagCloseAll(this) + this.tagCloseAll(this) }, /** * @description 接收点击 tab 标签的事件 @@ -174,7 +174,7 @@ export default { */ handleTabsEdit (tagName, action) { if (action === 'remove') { - this.$store.commit('d2adminTagClose', { + this.$store.commit('d2admin/tagClose', { tagName, vm: this }) diff --git a/src/layout/header-aside/layout.vue b/src/layout/header-aside/layout.vue index 9f672db9..bf8f0985 100644 --- a/src/layout/header-aside/layout.vue +++ b/src/layout/header-aside/layout.vue @@ -10,8 +10,8 @@
- - + +
@@ -44,7 +44,7 @@
- + @@ -78,35 +78,35 @@ export default { } }, computed: { - ...mapState({ - isGrayMode: state => state.d2admin.isGrayMode, - pageOpenedList: state => state.d2admin.pageOpenedList, - isMenuAsideCollapse: state => state.d2admin.isMenuAsideCollapse - }), - ...mapGetters([ - 'd2adminThemeActiveSetting', - 'd2adminKeepAliveInclude' + ...mapState('d2admin', [ + 'isGrayMode', + 'pageOpenedList', + 'isMenuAsideCollapse' + ]), + ...mapGetters('d2admin', [ + 'themeActiveSetting', + 'keepAliveInclude' ]), /** * @description 最外层容器的背景图片样式 */ styleLayoutMainGroup () { return { - ...this.d2adminThemeActiveSetting.backgroundImage ? { - backgroundImage: `url('${this.$baseUrl}${this.d2adminThemeActiveSetting.backgroundImage}')` + ...this.themeActiveSetting.backgroundImage ? { + backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')` } : {} } } }, methods: { - ...mapMutations([ - 'd2adminMenuAsideCollapseToggle' + ...mapMutations('d2admin', [ + 'menuAsideCollapseToggle' ]), /** * 接收点击切换侧边栏的按钮 */ handleToggleAside () { - this.d2adminMenuAsideCollapseToggle() + this.menuAsideCollapseToggle() } } } diff --git a/src/libs/util.js b/src/libs/util.js index 74ac78b7..6372c747 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -159,9 +159,9 @@ util.checkUpdate = function (vm) { if (update) { util.log.capsule('D2Admin', `New version ${res.name}`) console.log(`版本号: ${res.tag_name} | 详情${res.html_url}`) - vm.$store.commit('d2adminReleasesUpdateSet', true) + vm.$store.commit('d2admin/releasesUpdateSet', true) } - vm.$store.commit('d2adminReleasesLatestSet', res) + vm.$store.commit('d2admin/releasesLatestSet', res) }) .catch(err => { console.log('checkUpdate error', err) diff --git a/src/main.js b/src/main.js index c1fa839b..16e5aff0 100644 --- a/src/main.js +++ b/src/main.js @@ -52,17 +52,17 @@ new Vue({ // 处理路由 得到每一级的路由设置 this.getAllPageFromRoutes() // 设置顶栏菜单 - this.$store.commit('d2adminMenuHeaderSet', menuHeader) + this.$store.commit('d2admin/menuHeaderSet', menuHeader) }, mounted () { // D2Admin 开发环境检查更新 util.checkUpdate(this) // 获取并记录用户 UA - this.$store.commit('d2adminUaGet') + this.$store.commit('d2admin/uaGet') // 展示系统信息 util.showInfo() // 用户登陆后从数据库加载一系列的设置 - this.$store.commit('d2adminLoginSuccessLoad') + this.$store.commit('d2admin/loginSuccessLoad') // 初始化全屏监听 this.fullscreenListenerInit() }, @@ -70,7 +70,7 @@ new Vue({ // 监听路由 控制侧边栏显示 '$route.matched' (val) { const _side = menuAside.filter(menu => menu.path === val[0].path) - this.$store.commit('d2adminMenuAsideSet', _side.length > 0 ? _side[0].children : []) + this.$store.commit('d2admin/menuAsideSet', _side.length > 0 ? _side[0].children : []) } }, methods: { @@ -81,7 +81,7 @@ new Vue({ if (screenfull.enabled) { screenfull.on('change', () => { if (!screenfull.isFullscreen) { - this.$store.commit('d2adminFullScreenSet', false) + this.$store.commit('d2admin/fullScreenSet', false) } }) } @@ -102,7 +102,7 @@ new Vue({ }) } push(frameInRoutes) - this.$store.commit('d2adminPagePoolSet', pool) + this.$store.commit('d2admin/pagePoolSet', pool) } } }).$mount('#app') diff --git a/src/pages/demo/playground/db/public/index.vue b/src/pages/demo/playground/db/public/index.vue index fcceac0e..d5948805 100644 --- a/src/pages/demo/playground/db/public/index.vue +++ b/src/pages/demo/playground/db/public/index.vue @@ -54,15 +54,15 @@ export default { this.load() }, methods: { - ...mapMutations([ - 'd2adminUtilDatabase', - 'd2adminUtilDatabaseClear' + ...mapMutations('d2admin', [ + 'utilDatabase', + 'utilDatabaseClear' ]), /** * 加载本地数据 */ load () { - this.d2adminUtilDatabase(database => { + this.utilDatabase(database => { this.dataDisplay = JSON.stringify(database.value(), null, 2) this.keyNameList = Object.keys(database.value()).map(k => ({ value: k, @@ -74,7 +74,7 @@ export default { * 删除一个字段 */ handleDelete (name) { - this.d2adminUtilDatabase(database => { + this.utilDatabase(database => { database .unset(name) .write() @@ -86,7 +86,7 @@ export default { * 清空当前用户的数据 */ handleClear () { - this.d2adminUtilDatabaseClear() + this.utilDatabaseClear() this.load() }, /** @@ -97,7 +97,7 @@ export default { this.$message.error('字段名不能为空') return } - this.d2adminUtilDatabase(database => { + this.utilDatabase(database => { database .set(this.keyNameToSet, this.valueToSet) .write() @@ -108,7 +108,7 @@ export default { * 添加一个随机数据 */ handleSetRandom () { - this.d2adminUtilDatabase(database => { + this.utilDatabase(database => { const id = day().valueOf() database .set(id, Math.round(id * Math.random())) diff --git a/src/pages/demo/playground/db/user/index.vue b/src/pages/demo/playground/db/user/index.vue index d61c534c..b70eb776 100644 --- a/src/pages/demo/playground/db/user/index.vue +++ b/src/pages/demo/playground/db/user/index.vue @@ -54,15 +54,15 @@ export default { this.load() }, methods: { - ...mapMutations([ - 'd2adminUtilDatabaseUser', - 'd2adminUtilDatabaseUserClear' + ...mapMutations('d2admin', [ + 'utilDatabaseUser', + 'utilDatabaseUserClear' ]), /** * 加载本地数据 */ load () { - this.d2adminUtilDatabaseUser(database => { + this.utilDatabaseUser(database => { this.dataDisplay = JSON.stringify(database.value(), null, 2) this.keyNameList = Object.keys(database.value()).map(k => ({ value: k, @@ -74,7 +74,7 @@ export default { * 删除一个字段 */ handleDelete (name) { - this.d2adminUtilDatabaseUser(database => { + this.utilDatabaseUser(database => { database .unset(name) .write() @@ -86,7 +86,7 @@ export default { * 清空当前用户的数据 */ handleClear () { - this.d2adminUtilDatabaseUserClear() + this.utilDatabaseUserClear() this.load() }, /** @@ -97,7 +97,7 @@ export default { this.$message.error('字段名不能为空') return } - this.d2adminUtilDatabaseUser(database => { + this.utilDatabaseUser(database => { database .set(this.keyNameToSet, this.valueToSet) .write() @@ -108,7 +108,7 @@ export default { * 添加一个随机数据 */ handleSetRandom () { - this.d2adminUtilDatabaseUser(database => { + this.utilDatabaseUser(database => { const id = day().valueOf() database .set(id, Math.round(id * Math.random())) diff --git a/src/pages/demo/playground/store/fullscreen/index.vue b/src/pages/demo/playground/store/fullscreen/index.vue index bb16f8c8..1f464d34 100644 --- a/src/pages/demo/playground/store/fullscreen/index.vue +++ b/src/pages/demo/playground/store/fullscreen/index.vue @@ -1,8 +1,8 @@ @@ -11,13 +11,13 @@ import { mapState, mapMutations } from 'vuex' export default { computed: { - ...mapState({ - isFullScreen: state => state.d2admin.isFullScreen - }) + ...mapState('d2admin', [ + 'isFullScreen' + ]) }, methods: { - ...mapMutations([ - 'd2adminFullScreenToggle' + ...mapMutations('d2admin', [ + 'fullScreenToggle' ]) } } diff --git a/src/pages/demo/playground/store/gray/index.vue b/src/pages/demo/playground/store/gray/index.vue index 243af3cb..fa3521db 100644 --- a/src/pages/demo/playground/store/gray/index.vue +++ b/src/pages/demo/playground/store/gray/index.vue @@ -4,9 +4,9 @@
{{isGrayMode ? 'GRAY' : 'COLORFUL'}}
- 切换灰度模式 - 打开灰度模式 - 关闭灰度模式 + 切换灰度模式 + 打开灰度模式 + 关闭灰度模式 模拟报错提示框 state.d2admin.isGrayMode - }) + ...mapState('d2admin', [ + 'isGrayMode' + ]) }, methods: { - ...mapMutations([ - 'd2adminGrayModeToggle', - 'd2adminGrayModeSet' + ...mapMutations('d2admin', [ + 'grayModeToggle', + 'grayModeSet' ]), handleDialogOpen () { - this.d2adminGrayModeSet(true) + this.grayModeSet(true) }, handleDialogClosed () { - this.d2adminGrayModeSet(false) + this.grayModeSet(false) } } } diff --git a/src/pages/demo/playground/store/menu/index.vue b/src/pages/demo/playground/store/menu/index.vue index d60058ce..4b3ee966 100644 --- a/src/pages/demo/playground/store/menu/index.vue +++ b/src/pages/demo/playground/store/menu/index.vue @@ -74,10 +74,10 @@ export default { } }, computed: { - ...mapState({ - menuHeader: state => state.d2admin.menuHeader, - menuAside: state => state.d2admin.menuAside - }) + ...mapState('d2admin', [ + 'menuHeader', + 'menuAside' + ]) }, created () { this.menuHeaderBak = clonedeep(this.menuHeader) @@ -85,8 +85,8 @@ export default { }, beforeDestroy () { if (this.menuHeaderChanged && this.menuAsideChanged) { - this.d2adminMenuHeaderSet(this.menuHeaderBak) - this.d2adminMenuAsideSet(this.menuAsideBak) + this.menuHeaderSet(this.menuHeaderBak) + this.menuAsideSet(this.menuAsideBak) this.$notify({ title: '菜单恢复', message: '对侧边栏和顶栏菜单的修改已经复原', @@ -95,7 +95,7 @@ export default { return } if (this.menuHeaderChanged) { - this.d2adminMenuHeaderSet(this.menuHeaderBak) + this.menuHeaderSet(this.menuHeaderBak) this.$notify({ title: '菜单恢复', message: '对顶栏菜单的修改已经复原', @@ -104,7 +104,7 @@ export default { return } if (this.menuAsideChanged) { - this.d2adminMenuAsideSet(this.menuAsideBak) + this.menuAsideSet(this.menuAsideBak) this.$notify({ title: '菜单恢复', message: '对侧边栏菜单的修改已经复原', @@ -113,16 +113,16 @@ export default { } }, methods: { - ...mapMutations([ - 'd2adminMenuHeaderSet', - 'd2adminMenuAsideSet' + ...mapMutations('d2admin', [ + 'menuHeaderSet', + 'menuAsideSet' ]), /** * 修改顶栏菜单 */ handleMenuHeaderSet () { this.menuHeaderChanged = true - this.d2adminMenuHeaderSet(this.menuEmpty) + this.menuHeaderSet(this.menuEmpty) this.$notify({ title: '菜单修改', message: '对顶栏菜单的修改已经生效', @@ -134,7 +134,7 @@ export default { */ handleMenuAsideSet () { this.menuAsideChanged = true - this.d2adminMenuAsideSet(this.menuEmpty) + this.menuAsideSet(this.menuEmpty) this.$notify({ title: '菜单修改', message: '对侧边栏菜单的修改已经生效', @@ -145,7 +145,7 @@ export default { * 恢复顶栏菜单 */ menuHeaderReset () { - this.d2adminMenuHeaderSet(this.menuHeaderBak) + this.menuHeaderSet(this.menuHeaderBak) this.$notify({ title: '菜单恢复', message: '对顶栏菜单的修改已经复原', @@ -156,7 +156,7 @@ export default { * 恢复侧边栏菜单 */ menuAsideReset () { - this.d2adminMenuAsideSet(this.menuAsideBak) + this.menuAsideSet(this.menuAsideBak) this.$notify({ title: '菜单恢复', message: '对侧边栏菜单的修改已经复原', diff --git a/src/pages/demo/playground/store/sys/index.vue b/src/pages/demo/playground/store/sys/index.vue index 68dc69a8..e3b46618 100644 --- a/src/pages/demo/playground/store/sys/index.vue +++ b/src/pages/demo/playground/store/sys/index.vue @@ -61,7 +61,7 @@
- +
@@ -91,7 +91,7 @@
- +
@@ -108,26 +108,26 @@ import { mapState, mapGetters } from 'vuex' export default { computed: { - ...mapState({ - userInfo: state => state.d2admin.userInfo, - version: state => state.d2admin.version, - releasesLatest: state => state.d2admin.releasesLatest, - releasesUpdate: state => state.d2admin.releasesUpdate, - menuHeader: state => state.d2admin.menuHeader, - menuAside: state => state.d2admin.menuAside, - isFullScreen: state => state.d2admin.isFullScreen, - isGrayMode: state => state.d2admin.isGrayMode, - isMenuAsideCollapse: state => state.d2admin.isMenuAsideCollapse, - themeList: state => state.d2admin.themeList, - themeActiveName: state => state.d2admin.themeActiveName, - pagePool: state => state.d2admin.pagePool, - pageOpenedList: state => state.d2admin.pageOpenedList, - pageCurrent: state => state.d2admin.pageCurrent, - ua: state => state.d2admin.ua - }), - ...mapGetters([ - 'd2adminThemeActiveSetting', - 'd2adminKeepAliveInclude' + ...mapState('d2admin', [ + 'userInfo', + 'version', + 'releasesLatest', + 'releasesUpdate', + 'menuHeader', + 'menuAside', + 'isFullScreen', + 'isGrayMode', + 'isMenuAsideCollapse', + 'themeList', + 'themeActiveName', + 'pagePool', + 'pageOpenedList', + 'pageCurrent', + 'ua' + ]), + ...mapGetters('d2admin', [ + 'themeActiveSetting', + 'keepAliveInclude' ]) } } diff --git a/src/pages/demo/playground/store/theme/index.vue b/src/pages/demo/playground/store/theme/index.vue index f150fe83..da434c65 100644 --- a/src/pages/demo/playground/store/theme/index.vue +++ b/src/pages/demo/playground/store/theme/index.vue @@ -42,17 +42,17 @@ export default { } }, computed: { - ...mapState({ - themeList: state => state.d2admin.themeList, - themeActiveName: state => state.d2admin.themeActiveName - }) + ...mapState('d2admin', [ + 'themeList', + 'themeActiveName' + ]) }, methods: { - ...mapMutations([ - 'd2adminThemeSet' + ...mapMutations('d2admin', [ + 'themeSet' ]), handleSelectTheme (name) { - this.d2adminThemeSet(name) + this.themeSet(name) } } } diff --git a/src/pages/demo/playground/store/ua/index.vue b/src/pages/demo/playground/store/ua/index.vue index 1e5019c7..957f5d2a 100644 --- a/src/pages/demo/playground/store/ua/index.vue +++ b/src/pages/demo/playground/store/ua/index.vue @@ -11,9 +11,9 @@ import { mapState } from 'vuex' export default { computed: { - ...mapState({ - ua: state => state.d2admin.ua - }), + ...mapState('d2admin', [ + 'ua' + ]), uaStr () { const { browser, engine, os, device, cpu } = this.ua return JSON.stringify({ browser, engine, os, device, cpu }, null, 2) diff --git a/src/pages/login/page.vue b/src/pages/login/page.vue index 3c9c3d77..6945f616 100644 --- a/src/pages/login/page.vue +++ b/src/pages/login/page.vue @@ -105,8 +105,8 @@ export default { particlesJS('login', config) }, methods: { - ...mapActions([ - 'd2adminLogin' + ...mapActions('d2admin', [ + 'login' ]), /** * @description 接收选择一个用户快速登陆的事件 @@ -127,7 +127,7 @@ export default { // 登陆 // 注意 这里的演示没有传验证码 // 具体需要传递的数据请自行修改代码 - this.d2adminLogin({ + this.login({ vm: this, username: this.formLogin.username, password: this.formLogin.password diff --git a/src/plugin/error/index.js b/src/plugin/error/index.js index 463a74e7..64e07424 100644 --- a/src/plugin/error/index.js +++ b/src/plugin/error/index.js @@ -5,7 +5,7 @@ export default { install (Vue, options) { Vue.config.errorHandler = function (err, vm, info) { Vue.nextTick(() => { - store.commit('d2adminLogAdd', { + store.commit('d2admin/logAdd', { type: 'error', err, vm, diff --git a/src/plugin/log/index.js b/src/plugin/log/index.js index 6d56a13f..668c85c4 100644 --- a/src/plugin/log/index.js +++ b/src/plugin/log/index.js @@ -7,7 +7,7 @@ export default { Vue.prototype.$log = util.log // 快速记录日志 Vue.prototype.$logAdd = function (info) { - store.commit('d2adminLogAdd', { + store.commit('d2admin/logAdd', { type: 'log', info }) diff --git a/src/router/index.js b/src/router/index.js index 92927ba2..d715ede0 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -42,7 +42,7 @@ router.afterEach(to => { const app = router.app const { name, params, query } = to // 多页控制 打开新的页面 - app.$store.commit('d2adminPageOpenNew', { name, params, query }) + app.$store.commit('d2admin/pageOpenNew', { name, params, query }) // 更改标题 util.title(to.meta.title) }) diff --git a/src/store/modules/d2admin/index.js.REMOVED.git-id b/src/store/modules/d2admin/index.js.REMOVED.git-id index f8ca85be..d7aefc07 100644 --- a/src/store/modules/d2admin/index.js.REMOVED.git-id +++ b/src/store/modules/d2admin/index.js.REMOVED.git-id @@ -1 +1 @@ -b8a23a986004dadbc5824f16111da212f777bb27 \ No newline at end of file +ce01ef3f8c328fa113c7dfbe78187ce4220af214 \ No newline at end of file From 8ef8ae0ca4f4d68ccfa04e52571517f2906c122e Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Wed, 8 Aug 2018 09:34:35 +0800 Subject: [PATCH 04/31] =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=B9=A6=E5=86=99=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 93e74bc54bdb54522026dc64d0e65e20ffd54e2e [formerly 93e74bc54bdb54522026dc64d0e65e20ffd54e2e [formerly 93e74bc54bdb54522026dc64d0e65e20ffd54e2e [formerly 93e74bc54bdb54522026dc64d0e65e20ffd54e2e [formerly 4078a86d7671d63e8cdc94cf37befbedd4ef3900 [formerly 8ea10257c9a46150565e291a40a276e3439cd9a9]]]]] Former-commit-id: e908ae7726ba64e0f7a54fc24061463ff56fc98b Former-commit-id: 9f45d169b7afcea1ccc2a9bff4780066f56383d8 Former-commit-id: 4dc2a99741508b592812cabb0863e678a3246fc5 [formerly 91d967993cd1bbd0736eccc3d5ee5b762c54e2fe] Former-commit-id: 3dd5d1b34ee3592a93cf6ba3c5f6da049249512d Former-commit-id: ccc60e742d93d5e46135c855d28e64ce2260ab72 Former-commit-id: 1e6792ceb3919ccf7c6196e0d675c362dc113e90 Former-commit-id: 33e796d22840f14cb3a30ebef9e9621220968be2 Former-commit-id: 66a4eda8afa1035f2b3453fb1df0705cee7b5f63 --- src/store/modules/d2admin/index.js.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/modules/d2admin/index.js.REMOVED.git-id b/src/store/modules/d2admin/index.js.REMOVED.git-id index d7aefc07..497617b1 100644 --- a/src/store/modules/d2admin/index.js.REMOVED.git-id +++ b/src/store/modules/d2admin/index.js.REMOVED.git-id @@ -1 +1 @@ -ce01ef3f8c328fa113c7dfbe78187ce4220af214 \ No newline at end of file +523f1a7e36f1281a070291d62241d6cdc675d19e \ No newline at end of file From 5a91ab709fa9166561f919769556d7621cd4e04b Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Wed, 8 Aug 2018 16:04:10 +0800 Subject: [PATCH 05/31] util user menu releases Former-commit-id: 236acdba4bc6cbd5921647fd5c1ee0258f43c143 [formerly 236acdba4bc6cbd5921647fd5c1ee0258f43c143 [formerly 236acdba4bc6cbd5921647fd5c1ee0258f43c143 [formerly 236acdba4bc6cbd5921647fd5c1ee0258f43c143 [formerly cd607a12b20a3d53a1967ee6012a35e03e3d31fe [formerly 645a010d0d8f84a370c509c39c560d93eaa8ae4f]]]]] Former-commit-id: fd4e72b6a4dc7cb2731c0b5fbf343dab6c251d3f Former-commit-id: 68305cd58cbd1927373a79c1b507de3c4f3d9924 Former-commit-id: 48312890868f48d5524b0de0dda489f2b2c57b0a [formerly fec91cd8f508ffe42c5e254dcee018c879f3d51e] Former-commit-id: 9e300a2baafd1eae86bb69a052f15b904724856e Former-commit-id: eaafbb0a410a49a286eb8e666b6784b96c9df371 Former-commit-id: ccef5438dddbe9762bd3574b33aab49bc1edee58 Former-commit-id: d2ca5c406860c43079d78a80d18ca2b1ed87f776 Former-commit-id: d4648c6865bff45b24aea999b60381b78417b802 --- package.json | 1 + .../components/header-user/index.vue | 6 +- .../components/menu-header/index.vue | 6 +- .../components/menu-side/index.vue | 16 +-- src/layout/header-aside/layout.vue | 18 ++-- src/libs/db.js | 3 + src/libs/util.js | 4 +- src/main.js | 4 +- .../demo/playground/store/menu/index.vue | 84 ++++++--------- src/pages/demo/playground/store/sys/index.vue | 23 ++-- .../modules/d2admin/index.js.REMOVED.git-id | 2 +- src/store/modules/d2admin/modules/menu.js | 67 ++++++++++++ src/store/modules/d2admin/modules/releases.js | 31 ++++++ src/store/modules/d2admin/modules/user.js | 36 +++++++ src/store/modules/d2admin/modules/util.js | 101 ++++++++++++++++++ 15 files changed, 317 insertions(+), 85 deletions(-) create mode 100644 src/store/modules/d2admin/modules/menu.js create mode 100644 src/store/modules/d2admin/modules/releases.js create mode 100644 src/store/modules/d2admin/modules/user.js create mode 100644 src/store/modules/d2admin/modules/util.js diff --git a/package.json b/package.json index 817a4232..c9a64425 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "js-cookie": "^2.2.0", "lodash.clonedeep": "^4.5.0", "lodash.get": "^4.4.2", + "lodash.set": "^4.3.2", "lodash.sortby": "^4.7.0", "lodash.uniqueid": "^4.0.1", "lowdb": "^1.0.0", diff --git a/src/layout/header-aside/components/header-user/index.vue b/src/layout/header-aside/components/header-user/index.vue index 3cc270b0..d2f53ccc 100644 --- a/src/layout/header-aside/components/header-user/index.vue +++ b/src/layout/header-aside/components/header-user/index.vue @@ -14,9 +14,9 @@ import { mapState, mapActions } from 'vuex' export default { computed: { - ...mapState('d2admin', [ - 'userInfo' - ]) + ...mapState('d2admin', { + userInfo: state => state.user.userInfo + }) }, methods: { ...mapActions('d2admin', [ diff --git a/src/layout/header-aside/components/menu-header/index.vue b/src/layout/header-aside/components/menu-header/index.vue index 0d634f27..acea80cf 100644 --- a/src/layout/header-aside/components/menu-header/index.vue +++ b/src/layout/header-aside/components/menu-header/index.vue @@ -1,6 +1,6 @@