From a7d306cb0fe6482251f9d4acdc29674ffc13a032 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期二, 18 四月 2023 12:10:07 +0800
Subject: [PATCH] 底图切换

---
 src/components/Screen/bottom.vue |   67 ++++++++++++++++++++-------------
 1 files changed, 40 insertions(+), 27 deletions(-)

diff --git a/src/components/Screen/bottom.vue b/src/components/Screen/bottom.vue
index a8b94da..2e777e5 100644
--- a/src/components/Screen/bottom.vue
+++ b/src/components/Screen/bottom.vue
@@ -228,10 +228,15 @@
   methods: {
     ChangeBaseLayer(name) {
       this.currYX = name
-      Viewer.imageryLayers._layers[2].show = false
-      Viewer.imageryLayers._layers[1].show = false
-      // Viewer.imageryLayers._layers[2].show = false
-      // Viewer.imageryLayers._layers[3].show = false
+
+      if (is_production) {
+        Viewer.imageryLayers._layers[1].show = false
+        Viewer.imageryLayers._layers[0].show = false
+      } else {
+        Viewer.imageryLayers._layers[1].show = false
+
+      }
+
       if (yunxuanLayer) {
         Viewer.imageryLayers.remove(yunxuanLayer);
         yunxuanLayer = null
@@ -254,28 +259,30 @@
             //   true,
             //   ""
             // )
-            // var urls = "http://t0.tianditu.com/ter_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=ter&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=";
-            // var tokne = "94a34772eb88317fcbf8428e10448561"
-            // yunxuanLayer = Viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({
-            //   url: urls + tokne,
-            //   layer: "tdtImgLayer",
-            //   style: "default",
-            //   format: "image/jpeg",
-            //   tileMatrixSetID: "GoogleMapsCompatible",
-            // }))
+            var urls = "http://t0.tianditu.com/ter_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=ter&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=";
+            var tokne = "94a34772eb88317fcbf8428e10448561"
+            if (is_production) {
+              var baseUrl_yx = window.sceneConfig.baseUrl_yx;
+              if (baseUrl_yx.indexOf('{host}') > -1) {
+                baseUrl_yx = baseUrl_yx.replace("{host}", iisHost)
+              }
 
-
-            var baseUrl_yx = window.sceneConfig.baseUrl_yx;
-            if (baseUrl_yx.indexOf('{host}') > -1) {
-              baseUrl_yx = baseUrl_yx.replace("{host}", iisHost)
+              yunxuanLayer = Viewer.imageryLayers.addImageryProvider(
+                new Cesium.UrlTemplateImageryProvider({
+                  url: baseUrl_yx,
+                  maximumLevel: 22,
+                })
+              );
+            } else {
+              yunxuanLayer = Viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({
+                url: urls + tokne,
+                layer: "tdtImgLayer",
+                style: "default",
+                format: "image/jpeg",
+                tileMatrixSetID: "GoogleMapsCompatible",
+              }))
             }
-            debugger
-            yunxuanLayer = Viewer.imageryLayers.addImageryProvider(
-              new Cesium.UrlTemplateImageryProvider({
-                url: baseUrl_yx,
-                maximumLevel: 22,
-              })
-            );
+
 
             Viewer.imageryLayers.lowerToBottom(yunxuanLayer);//灏嗗浘灞傜Щ鍒版渶搴曞眰
             Viewer.imageryLayers.raise(yunxuanLayer);//灏嗗浘灞備笂绉讳竴灞�
@@ -285,11 +292,17 @@
 
           break
         case "褰卞儚鍥�":
-          Viewer.imageryLayers._layers[1].show = true
+
+          if (is_production) {
+            Viewer.imageryLayers._layers[0].show = true
+          }
           break
         case "娉ㄨ鍥�":
-          Viewer.imageryLayers._layers[2].show = true
-
+          if (is_production) {
+            Viewer.imageryLayers._layers[1].show = true
+          } else {
+            Viewer.imageryLayers._layers[1].show = true
+          }
           break
         default:
           break

--
Gitblit v1.9.3