diff --git a/.env.development b/.env.development index e7a976f0..643cfc8e 100644 --- a/.env.development +++ b/.env.development @@ -11,6 +11,6 @@ VUE_CLI_BABEL_TRANSPILE_MODULES = true port= 9988 # 服务端地址 - target = http://192.168.18.134:8899 - //target = http://192.168.18.139:8899 + //target = http://192.168.18.134:8899 +target = http://192.168.18.139:8899 // target = http://192.168.18.136:8899 diff --git a/package.json b/package.json index fadbe859..c4f5beb8 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,8 @@ "@vue/cli-service": "4.4.6", "babel-eslint": "10.1.0", "chalk": "4.1.0", + "node-sass": "^4.9.0", + "sass-loader": "^7.0.1", "connect": "3.6.6", "eslint": "7.15.0", "eslint-plugin-vue": "7.2.0", diff --git a/src/config/env.js b/public/config/env.js similarity index 68% rename from src/config/env.js rename to public/config/env.js index 7dd81821..69031fe1 100644 --- a/src/config/env.js +++ b/public/config/env.js @@ -1,7 +1,6 @@ const env = process.env // 项目url 地址 -var iotPlatformUrl = ''; // 第三方云平台url -var iotHost="192.168.18.139"; // 海创iot 平台 host +var iotPlatformUrl = ''; // 第三方云平台ur // iot.gkiiot.com 192.168.18.139 var flowIotUrl = ''; let iotWebSocketBaseUrl = '' @@ -9,19 +8,26 @@ let devLiveWebSocketBaseUrl = '' let sysWebSocket = 'ws://' let prodApi = '/prod-api'; let wsProtocol = 'ws://'; -var hrefHost = window.location.host; -let iotWebSocketAlarmBaseUrl = ''; -let httpProtocol = window.location.protocol; +let iotWebSocketAlarmBaseUrl = '' +let BaseUrl = '' + +// 手动配置的地址 +var iotHost="192.168.18.139:8899"; // 海创iot 平台 host +// var hrefHost = window.location.host; +// let httpProtocol = window.location.protocol; +var hrefHost = '192.168.18.139'; +let httpProtocol = 'http'; if (env.NODE_ENV == 'development') { flowIotUrl = 'http://127.0.0.1:1880/#flow/' - iotHost = '192.168.18.139'; hrefHost = "192.168.18.139" + BaseUrl = '/dev-api' } else if(env.NODE_ENV == 'production') { // if (hrefHost.indexOf('.gkiiot.com') >= 0) { // iotHost = 'iot.gkiiot.com' // } + BaseUrl = httpProtocol + '//' + iotHost + prodApi if(httpProtocol.indexOf("https") > -1){ sysWebSocket = 'wss://'; } @@ -38,5 +44,7 @@ export { sysWebSocket, iotWebSocketBaseUrl, iotWebSocketAlarmBaseUrl, - devLiveWebSocketBaseUrl + devLiveWebSocketBaseUrl, + BaseUrl, + prodApi } diff --git a/src/api/thirdApi.js b/src/api/thirdApi.js index ac14e7ed..020b15db 100644 --- a/src/api/thirdApi.js +++ b/src/api/thirdApi.js @@ -1,5 +1,5 @@ import axios from "axios"; -import { iotPlatformUrl } from '@/config/env' +import { iotPlatformUrl } from '/public/config/env' import { getDevcieApp } from "@/api/app"; var appInfo = {} diff --git a/src/utils/request.js b/src/utils/request.js index cfa194c7..c7b33c3f 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -4,12 +4,13 @@ import store from '@/store' import { getToken } from '@/utils/auth' import errorCode from '@/utils/errorCode' import { preventCloseFu } from "@/utils/hciot"; +import { BaseUrl } from '/public/config/env' axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' // 创建axios实例 const service = axios.create({ // axios中请求配置有baseURL选项,表示请求URL公共部分 - baseURL: process.env.VUE_APP_BASE_API, + baseURL: BaseUrl, // 超时 timeout: 10000 }) diff --git a/src/views/bigScreen/v1/index.vue b/src/views/bigScreen/v1/index.vue index 888ba359..53bad8f2 100644 --- a/src/views/bigScreen/v1/index.vue +++ b/src/views/bigScreen/v1/index.vue @@ -68,7 +68,7 @@ import TypeDistributionWrap from "./profile/typeDistribution"; import trendWrap from "./profile/trend"; import MapWrap from "./profile/mapWrap"; import MapWrapPersonal from "./profile/personalCenter"; -import { iotWebSocketAlarmBaseUrl } from "@/config/env"; +import { iotWebSocketAlarmBaseUrl } from "/public/config/env"; import { getWarningAnalysis, homeCount, appProjectList } from "@/api/app"; export default { diff --git a/src/views/bigScreen/v2/index.vue b/src/views/bigScreen/v2/index.vue index 80ae691a..23e56cdf 100644 --- a/src/views/bigScreen/v2/index.vue +++ b/src/views/bigScreen/v2/index.vue @@ -68,7 +68,7 @@ import TypeDistributionWrap from "./profile/typeDistribution"; import trendWrap from "./profile/trend"; import MapWrap from "./profile/mapWrap"; import MapWrapPersonal from "./profile/personalCenter"; -import { iotWebSocketAlarmBaseUrl } from "@/config/env"; +import { iotWebSocketAlarmBaseUrl } from "/public/config/env"; import { getWarningAnalysis, homeCount, appProjectList } from "@/api/app"; export default { diff --git a/src/views/bigScreen/v3/index.vue b/src/views/bigScreen/v3/index.vue index f676a2fc..a5745896 100644 --- a/src/views/bigScreen/v3/index.vue +++ b/src/views/bigScreen/v3/index.vue @@ -81,7 +81,7 @@ import TypeDistributionWrap from "./profile/typeDistribution"; import trendWrap from "./profile/trend"; import MapWrap from "./profile/mapWrap"; import MapWrapPersonal from "./profile/personalCenter"; -import { iotWebSocketAlarmBaseUrl } from "@/config/env"; +import { iotWebSocketAlarmBaseUrl } from "/public/config/env"; import Cookies from "js-cookie"; import { NextLoading } from '@/utils/loading'; diff --git a/src/views/iot/autocontrol/job/profile/deviceParam.vue b/src/views/iot/autocontrol/job/profile/deviceParam.vue index 9d3cdf8b..c78ad730 100644 --- a/src/views/iot/autocontrol/job/profile/deviceParam.vue +++ b/src/views/iot/autocontrol/job/profile/deviceParam.vue @@ -129,7 +129,7 @@ import SelectTableWrap from "@/components/SelectTable/index"; import axios from "axios"; import { getToken } from "@/utils/auth"; -import { basePlatformUrl } from '@/config/env' +import { basePlatformUrl } from '/public/config/env' import { getDeviceFunList, getDeviceCmdList } from "@/api/iot/device"; diff --git a/src/views/iot/device/profile/details.vue b/src/views/iot/device/profile/details.vue index adc4e19d..9bb0613c 100644 --- a/src/views/iot/device/profile/details.vue +++ b/src/views/iot/device/profile/details.vue @@ -66,7 +66,7 @@ import InfoWrap from "./info"; import ChildDevice from "./childDevice"; import DeviceLog from "@/views/profile/DeviceDetailsView/deviceLog"; import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index"; -import { iotWebSocketBaseUrl } from "@/config/env"; +import { iotWebSocketBaseUrl } from "/public/config/env"; import TriggerWrap from "@/views/profile/DeviceTrigger/index"; export default { name: "DetailsWrap", diff --git a/src/views/personal/device/profile/details.vue b/src/views/personal/device/profile/details.vue index dbe4e75a..8062b9dd 100644 --- a/src/views/personal/device/profile/details.vue +++ b/src/views/personal/device/profile/details.vue @@ -59,7 +59,7 @@ import InfoWrap from "./info"; import DeviceLog from "@/views/profile/DeviceDetailsView/deviceLog"; import ChildDevice from "./childDevice"; import DeviceRunStartsWrap from "@/views/profile/DeviceRunStarts/index"; -import { iotWebSocketBaseUrl } from "@/config/env"; +import { iotWebSocketBaseUrl } from "/public/config/env"; export default { name: "DetailsWrap", props: ["sourceId"], diff --git a/src/views/personal/device/profile/runStarts.vue b/src/views/personal/device/profile/runStarts.vue index c286461e..967666be 100644 --- a/src/views/personal/device/profile/runStarts.vue +++ b/src/views/personal/device/profile/runStarts.vue @@ -67,7 +67,7 @@