hookehuyr

✨ feat: 在浮动窗点击音频播放,跳转到详情页并且播放

客户需求
1 <!-- 1 <!--
2 * @Date: 2024-09-15 22:08:49 2 * @Date: 2024-09-15 22:08:49
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-10-27 12:16:50 4 + * @LastEditTime: 2024-10-30 16:46:08
5 * @FilePath: /map-demo/src/views/bieyuan/info.vue 5 * @FilePath: /map-demo/src/views/bieyuan/info.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
26 <div style="display: flex; justify-content: space-between;"> 26 <div style="display: flex; justify-content: space-between;">
27 <p class="info-title">{{ page_details.name }}</p> 27 <p class="info-title">{{ page_details.name }}</p>
28 <div style="display: flex;"> 28 <div style="display: flex;">
29 - <div v-if="show_audio" @click="onClickAudioList" style="margin-right: 0.75rem;"> 29 + <div @click="onClickAudioList" style="margin-right: 0.75rem;">
30 <van-icon v-if="!audio_list_height" name="https://cdn.ipadbiz.cn/bieyuan/map/icon/%E8%AF%AD%E9%9F%B31@3x.png" size="1.65rem" /> 30 <van-icon v-if="!audio_list_height" name="https://cdn.ipadbiz.cn/bieyuan/map/icon/%E8%AF%AD%E9%9F%B31@3x.png" size="1.65rem" />
31 <van-icon v-else name="https://cdn.ipadbiz.cn/bieyuan/map/icon/%E8%AF%AD%E9%9F%B32@3x.png" size="1.65rem" /> 31 <van-icon v-else name="https://cdn.ipadbiz.cn/bieyuan/map/icon/%E8%AF%AD%E9%9F%B32@3x.png" size="1.65rem" />
32 </div> 32 </div>
...@@ -233,6 +233,10 @@ onMounted(async () => { ...@@ -233,6 +233,10 @@ onMounted(async () => {
233 scrollTop.value = $(evt.currentTarget).scrollTop(); // 获取滚动的垂直距离 233 scrollTop.value = $(evt.currentTarget).scrollTop(); // 获取滚动的垂直距离
234 }) 234 })
235 }) 235 })
236 + // 如果是从浮动窗口点击进来音频播放,自动打开
237 + if ($route.query.source === 'click_audio') {
238 + audio_list_height.value = (0.2 * window.innerHeight);
239 + }
236 }); 240 });
237 241
238 onUnmounted(() => { // 离开页面时关闭音频播放 242 onUnmounted(() => { // 离开页面时关闭音频播放
...@@ -381,24 +385,36 @@ const show_shrink = computed(() => { ...@@ -381,24 +385,36 @@ const show_shrink = computed(() => {
381 const audio_list_height = ref(0); 385 const audio_list_height = ref(0);
382 386
383 const onClickAudioList = () => { 387 const onClickAudioList = () => {
388 + if ($('.info-page').height() < $(window).height()) { // 在浮动模式下点击音频列表
389 + // 打开页面
390 + $router.push({
391 + path: '/bieyuan/info',
392 + query: {
393 + id: $route.query.id,
394 + marker_id: props.info.id,
395 + source: 'click_audio'
396 + }
397 + });
398 + } else { // 详情页内点击
384 audio_list_height.value = (0.2 * window.innerHeight); 399 audio_list_height.value = (0.2 * window.innerHeight);
400 + }
385 } 401 }
386 402
387 const onCloseAudioList = () => { 403 const onCloseAudioList = () => {
388 audio_list_height.value = 0; 404 audio_list_height.value = 0;
389 } 405 }
390 406
391 -const show_audio = ref(true); 407 +// const show_audio = ref(true);
392 408
393 const onStatusAudioList = (status) => { // 音频列表组件,状态改变 409 const onStatusAudioList = (status) => { // 音频列表组件,状态改变
394 page_details.value.experience_audio?.forEach(item => item.play = false); 410 page_details.value.experience_audio?.forEach(item => item.play = false);
395 audio.value.pause(); 411 audio.value.pause();
396 play_audio_index.value = null; 412 play_audio_index.value = null;
397 store.changeAudioStatus('pause'); 413 store.changeAudioStatus('pause');
398 - // 反馈播放列表数量为空时,隐藏图标 414 + // // 反馈播放列表数量为空时,隐藏图标
399 - if (status === 'none') { 415 + // if (status === 'none') {
400 - show_audio.value = false; 416 + // show_audio.value = false;
401 - } 417 + // }
402 } 418 }
403 </script> 419 </script>
404 420
......