Преглед на файлове

Merge branch 'master' of http://192.168.4.246:3000/zhangs/surveyMaker

曹冬冬 преди 5 години
родител
ревизия
9932b0c0c6
променени са 7 файла, в които са добавени 43 реда и са изтрити 28 реда
  1. 2 2
      build/build.js
  2. 7 2
      build/utils.js
  3. 2 2
      build/webpack.base.conf.js
  4. 1 1
      config/prod.env.js
  5. 9 4
      package-lock.json
  6. 6 3
      package.json
  7. 16 14
      src/util/appConst.js

+ 2 - 2
build/build.js

@@ -1,6 +1,6 @@
 // https://github.com/shelljs/shelljs
 require('shelljs/global')
-env.NODE_ENV = 'production'
+// env.NODE_ENV = 'production'
 
 var path = require('path')
 var config = require('../config')
@@ -14,7 +14,7 @@ console.log(
   '  Opening index.html over file:// won\'t work.\n'
 )
 
-var spinner = ora('building for production...')
+var spinner = ora(`building for ${process.env.NODE_ENV}...`)
 spinner.start()
 
 var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)

+ 7 - 2
build/utils.js

@@ -3,7 +3,7 @@ var config = require('../config')
 var ExtractTextPlugin = require('extract-text-webpack-plugin')
 
 exports.assetsPath = function (_path) {
-  var assetsSubDirectory = process.env.NODE_ENV === 'production'
+  var assetsSubDirectory = process.env.NODE_ENV != 'development'
     ? config.build.assetsSubDirectory
     : config.dev.assetsSubDirectory
   return path.posix.join(assetsSubDirectory, _path)
@@ -28,7 +28,12 @@ exports.cssLoaders = function (options) {
     // Extract CSS when that option is specified
     // (which is the case during production build)
     if (options.extract) {
-      return ExtractTextPlugin.extract('vue-style-loader', sourceLoader)
+      return ExtractTextPlugin.extract({
+        use: sourceLoader,
+        fallback: 'vue-style-loader',
+        publicPath:'../../'
+      })
+      // return ExtractTextPlugin.extract('vue-style-loader', sourceLoader)
     } else {
       return ['vue-style-loader', sourceLoader].join('!')
     }

+ 2 - 2
build/webpack.base.conf.js

@@ -7,7 +7,7 @@ var env = process.env.NODE_ENV
 // check env & config/index.js to decide weither to enable CSS Sourcemaps for the
 // various preprocessor loaders added to vue-loader at the end of this file
 var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
-var cssSourceMapProd = (env === 'production' && config.build.productionSourceMap)
+var cssSourceMapProd = (env != 'development' && config.build.productionSourceMap)
 var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
 var ExtractPlugin = require('extract-text-webpack-plugin');
 module.exports = {
@@ -16,7 +16,7 @@ module.exports = {
   },
   output: {
     path: config.build.assetsRoot,
-    publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
+    publicPath: process.env.NODE_ENV != 'development' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
     filename: '[name].js'
   },
   resolve: {

+ 1 - 1
config/prod.env.js

@@ -1,3 +1,3 @@
 module.exports = {
-  NODE_ENV: '"production"'
+  NODE_ENV: JSON.stringify(process.env.NODE_ENV)
 }

+ 9 - 4
package-lock.json

@@ -4795,7 +4795,8 @@
         "ansi-regex": {
           "version": "2.1.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "aproba": {
           "version": "1.2.0",
@@ -5210,7 +5211,8 @@
         "safe-buffer": {
           "version": "5.1.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "safer-buffer": {
           "version": "2.1.2",
@@ -5266,6 +5268,7 @@
           "version": "3.0.1",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "ansi-regex": "^2.0.0"
           }
@@ -5309,12 +5312,14 @@
         "wrappy": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "yallist": {
           "version": "3.0.2",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         }
       }
     },

+ 6 - 3
package.json

@@ -2,11 +2,14 @@
   "name": "h5maker",
   "version": "1.0.0",
   "description": "h5编辑器",
-  "author": "郑国榕 <zhengguorong@bluemoon.com.cn>",
+  "author": "",
   "private": true,
   "scripts": {
-    "build": "node build/build.js",
-    "webapp": "node build/dev-server.js"
+    "dev": "cross-env NODE_ENV=development node build/dev-server.js",
+    "build": "cross-env NODE_ENV=production node build/build.js",
+    "prod": "cross-env NODE_ENV=production node build/build.js",
+    "test": "cross-env NODE_ENV=test node build/build.js",
+    "uat": "cross-env NODE_ENV=uat node build/build.js"
   },
   "dependencies": {
     "acorn": "^5.1.1",

+ 16 - 14
src/util/appConst.js

@@ -1,23 +1,25 @@
-
-let BACKEND_DOMAIN = 'http://106.15.201.221:9998'
-let QINIU_DOMAIN = 'https://dm-api.elab-plus.cn'
-let TOUFANGBAO_PATH = 'http://h5test.elab-plus.com/touFangBao/#/pages/preview?mgid='
-let DIAOYANBAO_PATH = 'http://192.168.4.249:8080/#/preview?mgid='
-if (process.env.NODE_ENV === 'production') {
-  //生产PROD
-  // BACKEND_DOMAIN = 'https://engine.elab-plus.cn'
-  // QINIU_DOMAIN = 'https://dm-api.elab-plus.cn'
-  // TOUFANGBAO_PATH = 'https://dm-mng.elab-plus.cn/touFangBao/#/pages/preview?mgid='
+console.log('process.env.NODE_ENV'+process.env.NODE_ENV)
+let BACKEND_DOMAIN = '';
+let QINIU_DOMAIN = '';
+let DIAOYANBAO_PATH = '';
+if (process.env.NODE_ENV === 'test') {
   //测试
-  BACKEND_DOMAIN = 'http://106.15.201.221:9998'
+  BACKEND_DOMAIN = 'http://gatewaytest.elab-plus.com/elab-diaoyanbao/'
   QINIU_DOMAIN = 'https://gatewaytest.elab-plus.com'
-  TOUFANGBAO_PATH = 'http://h5test.elab-plus.com/touFangBao/#/pages/preview?mgid='
+  DIAOYANBAO_PATH = 'http://h5test.elab-plus.com/diaoyanbao/#/preview?mgid='
+} else if (process.env.NODE_ENV === 'development') {//开发
+  BACKEND_DOMAIN = 'http://192.168.0.16:5318'
+  // QINIU_DOMAIN = 'http://139.196.5.59:5555'
   DIAOYANBAO_PATH = 'http://192.168.4.249:8080/#/preview?mgid='
-} else if (process.env.NODE_ENV === 'development') {
+}else if (process.env.NODE_ENV === 'uat') {//UAT
   BACKEND_DOMAIN = 'http://192.168.0.16:5318'
   // QINIU_DOMAIN = 'http://139.196.5.59:5555'
-  TOUFANGBAO_PATH = 'http://192.168.4.240:9099/#/pages/preview?mgid='
   DIAOYANBAO_PATH = 'http://192.168.4.249:8080/#/preview?mgid='
+}else{//PROD
+  //生产PROD
+  // BACKEND_DOMAIN = 'https://engine.elab-plus.cn'
+  // QINIU_DOMAIN = 'https://dm-api.elab-plus.cn'
+  // TOUFANGBAO_PATH = 'https://dm-mng.elab-plus.cn/touFangBao/#/pages/preview?mgid='
 }
 export default {
   BACKEND_DOMAIN,