From 8e28420e0bb68d1cfc5fb3e6b3f943c043a2e770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 3 Sep 2018 15:29:42 +0800 Subject: [PATCH] Fix top style error --- config/config.js | 3 +++ package.json | 4 ++-- src/components/TopNavHeader/index.js | 4 ++-- src/models/setting.js | 6 ++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/config/config.js b/config/config.js index cc23f0e4..47f0ac1e 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 9d6df33f..96960419 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 9c8575ce..a4a277e0 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 106c2369..b06e95e2 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; -- GitLab