diff --git a/.env.development b/.env.development
index dbfe06ef..3c9afa97 100644
--- a/.env.development
+++ b/.env.development
@@ -7,7 +7,7 @@ VUE_APP_TITLE = '曲阳金隅安全智能管控平台'
# 接口地址
#VUE_APP_API_BASEURL = http://1.203.161.103:2800/api
#VUE_APP_WS_API = 'ws://localhost:8000'
-VUE_APP_API_BASEURL = http://10.99.5.79:20309/api
+VUE_APP_API_BASEURL = http://222.222.144.147:6013/api
#VUE_APP_API_BASEURL = http://127.0.0.1:8000/api
#VUE_APP_BASEURL = http://127.0.0.1:8000
diff --git a/public/index.html b/public/index.html
index f7bf6def..c51d91dd 100644
--- a/public/index.html
+++ b/public/index.html
@@ -26,7 +26,7 @@
let urls = window.location.host;
window.IPConfig = {
//此处的IP在打包不会被编译,可修改
- baseURL: urls+'/api'
+ baseURL: 'http://' + urls+'/api'
}
diff --git a/src/config/index.js b/src/config/index.js
index 7d394544..30a994c4 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -13,7 +13,7 @@ const DEFAULT_CONFIG = {
//接口地址
// API_URL: process.env.NODE_ENV === 'development' && process.env.VUE_APP_PROXY === 'false' ? "/api" : process.env.VUE_APP_API_BASEURL,
- API_URL: window.IPConfig.baseURL.indexOf('localhost')>-1? "http://10.99.5.79:20309/api" : window.IPConfig.baseURL,
+ API_URL: get_api_url(),
//请求超时
TIMEOUT: 200000,
@@ -28,7 +28,7 @@ const DEFAULT_CONFIG = {
HEADERS: {},
//视频地址
- VUE_APP_VIDEOHOST : '10.99.5.24',
+ VUE_APP_VIDEOHOST: '10.99.5.24',
//请求是否开启缓存
REQUEST_CACHE: false,
@@ -66,14 +66,19 @@ const DEFAULT_CONFIG = {
copmsList: [
['ticket'],
['eventlist'],
-
+
]
}
}
-
+function get_api_url(){
+ if(process.env.NODE_ENV === 'development' || (process.env.NODE_ENV === 'production' && window.location.host.indexOf('localhost') > -1)){
+ return process.env.VUE_APP_API_BASEURL
+ }
+ return 'http://' + window.location.host + '/api'
+}
// 如果生产模式,就合并动态的APP_CONFIG
// public/config.js
-if(process.env.NODE_ENV === 'production'){
+if (process.env.NODE_ENV === 'production') {
Object.assign(DEFAULT_CONFIG, APP_CONFIG)
}
diff --git a/src/utils/request.js b/src/utils/request.js
index f9737dc5..ec3efde0 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -4,7 +4,7 @@ import sysConfig from "@/config";
import tool from '@/utils/tool';
import router from '@/router';
-axios.defaults.baseURL = window.IPConfig.baseURL;
+axios.defaults.baseURL = sysConfig.API_URL;
axios.defaults.timeout = sysConfig.TIMEOUT
diff --git a/src/views/am/audio.vue b/src/views/am/audio.vue
index 3162843e..8355753a 100644
--- a/src/views/am/audio.vue
+++ b/src/views/am/audio.vue
@@ -33,7 +33,7 @@
- {{ scope.row.extra.config.sn }}
+ {{ scope.row.extra.config.sn }}
@@ -62,7 +62,7 @@
+ :channelLocation="channelLocation" @closed="dialogSave = false" @success="handleQuery">