|
|
@@ -194,7 +194,19 @@ export default {
|
|
|
playing: false,
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...globalMapState([
|
|
|
+ 'isMuted',
|
|
|
+ ])
|
|
|
+ },
|
|
|
watch: {
|
|
|
+ isMuted: {
|
|
|
+ handler(vNew) {
|
|
|
+ if (!vNew) {
|
|
|
+ this.stopAutoMoving()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
isAutoMoving: {
|
|
|
handler(vNew) {
|
|
|
if (vNew) {
|
|
|
@@ -240,21 +252,23 @@ export default {
|
|
|
player.on("play", ({ partId, frameId }) => {
|
|
|
this.isAutoMoving = true
|
|
|
this.isChangingAutoMovingStatus = false
|
|
|
+ this.mustMute()
|
|
|
})
|
|
|
player.on("pause", ({ partId, frameId }) => {
|
|
|
this.isAutoMoving = false
|
|
|
this.isChangingAutoMovingStatus = false
|
|
|
+ this.cancelMustMute()
|
|
|
})
|
|
|
player.on("end", async () => {
|
|
|
this.isAutoMoving = false
|
|
|
this.isChangingAutoMovingStatus = false
|
|
|
this.progress = 0
|
|
|
this.frameId = null
|
|
|
+ this.cancelMustMute()
|
|
|
})
|
|
|
|
|
|
player.on("progress", ({ partId, frameId, progress }) => {
|
|
|
this.curSceneIdx = frameId
|
|
|
-
|
|
|
this.autoMovingProgress = Number(progress * 100).toFixed(5)
|
|
|
})
|
|
|
})
|
|
|
@@ -386,9 +400,14 @@ export default {
|
|
|
}, 1000)
|
|
|
|
|
|
},
|
|
|
- unMounted() {
|
|
|
+ beforeDestroy() {
|
|
|
+ this.stopAutoMoving()
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...globalMapMutations([
|
|
|
+ 'mustMute',
|
|
|
+ 'cancelMustMute',
|
|
|
+ ]),
|
|
|
// 切换楼层
|
|
|
changeFloor(val) {
|
|
|
this.$router.replace({
|
|
|
@@ -399,17 +418,28 @@ export default {
|
|
|
location.reload(true)
|
|
|
}, 200)
|
|
|
},
|
|
|
- async onClickAutoMoving() {
|
|
|
- if (this.isChangingAutoMovingStatus) {
|
|
|
+ onClickAutoMoving() {
|
|
|
+ if (this.isAutoMoving) {
|
|
|
+ this.stopAutoMoving()
|
|
|
+ } else {
|
|
|
+ this.startAutoMoving()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async startAutoMoving() {
|
|
|
+ if (this.isChangingAutoMovingStatus || this.isAutoMoving) {
|
|
|
return
|
|
|
}
|
|
|
this.isChangingAutoMovingStatus = true
|
|
|
let player = await this.kankan.TourManager.player
|
|
|
- if (this.isAutoMoving) {
|
|
|
- player.pause()
|
|
|
- } else {
|
|
|
- player.play()
|
|
|
+ player.play()
|
|
|
+ },
|
|
|
+ async stopAutoMoving() {
|
|
|
+ if (this.isChangingAutoMovingStatus || !this.isAutoMoving) {
|
|
|
+ return
|
|
|
}
|
|
|
+ this.isChangingAutoMovingStatus = true
|
|
|
+ let player = await this.kankan.TourManager.player
|
|
|
+ player.pause()
|
|
|
},
|
|
|
onClickCjdl() {
|
|
|
this.isShowTourGuide = !this.isShowTourGuide
|
|
|
@@ -418,15 +448,19 @@ export default {
|
|
|
this.kankan.Camera.panorama()
|
|
|
},
|
|
|
onClickMnmx() {
|
|
|
+ this.stopAutoMoving()
|
|
|
this.kankan.Camera.dollhouse()
|
|
|
},
|
|
|
onClickDbfs() {
|
|
|
+ this.stopAutoMoving()
|
|
|
this.kankan.Camera.floorplan()
|
|
|
},
|
|
|
async changeScene(index) {
|
|
|
if (this.isChangingScene) {
|
|
|
return
|
|
|
}
|
|
|
+ this.stopAutoMoving()
|
|
|
+
|
|
|
this.isChangingScene = true
|
|
|
this.curSceneIdx = index
|
|
|
|