diff --git a/config/config.js b/config/config.js index cc23f0e4f4cf736f975f40662b772306a642f54e..47f0ac1e39f254fcd5e1e0c6ce1a587934ad7c0a 100644 --- a/config/config.js +++ b/config/config.js @@ -32,6 +32,9 @@ export default { }, ], ], + define: { + APP_TYPE: process.env.APP_TYPE, + }, // 路由配置 routes: pageRoutes, // Theme for antd diff --git a/package.json b/package.json index 9d6df33f823a1439914bf77fe4fa900e361cdbc2..9696041956c95ca1163c4c1d5f859316948ca59d 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,10 @@ "scripts": { "precommit": "npm run lint-staged", "presite": "npm run generate-mock && cd functions && npm install", - "start": "umi dev", + "start": "APP_TYPE=site umi dev", "start:no-mock": "cross-env MOCK=none umi dev", "build": "umi build", - "site": "npm run presite && npm run build && firebase deploy", + "site": "npm run presite &&APP_TYPE=site npm run build && firebase deploy", "analyze": "cross-env ANALYZE=1 umi build", "lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint": "eslint --ext .js src mock tests && npm run lint:style", diff --git a/src/components/TopNavHeader/index.js b/src/components/TopNavHeader/index.js index 9c8575cebafdb8ece918f69ce2a683371a1dffb7..a4a277e01af9a488f1d8ff29fbd6f56cc1f1ddbd 100644 --- a/src/components/TopNavHeader/index.js +++ b/src/components/TopNavHeader/index.js @@ -9,13 +9,13 @@ export default class TopNavHeader extends PureComponent { super(props); this.state = { - maxWidth: (props.contentWidth === 'Fixed' ? 1200 : window.innerWidth) - 324 - 165 - 4, + maxWidth: (props.contentWidth === 'Fixed' ? 1200 : window.innerWidth) - 330 - 165 - 4, }; } static getDerivedStateFromProps(props) { return { - maxWidth: (props.contentWidth === 'Fixed' ? 1200 : window.innerWidth) - 324 - 165 - 4, + maxWidth: (props.contentWidth === 'Fixed' ? 1200 : window.innerWidth) - 330 - 165 - 4, }; } diff --git a/src/models/setting.js b/src/models/setting.js index 106c2369b59429afe20f580cac9e971f5324dffa..b06e95e2aba312ab3597ce5cae5a83a8d49776bb 100644 --- a/src/models/setting.js +++ b/src/models/setting.js @@ -3,10 +3,12 @@ import defaultSettings from '../defaultSettings'; let lessNodesAppended; const updateTheme = primaryColor => { - // Don't compile less in production! - if (process.env.NODE_ENV === 'production') { + // // Don't compile less in production! + /* eslint-disable */ + if (APP_TYPE !== 'site') { return; } + /* eslint-disable */ // Determine if the component is remounted if (!primaryColor) { return;