From 0d4c3c3877bee1c92f574d26c67118dadb4a3dc7 Mon Sep 17 00:00:00 2001
From: guonan <guonan201020@163.com>
Date: 星期四, 01 五月 2025 17:06:20 +0800
Subject: [PATCH] 后端ip暴露

---
 src/api/requestTR.js       |   17 +++++++++++++++--
 vue.config.js              |    4 ++--
 public/index.html          |    2 +-
 src/store/simAPI.js        |    2 +-
 public/js/config.js        |   15 ++-------------
 src/views/left/CitySim.vue |    9 +++++++--
 6 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/public/index.html b/public/index.html
index f952741..13b338c 100644
--- a/public/index.html
+++ b/public/index.html
@@ -7,13 +7,13 @@
   <meta name="viewport" content="width=device-width,initial-scale=1.0">
   <link rel="icon" href="<%= BASE_URL %>favicon.ico">
   <link rel="stylesheet" href="./CimSDK/CimSDK.min.css">
-  <script src="./js/config.js"></script>
   <script src="./js/city.js"></script>
   <script src="./js/turf.min.js"></script>
   <!-- <script src="./js/peer-stream.js"></script> -->
   <script src="./CimSDK/Workers/jquery-3.5.0.min.js"></script>
   <script src="./CimSDK/CimSDK.min.js"></script>
   <script src="./js/proj4.js"></script>
+  <script src="./js/config.js"></script>
   <title>鍦拌川鐏惧瀛敓骞冲彴</title>
 </head>
 
diff --git a/public/js/config.js b/public/js/config.js
index 2d5cb99..de820cd 100644
--- a/public/js/config.js
+++ b/public/js/config.js
@@ -1,13 +1,2 @@
-
-
-
-const mapDataUrl = "http://localhost:18055/鍖椾含鍦拌川鐏惧鐮旂┒鎵�椤圭洰";
-// 鍍忕礌娴侀厤缃�
-const defaultStreamUrl = "ws://localhost:88"
-
-
-window.ps = {
-  emitMessage: function (message) { 
-    // console.log("emitMessage", message)
-  }
-}
\ No newline at end of file
+const BASE_URL = "http://192.168.56.107:8077"
+console.log('config.js 琚姞杞�', new Date().toISOString());
\ No newline at end of file
diff --git a/src/api/requestTR.js b/src/api/requestTR.js
index c404aac..01feb22 100644
--- a/src/api/requestTR.js
+++ b/src/api/requestTR.js
@@ -1,13 +1,26 @@
 import axios from "axios";
 
+// 鍒ゆ柇褰撳墠鏄惁鏄紑鍙戠幆澧�
+let API_URL;
+
+if (process.env.NODE_ENV === 'development') {
+  // 寮�鍙戠幆澧冧娇鐢� '/api'
+  API_URL = '/api';
+} else {
+  // 鐢熶骇鐜浣跨敤瀹為檯鐨勯厤缃湴鍧�
+  API_URL = `${BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL}/api`;
+}
+
 // 鍒涘缓 Axios 瀹炰緥
 const instance = axios.create({
-  baseURL: "/api", // 浣跨敤浣犻厤缃殑 /auth 浠g悊
+  baseURL: API_URL,
   timeout: 1000 * 60, // 璇锋眰瓒呮椂鏃堕棿锛堝崟浣嶏細姣锛�
   headers: {
-    "Content-Type": "application/x-www-form-urlencoded", // 榛樿璇锋眰澶碼pplication/json
+    "Content-Type": "application/x-www-form-urlencoded", // 榛樿璇锋眰澶�
   },
 });
+
+console.log('褰撳墠 BaseUrl:', API_URL);
 // 璇锋眰鎷︽埅鍣�
 // instance.interceptors.request.use(
 //   (config) => {
diff --git a/src/store/simAPI.js b/src/store/simAPI.js
index 909fe4e..7475b62 100644
--- a/src/store/simAPI.js
+++ b/src/store/simAPI.js
@@ -57,7 +57,7 @@
 
         try {
             const params = {
-                geom: forms.geom,
+                geom: forms.geom.value,
                 areaType: getAreaType(selectTab.value),
                 createTime: Date.now(),
                 name: forms.name,
diff --git a/src/views/left/CitySim.vue b/src/views/left/CitySim.vue
index 193cdd5..cdc19e3 100644
--- a/src/views/left/CitySim.vue
+++ b/src/views/left/CitySim.vue
@@ -41,6 +41,7 @@
           v-if="simStore.selectTab == '琛屾斂鍖哄垝浠跨湡'"
         >
           <el-select
+            @change="changeGeom"
             v-model="forms.geom"
             placeholder="Select"
             style="max-width: 600px"
@@ -49,7 +50,7 @@
               v-for="item in options"
               :key="item.value"
               :label="item.label"
-              :value="item.value"
+              :value="item"
             />
           </el-select>
         </el-form-item>
@@ -66,7 +67,7 @@
               v-for="item in options"
               :key="item.value"
               :label="item.label"
-              :value="item.value"
+              :value="item"
             />
           </el-select>
         </el-form-item>
@@ -196,6 +197,10 @@
   hours: null,
 });
 
+const changeGeom = (val) => {
+  console.log(val,'aaaaaaaaaaaaaaa')
+}
+
 const { calculateHoursDifference } = inject("calculateHours");
 
 const change = (val) => {
diff --git a/vue.config.js b/vue.config.js
index 54216e7..dc291de 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -21,8 +21,8 @@
     hot: true,
     proxy: {
       '/api': {
-        // target: 'http://192.168.56.107:8077',
-        target: 'http://192.168.1.104:8078',
+        target: 'http://192.168.56.107:8077',
+        // target: 'http://192.168.1.104:8078',
         changeOrigin: true,
         // pathRewrite: {
         //   '^/api': ''

--
Gitblit v1.9.3