diff --git a/package.json b/package.json index 720967eb..1c7b2f58 100755 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "lodash.clonedeep": "^4.5.0", "lodash.get": "^4.4.2", "lodash.uniqueid": "^4.0.1", + "lowdb": "^1.0.0", "marked": "^0.3.9", "mockjs": "^1.0.1-beta3", "papaparse": "^4.3.6", diff --git a/src/assets/style/theme/list.js b/src/assets/style/theme/list.js new file mode 100644 index 00000000..2dfcabc6 --- /dev/null +++ b/src/assets/style/theme/list.js @@ -0,0 +1,29 @@ +export default [ + { + name: 'd2admin 经典', + value: 'd2', + preview: 'static/image/theme/d2/preview@2x.png' + }, + { + name: '紫罗兰', + value: 'violet', + preview: 'static/image/theme/violet/preview@2x.png' + }, + { + name: '简约线条', + value: 'line', + backgroundImage: 'static/image/bg/line-squashed.jpg', + preview: 'static/image/theme/line/preview@2x.png' + }, + { + name: '流星', + value: 'star', + backgroundImage: 'static/image/bg/star-squashed.jpg', + preview: 'static/image/theme/star/preview@2x.png' + }, + { + name: 'Tomorrow Night Blue (vsCode)', + value: 'tomorrow-night-blue', + preview: 'static/image/theme/tomorrow-night-blue/preview@2x.png' + } +] diff --git a/src/components/core/d2-theme-list/index.vue b/src/components/core/d2-theme-list/index.vue index a4bbda40..f4012227 100644 --- a/src/components/core/d2-theme-list/index.vue +++ b/src/components/core/d2-theme-list/index.vue @@ -6,7 +6,7 @@ @@ -27,16 +27,16 @@ export default { }, computed: { ...mapState({ - themeList: state => state.theme.list, - themeName: state => state.theme.name + themeList: state => state.d2admin.themeList, + themeActive: state => state.d2admin.themeActive }) }, methods: { ...mapMutations([ 'setTheme' ]), - handleSelectTheme (themeName) { - this.setTheme(themeName) + handleSelectTheme (name) { + this.setTheme(name) } } } diff --git a/src/store/index.js b/src/store/index.js index f05e5eee..a83f88d3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -3,7 +3,6 @@ import Vuex from 'vuex' import d2admin from './modules/d2admin' -import menu from './modules/menu' import theme from './modules/theme' Vue.use(Vuex) @@ -11,7 +10,6 @@ Vue.use(Vuex) export default new Vuex.Store({ modules: { d2admin, - menu, theme } }) diff --git a/src/store/modules/d2admin.js b/src/store/modules/d2admin.js index 50073951..a6a58349 100644 --- a/src/store/modules/d2admin.js +++ b/src/store/modules/d2admin.js @@ -1,16 +1,21 @@ import util from '@/libs/util.js' +import themeList from '@/assets/style/theme/list.js' + export default { state: { // 系统 appName: 'D2Admin', // 全屏 - isFullScreen: false + isFullScreen: false, + // 主题 + themeList, + themeActive: themeList[0] }, mutations: { /** * 切换全屏 - * @param {state} state + * @param {state} state vuex state */ toggleFullScreen (state) { if (state.isFullScreen) { diff --git a/src/store/modules/menu.js b/src/store/modules/menu.js deleted file mode 100644 index fe32152a..00000000 --- a/src/store/modules/menu.js +++ /dev/null @@ -1,10 +0,0 @@ -export default { - state: { - sideMenu: [] - }, - mutations: { - setSideMenu (state, {sideMenu}) { - state.sideMenu = sideMenu - } - } -}