Commit 41449a11 authored by caimeng's avatar caimeng

修改ajax文件,根据环境变量读取

parent 5b124f15
NODE_ENV=development NODE_ENV=development
VUE_APP_ENV=development VUE_APP_ENV=development
VUE_APP_API=http://47.99.245.36:8202
NODE_ENV=production
VUE_APP_ENV=production
VUE_APP_API=https://drwater.dingrongxd.com
NODE_ENV=production NODE_ENV=production
VUE_APP_ENV=production VUE_APP_ENV=production
VUE_APP_API=https://water.jqtianxia.com
NODE_ENV=production NODE_ENV=production
VUE_APP_ENV=test VUE_APP_ENV=test
VUE_APP_API=http://47.99.245.36:8202
...@@ -76,7 +76,10 @@ npm run serve ...@@ -76,7 +76,10 @@ npm run serve
# 编译打包测试,读取.env.test环境配置 # 编译打包测试,读取.env.test环境配置
npm run build:test npm run build:test
# 编译打包生产,读取.env.production环境配置 # 编译打包到鼎荣,读取.env.dr环境配置
npm run build:dr
# 编译打包到金钱,读取.env.production环境配置
npm run build:prod npm run build:prod
``` ```
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build:test": "vue-cli-service build --mode test", "build:test": "vue-cli-service build --mode test",
"build:dr": "vue-cli-service build --mode dr --modern",
"build:prod": "vue-cli-service build --mode production --modern" "build:prod": "vue-cli-service build --mode production --modern"
}, },
"dependencies": { "dependencies": {
......
...@@ -13,13 +13,13 @@ ...@@ -13,13 +13,13 @@
//window.APIHOST = "http://192.168.0.50:8202"; //window.APIHOST = "http://192.168.0.50:8202";
//测试 //测试
// window.APIHOST = "http://47.99.245.36:8202"; window.APIHOST = "http://47.99.245.36:8202";
//生产环境 //生产环境
//window.APIHOST = "https://water.jqtianxia.com"; //window.APIHOST = "https://water.jqtianxia.com";
//鼎荣小贷 //鼎荣小贷
window.APIHOST = "https://drwater.dingrongxd.com"; //window.APIHOST = "https://drwater.dingrongxd.com";
</script> </script>
</head> </head>
......
...@@ -6,7 +6,7 @@ import qs from 'qs' ...@@ -6,7 +6,7 @@ import qs from 'qs'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
/** 测试环境 */ /** 测试环境 */
axios.defaults.baseURL = window.APIHOST axios.defaults.baseURL = process.env.VUE_APP_API;
/* 所有ajax请求拦截 */ /* 所有ajax请求拦截 */
axios.interceptors.request.use(function (req) { axios.interceptors.request.use(function (req) {
const token = Cookies.get('x-auth-token') const token = Cookies.get('x-auth-token')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment