From 26dfd1bf3f07d413502c04440eee0db428a99bd7 Mon Sep 17 00:00:00 2001
From: 严智鑫 <test>
Date: 星期三, 10 四月 2024 10:02:41 +0800
Subject: [PATCH] 识别版图数据

---
 UI-Project/vite.config.js |   45 ++++++++++++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/UI-Project/vite.config.js b/UI-Project/vite.config.js
index c5cc368..d4d6ee2 100644
--- a/UI-Project/vite.config.js
+++ b/UI-Project/vite.config.js
@@ -16,25 +16,36 @@
     }
   }, 
   server: {
-    port: 801,//绔彛鍙�
-    host: true,//ip鍦板潃 鎴� '0.0.0.0' 鎴� "loaclhost"
-    open: false, //鍚姩鍚庢槸鍚﹁嚜鍔ㄦ墦寮�娴忚鍣�
-    https: false, // 鏄惁寮�鍚� https
+    port: 801,
+    host: true,
+    open: false,
+    https: false,
     proxy: {
-      '^/api': {
-        target: 'localhost:8080/mesModuleTools', //鐩爣婧愶紝鐩爣鏈嶅姟鍣紝鐪熷疄璇锋眰鍦板潃
-        changeOrigin: true, //鏀寔璺ㄥ煙
-        rewrite: (path) => path.replace(/^\/api/, "/mesModuleTools"), //閲嶅啓鐪熷疄璺緞,鏇挎崲/api
-      //   pathRewrite: {
-      //     '^/api': ''
-      // }
-        // rewrite: (path) => path.replace(/^\/api/, "/mesModuleTools"), //閲嶅啓鐪熷疄璺緞,鏇挎崲/api
+      '/api': {
+        target: 'http://localhost:8080/mesModuleTools',
+        changeOrigin: true,
+        rewrite: (path) => path.replace(/^\/api/, '/mesModuleTools'),
       },
       '/api2': {
-        target: 'localhost:8080/mesModuleTools',
+        target: 'http://localhost:8081/mesModuleTools',
         changeOrigin: true,
-        rewrite: (path) => path.replace(/^\/api2/, ""),
+        pathRewrite: {
+          '^/api2': '',
+        },
       },
-    }
-  }
-})
+    },
+  },
+  configureServer: ({ middlewares }) => {
+    middlewares.use(
+      '/mesModuleTools',
+      createProxyMiddleware({
+        target: 'ws://localhost:8081',
+        ws: true,
+        changeOrigin: true,
+        pathRewrite: {
+          '^/mesModuleTools': '',
+        },
+      })
+    );
+  },
+});
\ No newline at end of file

--
Gitblit v1.8.0