整理环境分支问题

This commit is contained in:
皮伟
2019-10-29 15:16:41 +08:00
parent d5a4cbc476
commit 998135fd1f
8 changed files with 48 additions and 29 deletions

View File

@@ -2,4 +2,6 @@
NODE_ENV = 'production'
# flag
VUE_APP_FLAG='staging'
VUE_APP_FLAG='prd'

View File

@@ -2,6 +2,6 @@
NODE_ENV = 'production'
# flag
VUE_APP_FLAG='production'
VUE_APP_FLAG='uat'

5
.env.dat Normal file
View File

@@ -0,0 +1,5 @@
# env
NODE_ENV = 'production'
# flag
VUE_APP_FLAG='dat'

View File

@@ -2,6 +2,6 @@
NODE_ENV = 'development'
# flag
VUE_APP_FLAG='development'
VUE_APP_FLAG='dev'

View File

@@ -1,7 +0,0 @@
# env 用于前端dev环境发布。与.env.development的区别NODE_ENV = production开启代码压缩
NODE_ENV = 'production'
# flag
VUE_APP_FLAG='development'

View File

@@ -6,9 +6,14 @@
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build:dev": "vue-cli-service build --mode development-deploy",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"build:dev": "vue-cli-service build --mode dev",
"build:prd": "vue-cli-service build --mode prd",
"build:uat": "vue-cli-service build --mode uat",
"build:dat": "vue-cli-service build --mode dat",
"dev": "vue-cli-service serve --mode dev",
"dat": "vue-cli-service serve --mode dat",
"uat": "vue-cli-service serve --mode uat",
"prd": "vue-cli-service serve --mode prd",
"lint": "vue-cli-service lint",
"lint:fix": "eslint --fix --ext .js,.vue src",
"format": "prettier --config ./.prettierrc --write \"src/**/*.js\" \"src/**/*.vue\"",
@@ -50,4 +55,4 @@
"sass-loader": "^7.1.0",
"vue-template-compiler": "^2.6.10"
}
}
}

View File

@@ -10,7 +10,7 @@ let apiDomain, imgDomain, assetsUrl, mainUrl, payUrl // 保融支付的收银台
// 可以多个接口域名,按需添加
console.log('环境:', process.env.VUE_APP_FLAG)
switch (process.env.VUE_APP_FLAG) {
case 'development':
case 'dev':
// apiDomain = 'http://47.96.143.111:7000/api/v1'
apiDomain = 'http://139.199.50.151:7000/api/v1' // 国富api
// imgDomain = 'http://10.10.100.98:7012/updown' // dev
@@ -21,15 +21,15 @@ switch (process.env.VUE_APP_FLAG) {
mainUrl = 'http://139.199.50.151'
payUrl = 'http://10.10.100.84:7003/s3-modules-gateway/embed/gateway.action'
break
case 'staging':
apiDomain = 'http://47.96.143.111:7000/api/v1'
imgDomain = 'http://211.159.248.123:7001'
case 'uat':
apiDomain = ''
imgDomain = ''
// 静态服务资源
assetsUrl = 'http://47.96.143.111:8000/app/'
assetsUrl = ''
mainUrl = ''
payUrl = 'http://10.10.100.84:7003/s3-modules-gateway/embed/gateway.action'
payUrl = ''
break
case 'production':
case 'prd':
apiDomain = 'https://iagentsales.e-guofu.com/api/v1'
imgDomain = 'https://iagentsales-ud.e-guofu.com:8553/updown'
// imgDomain = 'http://10.10.100.98:7012/updown' // 上生产前
@@ -39,6 +39,14 @@ switch (process.env.VUE_APP_FLAG) {
mainUrl = 'https://iagentsales.e-guofu.com'
payUrl = 'https://uns3.e-guofu.com/s3-modules-gateway/embed/gateway.action'
break
case 'dat':
apiDomain = ''
imgDomain = ''
// 静态服务资源
assetsUrl = ''
mainUrl = ''
payUrl = ''
break
}
/**
* 配置文件

View File

@@ -51,15 +51,21 @@ Vue.prototype.$jump = Jump
Vue.prototype.$utils = utils
//混合开发调试工具
if (process.env.NODE_ENV == 'development') {
// let Eruda = require('eruda')
// Eruda.init()
Vue.prototype.$rootUrl = location.origin
} else if (process.env.NODE_ENV == 'production') {
Vue.prototype.$rootUrl = location.origin + '/ebiz-h5'
// if (process.env.NODE_ENV == 'development') {
// // let Eruda = require('eruda')
// // Eruda.init()
// Vue.prototype.$rootUrl = location.origin
// } else if (process.env.NODE_ENV == 'production') {
// Vue.prototype.$rootUrl = location.origin + '/ebiz-h5'
// }
if (process.env.VUE_APP_FLAG != 'prd') {
let Eruda = require('eruda')
Eruda.init()
} else {
// Vue.prototype.$rootUrl = location.origin + '/ebiz-h5'
Vue.config.devtools = true
}
let Eruda = require('eruda')
Eruda.init()
// 注册过滤器
Object.keys(Filters).forEach(function(k) {
Vue.filter(k, Filters[k])