diff --git a/.env.development b/.env.development index d1fa61c..f6b0e29 100644 --- a/.env.development +++ b/.env.development @@ -1,15 +1,15 @@ # 页面标题 VUE_APP_TITLE = 上动新能源-EMS管理系统 -# 开发环境配置 -ENV = 'development' -NODE_ENV = development - -# EMS管理系统/开发环境 -VUE_APP_BASE_API = '/dev-api' - # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true +# 开发环境配置 +NODE_ENV = 'development' + +# EMS管理系统/开发环境 +VUE_APP_BASE_API = '/dev-api' + # EMS管理系统/开发环境 图片拼接地址 -VUE_APP_IMG_URL = '/dev-api' \ No newline at end of file +VUE_APP_IMG_URL = '/dev-api' + diff --git a/.env.production b/.env.production index 949f393..8539535 100644 --- a/.env.production +++ b/.env.production @@ -2,11 +2,11 @@ VUE_APP_TITLE = 上动新能源-EMS管理系统 # 生产环境配置 -ENV = 'production' -NODE_ENV = production +NODE_ENV = 'production' # EMS管理系统/生产环境 -VUE_APP_BASE_API = '/dev-api' +VUE_APP_BASE_API= 'http://1.15.120.242:8089' # EMS管理系统/生产环境 图片拼接地址 -VUE_APP_IMG_URL = 'http://1.15.120.242:8089 \ No newline at end of file +VUE_APP_IMG_URL = 'http://1.15.120.242:8089' + diff --git a/.env.staging b/.env.staging index 6bfa0a2..90d0468 100644 --- a/.env.staging +++ b/.env.staging @@ -2,8 +2,11 @@ VUE_APP_TITLE = 上动新能源-EMS管理系统 # 测试环境配置 -ENV = 'staging' -NODE_ENV = staging +NODE_ENV = 'staging' + +# EMS管理系统/测试环境 +VUE_APP_BASE_API= 'http://110.40.171.179:8089' + +# EMS管理系统/测试环境 图片拼接地址 +VUE_APP_IMG_URL = 'http://110.40.171.179:8089' -# EMS管理系统/生产环境 图片拼接地址 -VUE_APP_IMG_URL = 'http://110.40.171.179:8089' \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index 9cfe62f..bab4273 100644 --- a/vue.config.js +++ b/vue.config.js @@ -9,8 +9,6 @@ const CompressionPlugin = require('compression-webpack-plugin') const name = process.env.VUE_APP_TITLE || 'EMS管理系统' // 网页标题 -const baseUrl = 'http://110.40.171.179:8089' // 后端接口 - const port = process.env.port || process.env.npm_config_port || 80 // 端口 // vue.config.js 配置说明 @@ -34,19 +32,27 @@ module.exports = { port: port, open: true, proxy: { - // detail: https://cli.vuejs.org/config/#devserver-proxy - [process.env.VUE_APP_BASE_API]: { - target: baseUrl, + // // detail: https://cli.vuejs.org/config/#devserver-proxy + // [process.env.VUE_APP_BASE_API]: { + // target: baseUrl, + // changeOrigin: true, + // pathRewrite: { + // ['^' + process.env.VUE_APP_BASE_API]: '' + // } + // }, + // // springdoc proxy + // '^/v3/api-docs/(.*)': { + // target: baseUrl, + // changeOrigin: true + // } + // 当请求前缀是/dev-api时,使用下面的代理 + '/dev-api': { + target: 'http://110.40.171.179:8089', changeOrigin: true, pathRewrite: { - ['^' + process.env.VUE_APP_BASE_API]: '' + '^/dev-api': '' } }, - // springdoc proxy - '^/v3/api-docs/(.*)': { - target: baseUrl, - changeOrigin: true - } }, disableHostCheck: true },