diff --git a/src/components/SettingDrawer/ThemeColor.js b/src/components/SettingDrawer/ThemeColor.js index f70bd4f824a9d737ba721b1d19bf1625e6439a33..bf5bb7091b3a47f9524c4c76daa70dc8fbdcd8d1 100644 --- a/src/components/SettingDrawer/ThemeColor.js +++ b/src/components/SettingDrawer/ThemeColor.js @@ -30,7 +30,7 @@ const ThemeColor = ({ colors, title, value, onChange }) => { ]; } return ( -
+

{title}

{colorList.map(color => { diff --git a/src/components/SettingDrawer/ThemeColor.less b/src/components/SettingDrawer/ThemeColor.less index 4983eb9c67d207cfa4f9470a5a82068eb9c20c71..89e893fe651be204230c72f93f43408610db8d51 100644 --- a/src/components/SettingDrawer/ThemeColor.less +++ b/src/components/SettingDrawer/ThemeColor.less @@ -1,4 +1,4 @@ -.themeColor { +.primaryColor { overflow: hidden; margin-top: 24px; .title { diff --git a/src/components/SettingDrawer/index.js b/src/components/SettingDrawer/index.js index 4c81b4209145cf1046d1ddf69e69484825953819..f29d875253acef2f5683d149f23907bde1dfd92e 100644 --- a/src/components/SettingDrawer/index.js +++ b/src/components/SettingDrawer/index.js @@ -113,7 +113,7 @@ class SettingDarwer extends PureComponent { render() { const { setting } = this.props; - const { collapse, silderTheme, themeColor, layout, colorWeak } = setting; + const { collapse, silderTheme, primaryColor, layout, colorWeak } = setting; return ( this.changeSetting('themeColor', color)} + value={primaryColor} + onChange={color => this.changeSetting('primaryColor', color)} /> diff --git a/src/defaultSetting.js b/src/defaultSetting.js index 93509816626f779f0dbf96f0abff8dbde1d547fe..8d7aefd6ffb961dcfaf85f0b6cfe3ba067d32a0e 100644 --- a/src/defaultSetting.js +++ b/src/defaultSetting.js @@ -1,7 +1,7 @@ export default { collapse: false, silderTheme: 'dark', - themeColor: '#1890FF', + primaryColor: '#1890FF', layout: 'sidemenu', grid: 'Fluid', fixedHeader: false, diff --git a/src/models/setting.js b/src/models/setting.js index 0426604d32090c442f5342e31663241ce3f435d2..6f65cc039e5d2408ac14762e6d12a201f07db875 100644 --- a/src/models/setting.js +++ b/src/models/setting.js @@ -2,9 +2,9 @@ import { message } from 'antd'; import defaultSetting from '../defaultSetting'; let lessNodesAppended; -const updateTheme = themeColor => { +const updateTheme = primaryColor => { // Determine if the component is remounted - if (!themeColor) { + if (!primaryColor) { return; } const hideMessage = message.loading('正在编译主题!', 0); @@ -40,7 +40,7 @@ const updateTheme = themeColor => { setTimeout(() => { window.less .modifyVars({ - '@primary-color': themeColor, + '@primary-color': primaryColor, }) .then(() => { hideMessage(); @@ -70,9 +70,9 @@ export default { setting[key] = value === '1' ? true : value; } }); - const { themeColor, colorWeak } = setting; - if (state.themeColor !== themeColor) { - updateTheme(themeColor); + const { primaryColor, colorWeak } = setting; + if (state.primaryColor !== primaryColor) { + updateTheme(primaryColor); } updateColorWeak(colorWeak); return { @@ -99,9 +99,9 @@ export default { urlParams.searchParams.set(key, value); } }); - const { themeColor, colorWeak } = payload; - if (state.themeColor !== themeColor) { - updateTheme(themeColor); + const { primaryColor, colorWeak } = payload; + if (state.primaryColor !== primaryColor) { + updateTheme(primaryColor); } updateColorWeak(colorWeak); window.history.replaceState(null, 'setting', urlParams.href);