Commit 63900da8c27e7e18525638def75663db90823756
1 parent
170c0dbc
v3.7.0 修复保存配置主题颜色失效问题
Showing
2 changed files
with
15 additions
and
6 deletions
yudao-ui-admin/src/components/ThemePicker/index.vue
| ... | ... | @@ -31,13 +31,24 @@ export default { |
| 31 | 31 | immediate: true |
| 32 | 32 | }, |
| 33 | 33 | async theme(val) { |
| 34 | + await this.setTheme(val) | |
| 35 | + } | |
| 36 | + }, | |
| 37 | + created() { | |
| 38 | + if(this.defaultTheme !== ORIGINAL_THEME) { | |
| 39 | + this.setTheme(this.defaultTheme) | |
| 40 | + } | |
| 41 | + }, | |
| 42 | + | |
| 43 | + methods: { | |
| 44 | + async setTheme(val) { | |
| 34 | 45 | const oldVal = this.chalk ? this.theme : ORIGINAL_THEME |
| 35 | 46 | if (typeof val !== 'string') return |
| 36 | 47 | const themeCluster = this.getThemeCluster(val.replace('#', '')) |
| 37 | 48 | const originalCluster = this.getThemeCluster(oldVal.replace('#', '')) |
| 38 | 49 | |
| 39 | 50 | const $message = this.$message({ |
| 40 | - message: ' Compiling the theme', | |
| 51 | + message: ' 正在切换主题,请稍后...', | |
| 41 | 52 | customClass: 'theme-message', |
| 42 | 53 | type: 'success', |
| 43 | 54 | duration: 0, |
| ... | ... | @@ -82,10 +93,9 @@ export default { |
| 82 | 93 | this.$emit('change', val) |
| 83 | 94 | |
| 84 | 95 | $message.close() |
| 85 | - } | |
| 86 | - }, | |
| 87 | 96 | |
| 88 | - methods: { | |
| 97 | + }, | |
| 98 | + | |
| 89 | 99 | updateStyle(style, oldCluster, newCluster) { |
| 90 | 100 | let newStyle = style |
| 91 | 101 | oldCluster.forEach((color, index) => { | ... | ... |
yudao-ui-admin/src/store/modules/settings.js
| 1 | -import variables from '@/assets/styles/element-variables.scss' | |
| 2 | 1 | import defaultSettings from '@/settings' |
| 3 | 2 | |
| 4 | 3 | const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings |
| ... | ... | @@ -6,7 +5,7 @@ const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dyn |
| 6 | 5 | const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || '' |
| 7 | 6 | const state = { |
| 8 | 7 | title: '', |
| 9 | - theme: storageSetting.theme || variables.theme, | |
| 8 | + theme: storageSetting.theme || '#409EFF', | |
| 10 | 9 | sideTheme: storageSetting.sideTheme || sideTheme, |
| 11 | 10 | showSettings: showSettings, |
| 12 | 11 | topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav, | ... | ... |