Hwf 9 mesi fa
parent
commit
63c013d98c
4 ha cambiato i file con 18 aggiunte e 16 eliminazioni
  1. 1 1
      .env.development
  2. 8 7
      src/components/Map/YMap.vue
  3. 2 1
      src/utils/wmtsManager.ts
  4. 7 7
      vite.config.ts

+ 1 - 1
.env.development

@@ -5,7 +5,7 @@ VITE_APP_TITLE = 应急指挥一张图
 VITE_APP_ENV = 'development'
 
 # 开发环境
-VITE_APP_BASE_API = '/dev-api'
+VITE_APP_BASE_API = 'http://10.181.7.236:9988'
 
 # 应用访问路径 例如使用前缀 /admin/
 VITE_APP_CONTEXT_PATH = '/'

+ 8 - 7
src/components/Map/YMap.vue

@@ -2,18 +2,18 @@
   <div class="map-container">
     <div id="yztMap" class="map-container"></div>
     <!-- 右下工具  -->
-<!--    <div v-show="mapState.showScale" class="zoom-text">{{ mapState.zoom }}级</div>-->
+    <!--    <div v-show="mapState.showScale" class="zoom-text">{{ mapState.zoom }}级</div>-->
     <div class="right-tool">
       <!-- 快捷缩放 -->
       <QuickZoom :step="mapState.zoom" :min-step="mapState.minZoom" :max-step="mapState.maxZoom" @change-step="setMapZoom" />
       <div class="flex" style="margin-top: 5px">
         <div class="model-btn" @click="switchThreeDimensional">{{ mapState.isThreeDimensional ? '3D' : '2D' }}</div>
-<!--        <div class="model-btn" style="margin-left: 5px" @click="changeScaleControl">尺</div>-->
+        <!--        <div class="model-btn" style="margin-left: 5px" @click="changeScaleControl">尺</div>-->
       </div>
       <!-- 测距工具 -->
-<!--      <div class="model-btn" @click="toggleRangingTool">-->
-<!--        {{ isRanging ? '关闭测距' : '开启测距' }}-->
-<!--      </div>-->
+      <!--      <div class="model-btn" @click="toggleRangingTool">-->
+      <!--        {{ isRanging ? '关闭测距' : '开启测距' }}-->
+      <!--      </div>-->
     </div>
   </div>
 </template>
@@ -21,7 +21,6 @@
 import WMTSManager from "@/utils/wmtsManager";
 import QuickZoom from "@/components/Map/quickZoom.vue";
 import { reactive } from "vue";
-import * as turf from '@turf/turf';
 
 interface Props {
   activeMap: string;
@@ -83,6 +82,7 @@ const initMapEvent = () => {
 };
 // 切换地图
 const switchMap = (type) => {
+  debugger
   let queryParamsArr = [];
   if (type === 'satellite2') {
     queryParamsArr = [
@@ -99,6 +99,7 @@ const switchMap = (type) => {
     wmtsManager = new WMTSManager(map);
     wmtsManager.init();
   }
+
   wmtsManager.addWmtsLayers(queryParamsArr, (res) => {});
 };
 
@@ -143,7 +144,7 @@ const measureFunc = (e) => {
   //测面
   if (features[0].geometry.type == 'Polygon') {
     if (features.length > 0) {
-      var area = turf.area(features[0]);
+      // var area = turf.area(features[0]);
       // restrict to area to 2 decimal points
       var rounded_area = Math.round(area * 100) / 100;
       var htmlStr = '<p>面积:<strong>' +

+ 2 - 1
src/utils/wmtsManager.ts

@@ -63,7 +63,8 @@ class WMTSManager {
         }
         const json = format.read(value);
         const layerOptions = that.WMTSMatchAnalyzer(json, val.layerExtent, val.wmtsLoadParam);
-        const serviceUrl = window.location.origin + import.meta.env.VITE_APP_BASE_API + '/api/oneShare/proxyHandler/mm/' + val.serviceCode;
+        // window.location.origin +
+        const serviceUrl = import.meta.env.VITE_APP_BASE_API + '/api/oneShare/proxyHandler/mm/' + val.serviceCode;
         const layerInf = that.createLayer(serviceUrl, layerOptions[0], isSpecialLayer);
         that.map.addSource(layerInf.source.id, layerInf.source);
         that.wmtslayergroup.addLayerToGroup(that.map, that.wmtsgroupid, layerInf.layer);

+ 7 - 7
vite.config.ts

@@ -24,13 +24,13 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
       port: Number(env.VITE_APP_PORT),
       open: true,
       proxy: {
-        [env.VITE_APP_BASE_API]: {
-          // target: 'http://localhost:8080',
-          target: 'http://10.181.7.236:9988',
-          changeOrigin: true,
-          ws: true,
-          rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
-        }
+        // [env.VITE_APP_BASE_API]: {
+        //   // target: 'http://localhost:8080',
+        //   target: 'http://10.181.7.236:9988',
+        //   changeOrigin: true,
+        //   ws: true,
+        //   rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')
+        // }
       }
     },
     css: {