Ver Fonte

环境动态配置

wangtao há 1 ano atrás
pai
commit
c14b07b546

+ 28 - 0
.env.development

@@ -0,0 +1,28 @@
+# 开发环境配置
+ENV = 'development'
+
+VUE_APP_BASE_API  = 'https://smartpark.caih.com'
+
+#东信api
+VUE_APP_DX_BASE_API  = 'https://smartpark.caih.com/dxapi'
+
+#中控
+VUE_APP_CONTROL_BASE_API  = 'https://smartpark.caih.com/zkxt'
+
+#设备告警信息
+VUE_APP_DM_BASE_API  = 'https://smartpark.caih.com/dmapi'
+
+#智慧餐饮
+VUE_APP_ZHCY_BASE_API  = 'https://smartpark.caih.com/zhcy'
+
+#一卡通
+VUE_APP_CARD_BASE_API  = 'https://smartpark.caih.com/ykt'
+
+#会议系统
+VUE_APP_HYXT_BASE_API  = 'https://smartpark.caih.com/hyxt'
+
+#设备告警
+VUE_APP_WS_BASE_API  = 'ws://10.21.39.1:8084/dm'
+
+#安防
+VUE_APP_SECU_BASE_API  = 'http://10.21.39.1:8082'

+ 5 - 0
.env.production

@@ -0,0 +1,5 @@
+# 生产环境配置
+ENV = 'production'
+
+VUE_APP_BASE_API  = 'http://10.95.2.31:3099'
+

+ 7 - 0
.env.staging

@@ -0,0 +1,7 @@
+NODE_ENV = production
+
+# just a flag
+ENV = 'staging'
+
+VUE_APP_BASE_API  = 'http://10.95.2.31:3099'
+

+ 2 - 2
src/components/record/equipment/index.vue

@@ -47,7 +47,7 @@ export default {
       // 
       axios({
         method: 'post',
-        url: 'https://smartpark.caih.com/dmapi/tbAlarm/page',
+        url: process.env.VUE_APP_DM_BASE_API+'/tbAlarm/page',
         timeout: 3000,
         data:{
           startTime:YearMonthDate().split(" ")[0] + " 00:00:00",
@@ -65,7 +65,7 @@ export default {
       let that = this
       let num = 0
       if ("WebSocket" in window) {
-				this.ws = new WebSocket("ws://10.21.39.1:8084/dm/alarmPush");
+				this.ws = new WebSocket(process.env.VUE_APP_WS_BASE_API+"/alarmPush");
 				this.ws.onopen = ()=> {
 				// console.log("websocket连接成功");
 				this.sendWs({agentid:'admin'});

+ 1 - 1
src/components/record/equipmentStatus/index.vue

@@ -59,7 +59,7 @@ export default {
         }
       axios({
           method: 'post',
-          url: 'http://10.21.39.1:8082/dhController/getLocalChannel?pageNo=1&pageSize=10&unitType=1&name=1F',
+          url: process.env.VUE_APP_SECU_BASE_API+'/dhController/getLocalChannel?pageNo=1&pageSize=10&unitType=1&name=1F',
           timeout: 3000,
       }).then(res =>{
           if(res.data.data.pageList){

+ 1 - 1
src/components/record/fireControl/index.vue

@@ -30,7 +30,7 @@ export default {
     initData() {
       axios({
             method: 'post',
-            url: 'https://smartpark.caih.com/dmapi/tbAlarm/page',
+            url: process.env.VUE_APP_DM_BASE_API+'/tbAlarm/page',
             data:{
               current: 1,
               size: 100,

+ 1 - 1
src/components/record/flow/index.vue

@@ -51,7 +51,7 @@ export default {
     init(){
       axios({
         method: 'get',
-        url: 'https://smartpark.caih.com/ykt/api/thirdparty/v1/openInterface/yunUserRequest',
+        url: process.env.VUE_APP_CARD_BASE_API+'/api/thirdparty/v1/openInterface/yunUserRequest',
         timeout: 100000,
       }).then(res =>{
           let total = 0

+ 2 - 2
src/components/record/index.vue

@@ -53,7 +53,7 @@ export default {
   mounted() {
     axios({
         method: 'get',
-        url: 'https://smartpark.caih.com/dxapi/system/config/configKey/large.json.config',
+        url: process.env.VUE_APP_DX_BASE_API+'/system/config/configKey/large.json.config',
         timeout: 10000,
     }).then(res =>{
       this.data = JSON.parse(res.data.data)
@@ -61,7 +61,7 @@ export default {
     setInterval(()=>{
       axios({
           method: 'get',
-          url: 'https://smartpark.caih.com/dxapi/system/config/configKey/large.json.config',
+          url: process.env.VUE_APP_DX_BASE_API+'/system/config/configKey/large.json.config',
           timeout: 10000,
       }).then(res =>{
         this.data = JSON.parse(res.data.data)

+ 1 - 1
src/components/record/intrusion/index.vue

@@ -298,7 +298,7 @@ export default {
 // ]
         axios({
             method: 'post',
-            url: 'http://10.21.39.1:8082/PerimeterController/queryPerimeterAlarm',
+            url: process.env.VUE_APP_SECU_BASE_API+'/PerimeterController/queryPerimeterAlarm',
             data:{
                 pageNo: 1,
                 pageSize: 50,

+ 1 - 1
src/components/record/keepWatch/index.vue

@@ -32,7 +32,7 @@ export default {
       
       axios({
             method: 'post',
-            url: 'http://10.21.39.1:8082/pt/queryPatrollingPlanStatus',
+            url: process.env.VUE_APP_SECU_BASE_API+'/pt/queryPatrollingPlanStatus',
             data:{
               pageNo: 1,
               pageSize: 10,

+ 1 - 1
src/components/record/meeting/index.vue

@@ -55,7 +55,7 @@ export default {
     init(){
       axios({
         method: 'get',
-        url: 'https://smartpark.caih.com/hyxt/api/thirdparty/meetingRoom/summary',
+        url: process.env.VUE_APP_HYXT_BASE_API+'/api/thirdparty/meetingRoom/summary',
         timeout: 30000,
       }).then(res =>{
         if(res.data){

+ 1 - 10
src/components/record/parking/index.vue

@@ -58,16 +58,7 @@ export default {
   },
   methods: {
     init(){
-      // axios({
-      //   method: 'get',
-      //   url: 'https://smartpark.caih.com/hyxt/api/thirdparty/meetingRoom/summary',
-      //   timeout: 3000,
-      // }).then(res =>{
-      //   if(res.data){
-      //     this.data = res.data
-      //   }
-      // }).catch(err =>{
-      // })
+     
     },
     
   },

+ 2 - 22
src/components/record/restaurant/index copy.vue

@@ -85,34 +85,14 @@ export default {
     init(){
       axios({
         method: 'get',
-        url: 'https://smartpark.caih.com/zhcy/api/thirdparty/v1/open/getCanYinData',
+        url: process.env.VUE_APP_ZHCY_BASE_API+'/api/thirdparty/v1/open/getCanYinData',
         timeout: 100000,
       }).then(res =>{
         this.data = res.data.data
           console.log(res.data.data)
       }).catch(err =>{
       })
-      // axios.post(`https://smartpark.caih.com/ykt/api/thirdparty/v1/open/getCanYinData`, 
-      //   {
-      //     "nonce": Cookies.get("nonce58"),
-      //     "timestamp": Cookies.get("timestamp58"),
-      //     "query": {
-      //       "userNumber":Cookies.get("userId58"),
-      //     }
-      //   },
-      //   {headers: {
-      //       "XYTACCESSTOKEN":Cookies.get("token58")
-      //     }
-      //   }).then(res => {
-      //       if(res?.data?.data?.content){
-      //         this.adminList1 = res.data.data.content.slice(0,5)
-      //         this.loading1 = false
-      //       }else{
-      //         this.loading1 = false
-      //       }
-      //     }).catch(err =>{
-      //       Toast(err.response.data.message)
-      //   })
+      
 
     }
 

+ 1 - 1
src/components/record/restaurant/index.vue

@@ -63,7 +63,7 @@ export default {
       this.loading = true
       axios({
         method: 'get',
-        url: 'https://smartpark.caih.com/zhcy/api/thirdparty/v1/open/getCanYinData',
+        url: process.env.VUE_APP_ZHCY_BASE_API+'/api/thirdparty/v1/open/getCanYinData',
         timeout: 3000,
       }).then(res =>{
         this.data = res.data.data

+ 1 - 1
src/components/record/videoSS/index.vue

@@ -288,7 +288,7 @@ export default {
       
         axios({
             method: 'post',
-            url: 'http://10.21.39.1:8082/dhController/getLocalChannel',
+            url: process.env.VUE_APP_SECU_BASE_API+'/dhController/getLocalChannel',
             data:{
                 pageNo: 1,
                 pageSize: 300,

+ 1 - 1
src/components/weather/index.vue

@@ -56,7 +56,7 @@ export default {
     initData() {
       axios({
             method: 'get',
-            url: 'https://smartpark.caih.com/dxapi/aliWeather?area=南宁',
+            url: process.env.VUE_APP_DX_BASE_API+'/aliWeather?area=南宁',
             timeout: 3000,
         }).then(res =>{
             this.data = res.data.showapi_res_body.now

+ 1 - 1
src/plugins/axios.js

@@ -5,7 +5,7 @@ import axios from "axios";
 // Full config:  https://github.com/axios/axios#request-config
 
 //axios.defaults.baseURL = 'http://172.16.120.104:8085/'; //本地
-axios.defaults.baseURL = 'https://smartpark.caih.com/dxapi'; //东信部署
+axios.defaults.baseURL = process.env.VUE_APP_DX_BASE_API; //东信部署
 // axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || '';
 // axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
 // axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

+ 2 - 2
src/views/index/index.vue

@@ -54,7 +54,7 @@ export default {
         if(this.$route.query.passWord  && this.$route.query.userName ){
           let userName = decrypt(this.$route.query.userName)
           let passWord = decrypt(this.$route.query.passWord)
-          axios.get(`https://smartpark.caih.com/zkxt/api/thirdparty/v1/user/appLogin?name=${userName}&pass=${passWord}`).then(res => {
+          axios.get(`${process.env.VUE_APP_CONTROL_BASE_API}/api/thirdparty/v1/user/appLogin?name=${userName}&pass=${passWord}`).then(res => {
             if (res?.data?.data?.data?.cipher) {
               let data = res.data.data.data
               //人员种类(00-正式人员、01-外协单位、02-租户)
@@ -100,7 +100,7 @@ export default {
         let token = Cookies.get("tokenMT")
         axios({//查询信息
           method: 'get',
-          url: 'https://smartpark.caih.com/zkxt/api/thirdparty/v1/user/getZkUserByCipher?cipher=' + token,
+          url: process.env.VUE_APP_CONTROL_BASE_API+'/api/thirdparty/v1/user/getZkUserByCipher?cipher=' + token,
           timeout: 10000,
         }).then(res =>{
           if(res.data?.data?.id){

+ 1 - 1
src/views/login/index.vue

@@ -147,7 +147,7 @@ export default {
         this.$refs.loginForm.validate(valid => {
         if (valid) {
           this.loading = true;
-          axios.get(`https://smartpark.caih.com/zkxt/api/thirdparty/v1/user/appLogin?name=${this.loginForm.username}&pass=${this.loginForm.password}`).then(res => {
+          axios.get(`${process.env.VUE_APP_CONTROL_BASE_API}/api/thirdparty/v1/user/appLogin?name=${this.loginForm.username}&pass=${this.loginForm.password}`).then(res => {
             if (res?.data?.data?.data?.cipher) {
               let data = res.data.data.data
               //人员种类(00-正式人员、01-外协单位、02-租户)

+ 11 - 11
vue.config.js

@@ -41,17 +41,17 @@ module.exports = {
         // https: false, // https:{type:Boolean}
         open: true, // 配置自动启动浏览器
         hotOnly: true, // 热更新
-        proxy: {
-            // 配置多个跨域
-            '/': {
-                target: 'https://smartpark.caih.com/dxapi/', //东信
-                //target: 'http://172.16.120.104:8085/', //本地
-                changeOrigin: false,
-                pathRewrite: {
-                    '': '/'
-                }
-            }
-        },
+        // proxy: {
+        //     // 配置多个跨域
+        //     '/': {
+        //         target: ', //
+        //         //target: '', //
+        //         changeOrigin: false,
+        //         pathRewrite: {
+        //             '': '/'
+        //         }
+        //     }
+        // },
         headers: {
             'Access-Control-Allow-Origin': '*',
         }