diff --git a/config/config.js b/config/config.js index c796308cf233925ad99fbe4b2828706860a625c0..fab44a84ec30a08adabf378ddba8ffba94837d35 100644 --- a/config/config.js +++ b/config/config.js @@ -2,7 +2,7 @@ const os = require('os'); const pageRoutes = require('./router.config'); const webpackplugin = require('./plugin.config'); -const defaultSetting = require('../src/defaultSetting'); +const defaultSettings = require('../src/defaultSettings'); export default { // add for transfer to umi @@ -35,7 +35,7 @@ export default { // Theme for antd // https://ant.design/docs/react/customize-theme-cn theme: { - 'primary-color': defaultSetting.primaryColor, + 'primary-color': defaultSettings.primaryColor, }, externals: { '@antv/data-set': 'DataSet', diff --git a/src/defaultSetting.js b/src/defaultSettings.js similarity index 100% rename from src/defaultSetting.js rename to src/defaultSettings.js diff --git a/src/locales/en-US.js b/src/locales/en-US.js index 2a7e29c378a68b6c2e0c4c4d6f1c5c0c5e2b011a..af8273c65c983473f1670de294bf71920276f190 100644 --- a/src/locales/en-US.js +++ b/src/locales/en-US.js @@ -167,6 +167,7 @@ export default { 'app.setting.othersettings': 'Other Settings', 'app.setting.weakmode': 'Weak Mode', 'app.setting.copy': 'Copy Setting', - 'app.setting.copyinfo': 'copy success,please replace defaultSetting in src/models/setting.js', - 'app.setting.production.hint': 'Setting panel show in development enviorment only, please modify src/defaultSetting.js mannually.', + 'app.setting.copyinfo': 'copy success,please replace defaultSettings in src/models/setting.js', + 'app.setting.production.hint': + 'Setting panel show in development enviorment only, please modify src/defaultSettings.js mannually.', }; diff --git a/src/locales/zh-CN.js b/src/locales/zh-CN.js index d1593443eab216d1326142e3b44c8f4d6cf55f0a..6b6ec55047975182b4cc366a9d38426d1a0a56db 100644 --- a/src/locales/zh-CN.js +++ b/src/locales/zh-CN.js @@ -163,6 +163,7 @@ export default { 'app.setting.othersettings': '其他设置', 'app.setting.weakmode': '色弱模式', 'app.setting.copy': '拷贝设置', - 'app.setting.copyinfo': '拷贝成功,请到 src/defaultSetting.js 中替换默认配置', - 'app.setting.production.hint': '配置栏只在开发环境用于预览,请拷贝后手动修改 src/defaultSetting.js', + 'app.setting.copyinfo': '拷贝成功,请到 src/defaultSettings.js 中替换默认配置', + 'app.setting.production.hint': + '配置栏只在开发环境用于预览,请拷贝后手动修改 src/defaultSettings.js', }; diff --git a/src/models/setting.js b/src/models/setting.js index 3f6c2a0725e19dea14d8a982b2d73469abbfd120..106c2369b59429afe20f580cac9e971f5324dffa 100644 --- a/src/models/setting.js +++ b/src/models/setting.js @@ -1,5 +1,5 @@ import { message } from 'antd'; -import defaultSetting from '../defaultSetting'; +import defaultSettings from '../defaultSettings'; let lessNodesAppended; const updateTheme = primaryColor => { @@ -64,7 +64,7 @@ const updateColorWeak = colorWeak => { export default { namespace: 'setting', - state: defaultSetting, + state: defaultSettings, reducers: { getSetting(state) { const setting = {}; @@ -87,7 +87,7 @@ export default { }, changeSetting(state, { payload }) { const urlParams = new URL(window.location.href); - Object.keys(defaultSetting).forEach(key => { + Object.keys(defaultSettings).forEach(key => { if (urlParams.searchParams.has(key)) { urlParams.searchParams.delete(key); } @@ -100,7 +100,7 @@ export default { if (value === true) { value = 1; } - if (defaultSetting[key] !== value) { + if (defaultSettings[key] !== value) { urlParams.searchParams.set(key, value); } });