Browse Source

修改问题

sunzehao 4 months ago
parent
commit
7c77b8a11c
3 changed files with 25 additions and 4 deletions
  1. 1 1
      src/main.js
  2. 17 3
      src/views/cesium.vue
  3. 7 0
      src/views/satellitecloudchart.vue

+ 1 - 1
src/main.js

@@ -4,7 +4,7 @@ import { createApp } from 'vue'
 import App from './App.vue'
 import router from './router'
 import * as echarts from "echarts";
-import "echarts-gl";
+// import "echarts-gl";
 
 import ElementPlus from 'element-plus'
 import 'element-plus/dist/index.css'

+ 17 - 3
src/views/cesium.vue

@@ -13,6 +13,11 @@
         @click="switchCloudLayer"
         >{{ cloudLayer ? "关闭" : "显示" }}云图</el-button
       >
+      <el-button
+        :type="rainLayer ? 'danger' : 'primary'"
+        @click="switchRainLayer"
+        >{{ rainLayer ? "关闭" : "显示" }}降雨图</el-button
+      >
       <el-tooltip
         class="box-item"
         effect="dark"
@@ -55,6 +60,7 @@ export default {
       windLayer: null, // 风场图
       windLayerTimmer: null, // 风场图计时器
       cloudLayer: null, // 卫星云图
+      rainLayer: null //
     };
   },
 
@@ -63,9 +69,11 @@ export default {
   },
 
   unmounted() {
-    clearInterval(this.windLayerTimmer);
-    this.windLayer.removeLines();
-    this.windLayer = null;
+    if (this.windLayer !== null) {
+        clearInterval(this.windLayerTimmer);
+        this.windLayer.removeLines();
+        this.windLayer = null;
+    }
   },
 
   methods: {
@@ -323,6 +331,12 @@ export default {
         this.showCloudLayer();
       }
     },
+
+    switchRainLayer() {
+        this.$router.push({
+            path: '/satellitecloudchart'
+        })
+    }
   },
 };
 </script>

+ 7 - 0
src/views/satellitecloudchart.vue

@@ -3,6 +3,7 @@
     <div id="cesiumContainer" style="width: 100%; height: 100vh"></div>
     <div class="menuBox" :class="allyShow ? '' : 'switch'">
       <el-button type="primary" @click="resetViewport">初始化视角</el-button>
+      <el-button type="primary" @click="switchLayer">返回</el-button>
       <el-tooltip
         class="box-item"
         effect="dark"
@@ -254,6 +255,12 @@ export default {
         duration: 1.0,
       });
     },
+
+    switchLayer() {
+        this.$router.push({
+            path: '/'
+        })
+    }
   },
 };
 </script>