chengjunhui il y a 3 semaines
Parent
commit
50c9e06570
5 fichiers modifiés avec 43 ajouts et 32 suppressions
  1. 8 7
      src/api/home.js
  2. 2 1
      src/store/index.js
  3. 6 0
      src/utils/config.js
  4. 3 3
      src/views/OrderDetails.vue
  5. 24 21
      vue.config.js

+ 8 - 7
src/api/home.js

@@ -1,9 +1,10 @@
 import request from '@/utils/request';
+import config from '@/utils/config'
 
 // 获取自己的票据订单详细信息(订单编号)
 export function orderInfo(orderNo) {
     return request({
-        url: `/api/ticket/order/detail/${orderNo}`,
+        url: `${config.baseURL}/ticket/order/detail/${orderNo}`,
         method: 'get'
     })
 }
@@ -11,7 +12,7 @@ export function orderInfo(orderNo) {
 // 起飞
 export function flightTakeOff(data) {
     return request({
-        url: `/prod-api/api/flight/queue/takeOff`,
+        url: `${config.baseURL1}/flight/queue/takeOff`,
         method: 'post',
         data
     })
@@ -20,7 +21,7 @@ export function flightTakeOff(data) {
 // 开始排队
 export function flightStart(data) {
     return request({
-        url: `/prod-api/api/flight/queue/start`,
+        url: `${config.baseURL1}/flight/queue/start`,
         method: 'post',
         data
     })
@@ -29,7 +30,7 @@ export function flightStart(data) {
 // 取消排队
 export function flightCancelt(data) {
     return request({
-        url: `/prod-api/api/flight/queue/cancel`,
+        url: `${config.baseURL1}/flight/queue/cancel`,
         method: 'post',
         data
     })
@@ -38,7 +39,7 @@ export function flightCancelt(data) {
 // 查看排队信息
 export function flightListAll(params) {
     return request({
-        url: `/prod-api/api/flight/queue/list-all`,
+        url: `${config.baseURL1}/flight/queue/list-all`,
         method: 'get',
         params
     })
@@ -47,7 +48,7 @@ export function flightListAll(params) {
 // 获取详情无人机飞行任务
 export function getDroneFlightTask(params) {
     return request({
-        url: `/api/drone/getDroneFlightTask/${params.flightTaskUuid}`,
+        url: `${config.baseURL}/drone/getDroneFlightTask/${params.flightTaskUuid}`,
         method: 'get',
         params
     })
@@ -56,7 +57,7 @@ export function getDroneFlightTask(params) {
 // 根据排队ID获取详情无人机飞行任务
 export function getDroneFlightTaskByQueueId(params) {
     return request({
-        url: `/api/drone/getDroneFlightTaskByQueueId/${params.queueId}`,
+        url: `${config.baseURL}/drone/getDroneFlightTaskByQueueId/${params.queueId}`,
         method: 'get',
         params
     })

+ 2 - 1
src/store/index.js

@@ -2,6 +2,7 @@ import Vue from 'vue'
 import Vuex from 'vuex'
 import WebSocketUtil from '@/utils/WebSocketUtil';
 import { Toast, Dialog } from 'vant';
+import config from '@/utils/config'
 Vue.use(Vuex)
 
 export default new Vuex.Store({
@@ -13,7 +14,7 @@ export default new Vuex.Store({
     apiToken: "",
     webSocket: WebSocketUtil,
     // wsUrl: "ws://192.168.0.19:9002/socket/flight",
-    wsUrl: "ws://192.168.0.151:9002/socket/flight",
+    wsUrl: config.socketUrl,
     userId: '',  // 用户名称
     orderInfo: null, // 订单信息
     flightTaskUuid: '', // 无人机飞行任务id

+ 6 - 0
src/utils/config.js

@@ -0,0 +1,6 @@
+export default {
+    baseURL: "http://192.168.0.151:9001/api",  // 普通数据接口
+    baseURL1: "http://192.168.0.151:9002/api",  // 起飞排队数据接口
+    socketUrl: "ws://192.168.0.151:9002/socket/flight",  // socket连接地址
+
+}

+ 3 - 3
src/views/OrderDetails.vue

@@ -378,9 +378,9 @@ export default {
           this.takeOffObj = res.data;
           // console.log(show);
           if (show) {
-            if (res.data.takenOffStatus) {
-              this.getDroneFlightTaskByQueueId(res.data.queueId)
-            }
+            // if (res.data.takenOffStatus) {
+            //   this.getDroneFlightTaskByQueueId(res.data.queueId)
+            // }
             // console.log("开始执行");
             this.$nextTick(() => {
               this.$store.dispatch("initWebSocketUtil");

+ 24 - 21
vue.config.js

@@ -16,29 +16,32 @@ module.exports = defineConfig({
     host: '0.0.0.0',
     port: '8080',
     open: true,
+    client: {
+      overlay: false
+    },
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
-      "/prod-api": {
-        target: `http://192.168.0.151:9002`,
-        // target: `http://192.168.0.19:9002`,
-        // target: `http://192.168.0.78:9002`,
-        // target: `https://test.yuemeikang.com/prod-api`,  // 测试环境
-        // target: `https://app.yuemeikang.com/prod-api`,  // 正式环境
-        changeOrigin: true,
-        pathRewrite: {
-          ['^' + '/prod-api']: ''
-        }
-      },
-      "/api": {
-        target: `http://192.168.0.151:9001`,
-        // target: `http://192.168.0.78:9001`,
-        // target: `https://test.yuemeikang.com/prod-api`,  // 测试环境
-        // target: `https://app.yuemeikang.com/prod-api`,  // 正式环境
-        changeOrigin: true,
-        pathRewrite: {
-          ['^' + '/api']: '/api'
-        }
-      }
+      // "/prod-api": {
+      //   target: `http://192.168.0.151:9002`,
+      //   // target: `http://192.168.0.19:9002`,
+      //   // target: `http://192.168.0.78:9002`,
+      //   // target: `https://test.yuemeikang.com/prod-api`,  // 测试环境
+      //   // target: `https://app.yuemeikang.com/prod-api`,  // 正式环境
+      //   changeOrigin: true,
+      //   pathRewrite: {
+      //     ['^' + '/prod-api']: ''
+      //   }
+      // },
+      // "/api": {
+      //   target: `http://192.168.0.151:9001`,
+      //   // target: `http://192.168.0.78:9001`,
+      //   // target: `https://test.yuemeikang.com/prod-api`,  // 测试环境
+      //   // target: `https://app.yuemeikang.com/prod-api`,  // 正式环境
+      //   changeOrigin: true,
+      //   pathRewrite: {
+      //     ['^' + '/api']: '/api'
+      //   }
+      // }
     }
   },
   css: {