|
@@ -217,17 +217,6 @@
|
|
>
|
|
>
|
|
</button>
|
|
</button>
|
|
<button
|
|
<button
|
|
- v-if="hasMusic"
|
|
|
|
- @click="isMusicOn = !isMusicOn"
|
|
|
|
- >
|
|
|
|
- <img
|
|
|
|
- class=""
|
|
|
|
- :src="require(`@/assets/images/icon_music_${isMusicOn ? 'on' : 'off'}.png`)"
|
|
|
|
- alt=""
|
|
|
|
- draggable="false"
|
|
|
|
- >
|
|
|
|
- </button>
|
|
|
|
- <button
|
|
|
|
v-if="canRecord && activeTabIndex === 0"
|
|
v-if="canRecord && activeTabIndex === 0"
|
|
@click="$router.push({name: 'RecordView', query: {
|
|
@click="$router.push({name: 'RecordView', query: {
|
|
url: encodeURI(`${prefix}/web-model/index.html#/relic-detail?model-path=${encodeURIComponent(modelUrlList[activeSwiperItemIndex].filePath)}`)
|
|
url: encodeURI(`${prefix}/web-model/index.html#/relic-detail?model-path=${encodeURIComponent(modelUrlList[activeSwiperItemIndex].filePath)}`)
|
|
@@ -249,13 +238,6 @@
|
|
>
|
|
>
|
|
</button>
|
|
</button>
|
|
</menu>
|
|
</menu>
|
|
-
|
|
|
|
- <audio
|
|
|
|
- v-if="hasMusic"
|
|
|
|
- ref="bgAudio"
|
|
|
|
- :src="musicUrl"
|
|
|
|
- style="display: none;"
|
|
|
|
- />
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -268,6 +250,7 @@ import {
|
|
ref,
|
|
ref,
|
|
toRefs,
|
|
toRefs,
|
|
watch,
|
|
watch,
|
|
|
|
+ onUnmounted,
|
|
} from 'vue'
|
|
} from 'vue'
|
|
import { useRoute } from "vue-router"
|
|
import { useRoute } from "vue-router"
|
|
import { useStore } from "vuex"
|
|
import { useStore } from "vuex"
|
|
@@ -365,22 +348,6 @@ export default {
|
|
})
|
|
})
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 背景音乐相关。暂时没有详情页背景音乐数据。如果有,会与整个网站的背景音乐相冲突,再考虑视频播放时的声音,会更复杂。
|
|
|
|
- */
|
|
|
|
- const bgAudio = ref(null)
|
|
|
|
- const hasMusic = ref(false)
|
|
|
|
- const musicUrl = ref(require('@/assets/mock/02.mp3'))
|
|
|
|
- const isMusicOn = ref(false)
|
|
|
|
- watch(isMusicOn, (newV) => {
|
|
|
|
- console.log('change!', newV)
|
|
|
|
- if (newV) {
|
|
|
|
- bgAudio.value.play()
|
|
|
|
- } else {
|
|
|
|
- bgAudio.value.pause()
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
* 录屏相关
|
|
* 录屏相关
|
|
*/
|
|
*/
|
|
const canRecord = ref(navigator?.mediaDevices?.getDisplayMedia)
|
|
const canRecord = ref(navigator?.mediaDevices?.getDisplayMedia)
|
|
@@ -418,6 +385,7 @@ export default {
|
|
const modelUrlList = reactive([])
|
|
const modelUrlList = reactive([])
|
|
const videoUrlList = reactive([])
|
|
const videoUrlList = reactive([])
|
|
const imageUrlList = reactive([])
|
|
const imageUrlList = reactive([])
|
|
|
|
+ let isBgAudioChanged = false
|
|
api.getTreasureDetail(route.query.id).then((res) => {
|
|
api.getTreasureDetail(route.query.id).then((res) => {
|
|
rawData.value = res
|
|
rawData.value = res
|
|
for (const iterator of rawData.value.file) {
|
|
for (const iterator of rawData.value.file) {
|
|
@@ -431,6 +399,12 @@ export default {
|
|
case 'img':
|
|
case 'img':
|
|
imageUrlList.push(iterator)
|
|
imageUrlList.push(iterator)
|
|
break
|
|
break
|
|
|
|
+ case 'audio':
|
|
|
|
+ if (!isBgAudioChanged) {
|
|
|
|
+ store.commit('changeBgMusicUrl', iterator.filePath)
|
|
|
|
+ isBgAudioChanged = true
|
|
|
|
+ }
|
|
|
|
+ break
|
|
default:
|
|
default:
|
|
break
|
|
break
|
|
}
|
|
}
|
|
@@ -444,21 +418,23 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+ onUnmounted(() => {
|
|
|
|
+ if (isBgAudioChanged) {
|
|
|
|
+ store.commit('restoreBgMusicUrl')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
return {
|
|
return {
|
|
activeSwiperItemIndex,
|
|
activeSwiperItemIndex,
|
|
activeTabIndex,
|
|
activeTabIndex,
|
|
- bgAudio,
|
|
|
|
bgVideo,
|
|
bgVideo,
|
|
cancelFullScreen,
|
|
cancelFullScreen,
|
|
canRecord,
|
|
canRecord,
|
|
encodeURIComponent,
|
|
encodeURIComponent,
|
|
fullScreenStatus,
|
|
fullScreenStatus,
|
|
- hasMusic,
|
|
|
|
imageUrlList,
|
|
imageUrlList,
|
|
- isMusicOn,
|
|
|
|
isShowTabbar,
|
|
isShowTabbar,
|
|
modelUrlList,
|
|
modelUrlList,
|
|
- musicUrl,
|
|
|
|
onClickFullScreen,
|
|
onClickFullScreen,
|
|
onVideoEnd,
|
|
onVideoEnd,
|
|
onVideoPause,
|
|
onVideoPause,
|