|
@@ -5,7 +5,27 @@
|
|
|
<p>{{ myTxt }}</p>
|
|
|
</div>
|
|
|
|
|
|
+ <!-- 音频图标 -->
|
|
|
+ <div
|
|
|
+ v-if="audio && !isOneAduio"
|
|
|
+ class="audioIcon"
|
|
|
+ :title="audioSta ? '关闭音频' : '打开音频'"
|
|
|
+ @click="audioSta = !audioSta"
|
|
|
+ >
|
|
|
+ <img :src="audioSta ? VolumeOff : VolumeOn" alt="" />
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="hotspot-page-main">
|
|
|
+ <!-- 音频播放器 -->
|
|
|
+ <audio
|
|
|
+ id="myAudio"
|
|
|
+ v-if="audio"
|
|
|
+ ref="volumeRef"
|
|
|
+ v-show="isOneAduio"
|
|
|
+ :src="audio"
|
|
|
+ controls
|
|
|
+ ></audio>
|
|
|
+
|
|
|
<!-- 模型页面 -->
|
|
|
<Swiper
|
|
|
v-if="myType === 'model'"
|
|
@@ -87,6 +107,8 @@
|
|
|
import AcImageIcon from '@/assets/images/icon-image-1@2x.png';
|
|
|
import VideoIcon from '@/assets/images/icon-video@2x.png';
|
|
|
import AcVideoIcon from '@/assets/images/icon-video-1@2x.png';
|
|
|
+ import VolumeOn from '@/assets/images/Volume-on.png';
|
|
|
+ import VolumeOff from '@/assets/images/Volume-off.png';
|
|
|
|
|
|
export default {
|
|
|
name: 'hotspot',
|
|
@@ -96,6 +118,8 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ VolumeOn,
|
|
|
+ VolumeOff,
|
|
|
m: this.$route.query.m,
|
|
|
id: this.$route.query.id,
|
|
|
// 音频地址
|
|
@@ -139,6 +163,17 @@
|
|
|
return this.data[this.myType] || [];
|
|
|
},
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ audioSta(val) {
|
|
|
+ if (val) {
|
|
|
+ this.$refs.volumeRef.play();
|
|
|
+ this.$refs.volumeRef.onended = () => {
|
|
|
+ // console.log("----音频播放完毕");
|
|
|
+ this.audioSta = false;
|
|
|
+ };
|
|
|
+ } else this.$refs.volumeRef.pause();
|
|
|
+ },
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.getData();
|
|
|
},
|
|
@@ -165,6 +200,11 @@
|
|
|
if (resData.video) {
|
|
|
obj.video = resData.video;
|
|
|
arr.push({ id: 2, type: 'video', name: '视频', icon: VideoIcon, acIcon: AcVideoIcon });
|
|
|
+ } else {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.audioSta = true;
|
|
|
+ this.$refs.volumeRef.play();
|
|
|
+ });
|
|
|
}
|
|
|
if (resData.images) {
|
|
|
obj.img = resData.images;
|