陈帅 пре 7 година
родитељ
комит
8e28420e0b
4 измењених фајлова са 11 додато и 6 уклоњено
  1. 3 0
      config/config.js
  2. 2 2
      package.json
  3. 2 2
      src/components/TopNavHeader/index.js
  4. 4 2
      src/models/setting.js

+ 3 - 0
config/config.js

@@ -32,6 +32,9 @@ export default {
       },
     ],
   ],
+  define: {
+    APP_TYPE: process.env.APP_TYPE,
+  },
   // 路由配置
   routes: pageRoutes,
   // Theme for antd

+ 2 - 2
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",

+ 2 - 2
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,
     };
   }
 

+ 4 - 2
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;