diff --git a/package.json b/package.json index a33e49fd35906650b5c04d862ff6332d2f8e27d7..5004028e88b7f5dec2f157eb4368e095fd495c34 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,6 @@ "scripts": { "analyze": "cross-env ANALYZE=1 umi build", "build": "umi build && npm run functions:build", - "dev": "cross-env APP_TYPE=site umi dev", - "dev:no-mock": "cross-env MOCK=none umi dev", "docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./", "docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build", "docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up", @@ -82,6 +80,7 @@ "react-media": "^1.9.2", "react-media-hook2": "^1.0.2", "umi": "^2.6.10", + "umi-plugin-pro-block": "^1.3.0", "umi-plugin-react": "^1.7.2", "umi-request": "^1.0.5" }, diff --git a/src/global.less b/src/global.less index 1450ba46b17daf355a169563d975693f17170ff0..dfc17df045b60cbfe86de60fb233c634a5b21e24 100644 --- a/src/global.less +++ b/src/global.less @@ -24,11 +24,6 @@ body { -moz-osx-font-smoothing: grayscale; } -.globalSpin { - width: 100%; - margin: 40px 0 !important; -} - ul, ol { list-style: none; diff --git a/src/models/setting.ts b/src/models/setting.ts index 6b8e0e673ef635a6bfd5cbed5e52f531e8f2dba3..b7f9068e9dba8738e6be1de8a0a74542be7e9ad7 100644 --- a/src/models/setting.ts +++ b/src/models/setting.ts @@ -14,7 +14,8 @@ let lessNodesAppended: boolean; const updateTheme: (primaryColor?: string) => void = primaryColor => { // Don't compile less in production! - // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 + // preview.pro.ant.design only do not use in your production; + // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION !== 'site') { return; } @@ -72,7 +73,10 @@ const updateTheme: (primaryColor?: string) => void = primaryColor => { }; const updateColorWeak: (colorWeak: string) => void = colorWeak => { - document.body.className = colorWeak ? 'colorWeak' : ''; + const root = document.getElementById('root'); + if (root) { + root.className = colorWeak ? 'colorWeak' : ''; + } }; const SettingModel: SettingModelType = { @@ -89,6 +93,7 @@ const SettingModel: SettingModelType = { } }); const { primaryColor, colorWeak } = setting; + if (state.primaryColor !== primaryColor) { updateTheme(primaryColor); } diff --git a/tslint.yml b/tslint.yml index a3e95faf3a46e91e30c459429ce42771fa23bc2a..3c7841ecfa60ad184324c40f5f989158661b6256 100644 --- a/tslint.yml +++ b/tslint.yml @@ -1,4 +1,6 @@ defaultSeverity: error +globals: + - ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true extends: - tslint-react - tslint-eslint-rules