From f3e4a728bca47d424fb3f9f0e2ef438cec58a2e3 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Thu, 31 Mar 2022 13:36:20 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/school-web

---
 src/components/map/components/mapPopup.vue |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/components/map/components/mapPopup.vue b/src/components/map/components/mapPopup.vue
index f9ae8a9..cd760a3 100644
--- a/src/components/map/components/mapPopup.vue
+++ b/src/components/map/components/mapPopup.vue
@@ -745,12 +745,14 @@
         this.audioSynth = window.speechSynthesis
         this.audioMsg = new window.SpeechSynthesisUtterance()
 
-        this.audioMsg.onend = function () {
-            that.audioSynth.cancel()
-            that.audioFlag = false
-            that.audioCourse = false
-            that.audioImgUrl = '/img/icon/close-video.png'
-        }
+        this.$nextTick(() => {
+            this.audioMsg.onend = function () {
+                that.audioSynth.cancel()
+                that.audioFlag = false
+                that.audioCourse = false
+                that.audioImgUrl = '/img/icon/close-video.png'
+            }
+        })
     },
     mounted () {
         global.viewer.scene.globe.depthTestAgainstTerrain = false
@@ -816,12 +818,16 @@
             immediate: true,
             handler (newCode, oldCode) {
                 if (newCode == false) {
-                    this.audioSynth.cancel()
+                    if (this.audioSynth != null) {
+                        this.audioSynth.cancel()
+                    }
                     this.audioFlag = false
                     this.audioCourse = false
                 } else {
                     if (this.audioFlag == true) {
-                        this.audioSynth.cancel()
+                        if (this.audioSynth != null) {
+                            this.audioSynth.cancel()
+                        }
                         this.audioFlag = false
                         this.audioCourse = false
                         this.audioImgUrl = '/img/icon/close-video.png'

--
Gitblit v1.9.3