|
@@ -1,16 +1,21 @@
|
|
|
<template>
|
|
|
<div class="pano-desc">
|
|
|
+ <audio
|
|
|
+ ref="audio"
|
|
|
+ src="@/assets/audios/bacMusic.mp3"
|
|
|
+ loop
|
|
|
+ />
|
|
|
<div class="title-bar">
|
|
|
<button
|
|
|
class="audio"
|
|
|
:class="{
|
|
|
- play: !isPanoDescAudioPlaying,
|
|
|
- stop: isPanoDescAudioPlaying
|
|
|
+ play: isAudioPlaying,
|
|
|
+ stop: !isAudioPlaying
|
|
|
}"
|
|
|
- @click="togglePanoDescAudioStatus"
|
|
|
+ @click="toggleAudio"
|
|
|
>
|
|
|
<img
|
|
|
- :src="isPanoDescAudioPlaying ? require(`@/assets/images/pano/desc-audio-play.png`) : require(`@/assets/images/pano/desc-audio-stop.png`)"
|
|
|
+ :src="isAudioPlaying ? require(`@/assets/images/pano/desc-audio-play.png`) : require(`@/assets/images/pano/desc-audio-stop.png`)"
|
|
|
alt=""
|
|
|
draggable="false"
|
|
|
>
|
|
@@ -54,21 +59,40 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ isAudioPlaying: false,
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
...globalMapState([
|
|
|
- 'isPanoDescAudioPlaying',
|
|
|
'isPanoDescExpanded',
|
|
|
])
|
|
|
},
|
|
|
mounted() {
|
|
|
},
|
|
|
+ beforeDestroy() {
|
|
|
+ if (this.isAudioPlaying) {
|
|
|
+ this.isAudioPlaying = false
|
|
|
+ this.$refs.audio.pause()
|
|
|
+ this.cancelMustMute()
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
...globalMapMutations([
|
|
|
- 'togglePanoDescAudioStatus',
|
|
|
+ 'mustMute',
|
|
|
+ 'cancelMustMute',
|
|
|
'togglePanoDescExpandStatus',
|
|
|
]),
|
|
|
+ toggleAudio() {
|
|
|
+ if (this.isAudioPlaying) {
|
|
|
+ this.isAudioPlaying = false
|
|
|
+ this.$refs.audio.pause()
|
|
|
+ this.cancelMustMute()
|
|
|
+ } else {
|
|
|
+ this.isAudioPlaying = true
|
|
|
+ this.$refs.audio.play()
|
|
|
+ this.mustMute()
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
@@ -76,6 +100,9 @@ export default {
|
|
|
<style lang="less" scoped>
|
|
|
.pano-desc {
|
|
|
position: relative;
|
|
|
+ > audio {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
> .title-bar {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
@@ -94,12 +121,14 @@ export default {
|
|
|
}
|
|
|
> h1 {
|
|
|
font-size: 1.67rem;
|
|
|
+ line-height: 1.1em;
|
|
|
color: #FFFFFF;
|
|
|
width: 13.33rem;
|
|
|
overflow: hidden;
|
|
|
text-overflow: ellipsis;
|
|
|
white-space: pre;
|
|
|
text-align: center;
|
|
|
+ padding-top: 0.25rem;
|
|
|
}
|
|
|
> button.expand-status {
|
|
|
width: 1.75rem;
|