From 0b3c77332ac4ce524ad4d8b8c3d8959a0f0cc14e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 07 Jan 2022 14:13:08 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/school-web

---
 src/components/mobileWindow/index.vue  |   19 ++++++---
 src/components/mobilemap/index.vue     |   25 ++++++++----
 src/store/getters.js                   |    2 
 src/store/modules/mobile.js            |   33 ++++++++++------
 src/components/mobileCortrol/index.vue |    4 +-
 5 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/src/components/mobileCortrol/index.vue b/src/components/mobileCortrol/index.vue
index d585fa5..f596bff 100644
--- a/src/components/mobileCortrol/index.vue
+++ b/src/components/mobileCortrol/index.vue
@@ -3,13 +3,13 @@
     <div class="m-l-inbut zoom-in" @click="zoomIn()">
       <i class="el-icon-refresh"></i>
     </div>
-    <div
+    <!-- <div
       class="m-l-inbut zoom-in m-l-inbut-2d"
       :class="{ active: dimension == '3D' }"
       @click="zoomIn('3D')"
     >
       3&nbsp;&nbsp;维
-    </div>
+    </div> -->
     <div
       class="m-l-inbut zoom-in m-l-inbut-3d"
       :class="{ active: dimension == '2.5D' }"
diff --git a/src/components/mobileWindow/index.vue b/src/components/mobileWindow/index.vue
index c35f756..34c675b 100644
--- a/src/components/mobileWindow/index.vue
+++ b/src/components/mobileWindow/index.vue
@@ -7,8 +7,8 @@
     <div class="mobiletitle">
       {{ title }}
       <span class="mobile_audio" @click="openAudio" v-show="introduce">
-        <i class="el-icon-video-play icon" v-show="!audioData"></i>
-        <i class="el-icon-video-pause icon" v-show="audioData"></i>
+        <i class="el-icon-video-play icon" v-show="!audioState"></i>
+        <i class="el-icon-video-pause icon" v-show="audioState"></i>
         <!-- <div id="bdtts_div_id">
           <audio id="tts_autio_id" autoplay="autoplay">
             <source
@@ -92,7 +92,7 @@
       "MobileWindowsHide",
       "query",
       "MobileWindowChangeData",
-      "audioData",
+      "audioState",
     ]),
   },
   watch: {
@@ -155,6 +155,14 @@
             }
             if (k == "introduce") {
               this.introduce = queryData[k];
+              if (this.introduce) {
+                setTimeout(() => {
+                  let Str = document.querySelector(
+                    ".mobileBig-center-introduce"
+                  ).innerText;
+                  this.$store.dispatch("MSET_GETAUDIO", Str); //加入语音
+                }, 20);
+              }
             }
           }
         }
@@ -223,10 +231,7 @@
     },
     openAudio() {
       if (this.introduce) {
-        let Str = document.querySelector(
-          ".mobileBig-center-introduce"
-        ).innerText;
-        this.$store.dispatch("MSET_GETAUDIO", Str);
+        this.$store.dispatch("MSET_GETAUDIOBEGIN");
       }
     },
   },
diff --git a/src/components/mobilemap/index.vue b/src/components/mobilemap/index.vue
index 8193e95..cffab0c 100644
--- a/src/components/mobilemap/index.vue
+++ b/src/components/mobilemap/index.vue
@@ -268,8 +268,8 @@
         // if (height > 2000) {
         //   conBack(2000);
         // }
-        if (height < 500 && isSet) {
-          conBack(500);
+        if (height < 200 && isSet) {
+          conBack(200);
         }
         if (height > 6000 && isSet) {
           conBack(6000);
@@ -325,7 +325,7 @@
       const tileset = new that.DC.Tileset("/mx/tileset.json", {
         luminanceAtZenith: 0.5,
       });
-      tilesetLayer.addOverlay(tileset);
+      // tilesetLayer.addOverlay(tileset);
       // tilesetLayer.show = false;
 
       let silhouetteBlue =
@@ -473,7 +473,7 @@
       let startPoint;
       if (true) {
         startPoint = () => {
-          let doit2 = (int) => {
+          let doit2 = (int, h) => {
             viewer.camera.setView({
               // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
               // fromDegrees()方法,将经纬度和高程转换为世界坐标
@@ -487,18 +487,25 @@
               ),
               orientation: {
                 // 指向
-                heading: that.DC.Namespace.Cesium.Math.toRadians(108),
+                heading: that.DC.Namespace.Cesium.Math.toRadians(h[0]),
                 // 视角
-                pitch: that.DC.Namespace.Cesium.Math.toRadians(-26.46),
-                roll: 0.0,
+                pitch: that.DC.Namespace.Cesium.Math.toRadians(h[1]),
+                roll: h[2],
               },
             });
           };
           that.dimension == "2.5D"
-            ? doit2([114.03928791, 27.62954732, 360.0])
+            ? doit2(
+                [114.03928791, 27.62954732, 360.0],
+                [
+                  that.dimensionData.heading,
+                  that.dimensionData.pitch,
+                  that.dimensionData.roll,
+                ]
+              )
             : // : doit([116.39038494750986, 39.902393222208644, 330.0]);
               // doit("建模");
-              doit2([114.0351, 27.6314, 300.0]);
+              doit2([114.0351, 27.6314, 300.0], [108, -26.46, 0.0]);
         };
       } else {
         startPoint = (val) => {
diff --git a/src/store/getters.js b/src/store/getters.js
index d20671d..a7bfdf5 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -20,7 +20,7 @@
   dimension: (state) => state.mobile.dimension, // 维度
   dimensionData: (state) => state.mobile.dimensionData, // 维度镜头数据
   perspectiveControl: (state) => state.mobile.perspectiveControl, ///视角控制:高度、角度  ()=>{}
-  audioData: (state) => state.mobile.audioData, //文字转语音状态
+  audioState: (state) => state.mobile.audioState, //文字转语音状态
 };
 
 const navigation = {
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 341e11c..21d4742 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -30,7 +30,7 @@
     },
     // 默认起始点函数
     startPointFn: "",
-    dimension: "3D", // 维度
+    dimension: "2.5D", // 维度
     dimensionData: {
       // 维度镜头数据
       heading: 0,
@@ -47,6 +47,7 @@
     tilesetLayer: null, //瀑布流
 
     audioData: null, //语音
+    audioState: false, //语音状态
   },
   mutations: {
     MSET_VIEWER(state, viewer) {
@@ -113,7 +114,6 @@
     //切换2D和2.5D
     MSET_DIMENSION(state, data) {
       //关闭弹窗
-
       //3d,2.5d转换事件
       state.dimension = data;
       if (data == "3D") {
@@ -162,7 +162,7 @@
         state.startPointFn(); //移动默认视角
 
         //2.5D视角限制
-        state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 500;
+        state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 200;
         // 最大
         state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 6000;
         // 设置相机缩小时的速率
@@ -220,7 +220,7 @@
       } else if (state.dimension == "2.5D") {
         Flys = [
           +data.lntLat[0] + 0.01197,
-          +data.lntLat[1] - 0.0001,
+          +data.lntLat[1] - 0.00055,
           // +data.lntLat[1] - 0.0022,
           nowHeight,
         ];
@@ -298,13 +298,12 @@
       // })
       commit("MSET_POPUPDOM", popupsDom);
     },
-    closeMobileWindowsDom({ state, commit }) {
+    closeMobileWindowsDom({ state, commit, dispatch }) {
       if (!state.MobileWindowsHide && state.popupsDom) {
         state.popupsDom.closeOur();
         commit("MSET_MOBILEWINDOWSHIDE", true);
         if (state.audioData) {
-          state.audioData = null;
-          window.speechSynthesis.cancel();
+          dispatch("MSET_GETAUDIOBEGIN", "notOpen");
         }
       } //cancel
     },
@@ -490,13 +489,23 @@
       });
     },
     MSET_GETAUDIO({ state, commit, dispatch }, val) {
-      if (state.audioData) {
-        state.audioData = null;
+      state.audioData = new window.SpeechSynthesisUtterance();
+      state.audioData.text = val;
+      state.audioData.onstart = function (e) {
+        state.audioState = true;
+      };
+      state.audioData.onend = function (event) {
+        state.audioState = false;
+      };
+    },
+    MSET_GETAUDIOBEGIN({ state, commit, dispatch }, val) {
+      if (state.audioState) {
         window.speechSynthesis.cancel();
+        state.audioState = false;
       } else {
-        state.audioData = new window.SpeechSynthesisUtterance();
-        state.audioData.text = val;
-        window.speechSynthesis.speak(state.audioData);
+        if (val != "notOpen") {
+          window.speechSynthesis.speak(state.audioData);
+        }
       }
     },
   },

--
Gitblit v1.9.3