Browse Source

增加配置文件

wuxiang 1 year ago
parent
commit
04b728616a
2 changed files with 10 additions and 6 deletions
  1. 4 0
      public/static/config.js
  2. 6 6
      src/views/map/index.js

+ 4 - 0
public/static/config.js

@@ -0,0 +1,4 @@
+window.config = {
+    backUrl: 'http://localhost:8048',
+    trajUrl: 'http://localhost:5000'
+}

+ 6 - 6
src/views/map/index.js

@@ -318,7 +318,7 @@ export default {
             // this.$data._viewer2D.clock.onTick.removeEventListener();
             // this.$data._viewer3D.clock.onTick.removeEventListener();
             await axios
-                .get("http://127.0.0.1:8084/admin/online/onlineOperation/downloadDatasource/main", {
+                .get(window.config.backUrl + "/admin/online/onlineOperation/downloadDatasource/main", {
                     params: {
                         datasourceId: "1656243335922192384",
                         fieldName: "xdfile",
@@ -427,7 +427,7 @@ export default {
             this.$data._viewer2D.entities.removeAll();
             this.$data._viewer3D.entities.removeAll();
             await axios
-                .get("http://127.0.0.1:8084/admin/online/onlineOperation/downloadDatasource/main", {
+                .get(window.config.backUrl + "/admin/online/onlineOperation/downloadDatasource/main", {
                     params: {
                         datasourceId: "1656243335922192384",
                         fieldName: "xdfile",
@@ -1654,14 +1654,14 @@ export default {
         async initSTK() {
             console.log('this.jsonData :>> ', this.jsonData);
             // await axios
-            //   .get("/api", this.jsonData).then(res=>{
+            //   .get(window.config.trajUrl+"", this.jsonData).then(res=>{
             //     console.log('res :>> ', res);
             //   })
             const config = {
                 timeout: 0 // 设置超时时间为0,表示忽略超时问题
             };
             await axios
-                .post("/api/traj", this.jsonData, config).then(res => {
+                .post(window.config.trajUrl + "/traj", this.jsonData, config).then(res => {
                     console.log('res :>> ', res.data);
                     console.log('nameidlist :>> ', this.nameIdList);
                     let data = res.data[1].data[0];
@@ -1790,7 +1790,7 @@ export default {
             // 转换为需求字符串格式
             const newTimeString = `${jsDate.getFullYear()}-${(jsDate.getMonth() + 1).toString().padStart(2, '0')}-${jsDate.getDate().toString().padStart(2, '0')} ${jsDate.getHours().toString().padStart(2, '0')}:${jsDate.getMinutes().toString().padStart(2, '0')}:${jsDate.getSeconds().toString().padStart(2, '0')}`;
             await axios
-                .post("/api/pos", { simulation_time: newTimeString + '.000' }).then(res => {
+                .post(window.config.trajUrl + "/pos", { simulation_time: newTimeString + '.000' }).then(res => {
                     console.log('res :>> ', res);
                     let data = res.data[1].data
                         //依次更新每个模型位置
@@ -1838,7 +1838,7 @@ export default {
             // 转换为需求字符串格式
             const newTimeString = `${jsDate.getFullYear()}-${(jsDate.getMonth() + 1).toString().padStart(2, '0')}-${jsDate.getDate().toString().padStart(2, '0')} ${jsDate.getHours().toString().padStart(2, '0')}:${jsDate.getMinutes().toString().padStart(2, '0')}:${jsDate.getSeconds().toString().padStart(2, '0')}`;
             await axios
-                .post("/api/pos", { simulation_time: newTimeString + '.000' }).then(res => {
+                .post(window.config.trajUrl + "/pos", { simulation_time: newTimeString + '.000' }).then(res => {
                     let data = res.data[1].data
                         //恢复雷达拦截数量
                     this.radarFireRecover()