From 20d94ba53e1b8c64754bda684a7350d32be10d99 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 25 Mar 2022 16:22:41 +0800
Subject: [PATCH] 部分更改

---
 src/pcviews/specialmap/welcome.vue |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/pcviews/specialmap/welcome.vue b/src/pcviews/specialmap/welcome.vue
index 3834019..fa80c6d 100644
--- a/src/pcviews/specialmap/welcome.vue
+++ b/src/pcviews/specialmap/welcome.vue
@@ -103,7 +103,8 @@
             audioSynth: null,
             audioMsg: null,
             panoramaShow: false,
-            audioImgUrl: '/img/icon/start-video.png'
+            audioImgUrl: '/img/icon/start-video.png',
+            urlDataName: null
         }
     },
     created () { },
@@ -120,10 +121,29 @@
             that.audioCourse = false
             that.audioImgUrl = '/img/icon/close-video.png'
         }
-        this.getData()
 
         window.onbeforeunload = e => { // 刷新时弹出提示
             this.audioSynth.cancel()
+        }
+    },
+    watch: {
+        $route: {
+            immediate: true,
+            handler (newData, oldData) {
+                if (this.urlDataName == null) {
+                    this.urlDataName = this.$route.query.name
+                    this.getData()
+                } else if (newData.query.name != this.urlDataName) {
+                    this.audioSynth.cancel()
+                    global.viewer.removeLayer(pathLayer)
+                    global.viewer.removeLayer(pointLayer)
+                    this.urlDataName = this.$route.query.name
+                    this.getData()
+                }
+                // if (this.$route.query.type) {//需要监听的参数
+                //     this.type = this.$route.query.type
+                // }
+            }
         }
     },
     computed: {
@@ -136,7 +156,7 @@
     },
     methods: {
         getData () {
-            getWelcome({ hdname: this.$route.query.name }).then((res) => {
+            getWelcome({ hdname: this.urlDataName }).then((res) => {
                 var result = res.data.data
                 this.title = result.hdname
                 this.time = result.time
@@ -249,7 +269,6 @@
                 }
             }
         },
-
         closeModel () {
             global.viewer.removeLayer(pathLayer)
             global.viewer.removeLayer(pointLayer)
@@ -261,7 +280,6 @@
             this.$store.dispatch('delVisitedViews', this.$route)
             this.$router.push('/pcLayout/default')
         },
-
         panoramaPlay () {
             this.panoramaShow = true
             this.panoramaUrl = this.panoramaUrlOne

--
Gitblit v1.9.3