Showing
5 changed files
with
116 additions
and
16 deletions
| ... | @@ -11,10 +11,12 @@ declare module 'vue' { | ... | @@ -11,10 +11,12 @@ declare module 'vue' { |
| 11 | RouterLink: typeof import('vue-router')['RouterLink'] | 11 | RouterLink: typeof import('vue-router')['RouterLink'] |
| 12 | RouterView: typeof import('vue-router')['RouterView'] | 12 | RouterView: typeof import('vue-router')['RouterView'] |
| 13 | VanActionSheet: typeof import('vant/es')['ActionSheet'] | 13 | VanActionSheet: typeof import('vant/es')['ActionSheet'] |
| 14 | + VanCol: typeof import('vant/es')['Col'] | ||
| 14 | VanField: typeof import('vant/es')['Field'] | 15 | VanField: typeof import('vant/es')['Field'] |
| 15 | VanIcon: typeof import('vant/es')['Icon'] | 16 | VanIcon: typeof import('vant/es')['Icon'] |
| 16 | VanImage: typeof import('vant/es')['Image'] | 17 | VanImage: typeof import('vant/es')['Image'] |
| 17 | VanLoading: typeof import('vant/es')['Loading'] | 18 | VanLoading: typeof import('vant/es')['Loading'] |
| 19 | + VanRow: typeof import('vant/es')['Row'] | ||
| 18 | VanUploader: typeof import('vant/es')['Uploader'] | 20 | VanUploader: typeof import('vant/es')['Uploader'] |
| 19 | } | 21 | } |
| 20 | } | 22 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-04-10 15:08:08 | 2 | * @Date: 2024-04-10 15:08:08 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-04-10 15:54:46 | 4 | + * @LastEditTime: 2024-04-11 16:56:42 |
| 5 | * @FilePath: /fxPark/src/views/fxPark/audio.vue | 5 | * @FilePath: /fxPark/src/views/fxPark/audio.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div class="audio-page"> | 9 | <div class="audio-page"> |
| 10 | <div class="audio-player"> | 10 | <div class="audio-player"> |
| 11 | - <div style="margin-right: 1rem;"> | 11 | + <van-row justify="center" align="center"> |
| 12 | - <van-icon name="circle" size="5rem" /> | 12 | + <van-col span="8"> |
| 13 | + <div> | ||
| 14 | + <div style="width: 5rem; height: 5rem; border-radius: 50%;"> | ||
| 15 | + <img :class="[audioStatus === 'play' ? 'play' : 'pause']" src="https://picsum.photos/50/50" style="width: 5rem; height: 5rem; border-radius: 50%;"> | ||
| 16 | + </div> | ||
| 17 | + </div> | ||
| 18 | + </van-col> | ||
| 19 | + <van-col span="16"> | ||
| 20 | + <div> | ||
| 21 | + <div class="van-ellipsis" style="margin-bottom: 1rem; color: #fff;">{{ audio_list[audioIndex]['audio_name'] }}</div> | ||
| 22 | + <div style="display: flex; justify-content: space-between;"> | ||
| 23 | + <van-icon @click="audioPrev" name="arrow-left" size="1.5rem" /> | ||
| 24 | + <van-icon v-if="audioStatus === 'pause'" name="play" size="1.5rem" @click="handelPlay" /> | ||
| 25 | + <van-icon v-if="audioStatus === 'play'" name="pause" size="1.5rem" @click="handlePause" /> | ||
| 26 | + <van-icon @click="audioNext" name="arrow" size="1.5rem" /> | ||
| 27 | + </div> | ||
| 28 | + </div> | ||
| 29 | + </van-col> | ||
| 30 | + </van-row> | ||
| 31 | + <!-- <div style="margin-right: 1rem; flex: 1;"> | ||
| 32 | + <div style="width: 5rem; height: 5rem; border-radius: 50%;"> | ||
| 33 | + <img :class="[audioStatus === 'play' ? 'play' : 'pause']" src="https://picsum.photos/50/50" style="width: 5rem; height: 5rem; border-radius: 50%;"> | ||
| 34 | + </div> | ||
| 13 | </div> | 35 | </div> |
| 14 | - <div> | 36 | + <div style="flex: 3;"> |
| 15 | - <div style="margin-bottom: 1rem;">微风轻轻吹树叶的声音</div> | 37 | + <div class="van-ellipsis" style="margin-bottom: 1rem; color: #fff;">{{ audio_list[audioIndex]['audio_name'] }}</div> |
| 16 | <div style="display: flex; justify-content: space-between;"> | 38 | <div style="display: flex; justify-content: space-between;"> |
| 17 | - <van-icon name="arrow-left" size="1.5rem" /> | 39 | + <van-icon @click="audioPrev" name="arrow-left" size="1.5rem" /> |
| 18 | - <van-icon name="play" size="1.5rem" @click="audioPlayer.play()" /> | 40 | + <van-icon v-if="audioStatus === 'pause'" name="play" size="1.5rem" @click="handelPlay" /> |
| 19 | - <van-icon name="pause" size="1.5rem" @click="audioPlayer.pause()" /> | 41 | + <van-icon v-if="audioStatus === 'play'" name="pause" size="1.5rem" @click="handlePause" /> |
| 20 | - <van-icon name="arrow" size="1.5rem" /> | 42 | + <van-icon @click="audioNext" name="arrow" size="1.5rem" /> |
| 21 | </div> | 43 | </div> |
| 22 | - </div> | 44 | + </div> --> |
| 23 | <div> | 45 | <div> |
| 24 | - <audio ref="audioPlayer" loop="loop" id="audios" src="https://m10.music.126.net/20240410161841/940e4a035f48a82b1b4d4b01b2e7b1f1/ymusic/5353/0f0f/0358/d99739615f8e5153d77042092f07fd77.mp3" preoload></audio> | 46 | + <audio ref="audioPlayer" loop="loop" id="audios" :src="audio_list[audioIndex]['audio_url']" preoload></audio> |
| 25 | </div> | 47 | </div> |
| 26 | </div> | 48 | </div> |
| 27 | </div> | 49 | </div> |
| ... | @@ -40,6 +62,60 @@ const $router = useRouter(); | ... | @@ -40,6 +62,60 @@ const $router = useRouter(); |
| 40 | useTitle($route.meta.title); | 62 | useTitle($route.meta.title); |
| 41 | 63 | ||
| 42 | const audioPlayer = ref(null); | 64 | const audioPlayer = ref(null); |
| 65 | +const audioStatus = ref('pause'); | ||
| 66 | +const audioIndex = ref(0); | ||
| 67 | + | ||
| 68 | +const handelPlay = () => { | ||
| 69 | + audioPlayer.value.play(); | ||
| 70 | + audioStatus.value = 'play'; | ||
| 71 | +}; | ||
| 72 | + | ||
| 73 | +const handlePause = () => { | ||
| 74 | + audioPlayer.value.pause(); | ||
| 75 | + audioStatus.value = 'pause'; | ||
| 76 | +}; | ||
| 77 | + | ||
| 78 | +const audio_list = ref([{ | ||
| 79 | + audio_url: 'http://downsc.chinaz.net/files/download/sound1/201206/1638.mp3', | ||
| 80 | + audio_cover: '', | ||
| 81 | + audio_name: '微风轻轻吹树叶的声音123467890', | ||
| 82 | + audio_note: '', | ||
| 83 | +}, { | ||
| 84 | + audio_url: 'http://downsc.chinaz.net/Files/DownLoad/sound1/201906/11582.mp3', | ||
| 85 | + audio_cover: '', | ||
| 86 | + audio_name: '微风轻轻吹树叶的声音', | ||
| 87 | + audio_note: '', | ||
| 88 | +}]); | ||
| 89 | + | ||
| 90 | +const replay = () => { | ||
| 91 | + audioPlayer.value.currentTime = 0; | ||
| 92 | + audioPlayer.value.play(); | ||
| 93 | + audioStatus.value = 'play'; | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +const audioPrev = () => { | ||
| 97 | + if (audioIndex.value > 0) { | ||
| 98 | + audioIndex.value--; | ||
| 99 | + } else { | ||
| 100 | + audioIndex.value = audio_list.value.length - 1; | ||
| 101 | + } | ||
| 102 | + // 重新播放 | ||
| 103 | + nextTick(() => { | ||
| 104 | + replay() | ||
| 105 | + }); | ||
| 106 | +}; | ||
| 107 | + | ||
| 108 | +const audioNext = () => { | ||
| 109 | + if (audioIndex.value < audio_list.value.length - 1) { | ||
| 110 | + audioIndex.value++; | ||
| 111 | + } else { | ||
| 112 | + audioIndex.value = 0; | ||
| 113 | + } | ||
| 114 | + // 重新播放 | ||
| 115 | + nextTick(() => { | ||
| 116 | + replay() | ||
| 117 | + }); | ||
| 118 | +}; | ||
| 43 | 119 | ||
| 44 | </script> | 120 | </script> |
| 45 | 121 | ||
| ... | @@ -51,14 +127,29 @@ const audioPlayer = ref(null); | ... | @@ -51,14 +127,29 @@ const audioPlayer = ref(null); |
| 51 | display: flex; | 127 | display: flex; |
| 52 | justify-content: center; | 128 | justify-content: center; |
| 53 | .audio-player { | 129 | .audio-player { |
| 130 | + width: 75vw; | ||
| 54 | border: 1px solid #fff; | 131 | border: 1px solid #fff; |
| 55 | border-radius: 10px; | 132 | border-radius: 10px; |
| 56 | - padding: 1rem 2rem 1rem 1rem; | 133 | + padding: 1rem 1rem 1rem 1rem; |
| 57 | position: absolute; | 134 | position: absolute; |
| 58 | top: 5rem; | 135 | top: 5rem; |
| 59 | display: flex; | 136 | display: flex; |
| 60 | justify-content: center; | 137 | justify-content: center; |
| 61 | align-items: center; | 138 | align-items: center; |
| 139 | + .play { | ||
| 140 | + animation: rotate 8s linear infinite; | ||
| 141 | + } | ||
| 142 | + .pause { | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + @keyframes rotate { | ||
| 146 | + 0% { | ||
| 147 | + transform: rotate(0deg); | ||
| 148 | + } | ||
| 149 | + 100% { | ||
| 150 | + transform: rotate(360deg); | ||
| 151 | + } | ||
| 152 | + } | ||
| 62 | } | 153 | } |
| 63 | } | 154 | } |
| 64 | </style> | 155 | </style> | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-04-07 10:15:55 | 2 | * @Date: 2024-04-07 10:15:55 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-04-11 15:38:58 | 4 | + * @LastEditTime: 2024-04-11 15:45:54 |
| 5 | * @FilePath: /fxPark/src/views/fxPark/index.vue | 5 | * @FilePath: /fxPark/src/views/fxPark/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
| 9 | <div class="fxPark-page"> | 9 | <div class="fxPark-page"> |
| 10 | <danmaku :text="add_text" /> | 10 | <danmaku :text="add_text" /> |
| 11 | <div class="quick-entrance-wrapper"> | 11 | <div class="quick-entrance-wrapper"> |
| 12 | - <div class="quick-entrance-item" style=""> | 12 | + <div class="quick-entrance-item" @click="goToAudio"> |
| 13 | <van-icon name="chat-o" /> <span>植物之声</span> | 13 | <van-icon name="chat-o" /> <span>植物之声</span> |
| 14 | </div> | 14 | </div> |
| 15 | </div> | 15 | </div> |
| ... | @@ -133,6 +133,10 @@ const onCancel = () => { | ... | @@ -133,6 +133,10 @@ const onCancel = () => { |
| 133 | const onShare = () => { | 133 | const onShare = () => { |
| 134 | go('/finish') | 134 | go('/finish') |
| 135 | } | 135 | } |
| 136 | + | ||
| 137 | +const goToAudio = () => { | ||
| 138 | + go('/audio') | ||
| 139 | +} | ||
| 136 | </script> | 140 | </script> |
| 137 | 141 | ||
| 138 | <style lang="less" scoped> | 142 | <style lang="less" scoped> | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-04-10 16:08:09 | 2 | * @Date: 2024-04-10 16:08:09 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-04-10 17:24:25 | 4 | + * @LastEditTime: 2024-04-11 17:10:21 |
| 5 | * @FilePath: /fxPark/src/views/fxPark/intro.vue | 5 | * @FilePath: /fxPark/src/views/fxPark/intro.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -54,6 +54,9 @@ const $route = useRoute(); | ... | @@ -54,6 +54,9 @@ const $route = useRoute(); |
| 54 | const $router = useRouter(); | 54 | const $router = useRouter(); |
| 55 | useTitle($route.meta.title); | 55 | useTitle($route.meta.title); |
| 56 | 56 | ||
| 57 | +const id = $route.query.id; | ||
| 58 | +console.log("🚀 ~ file: intro.vue:58 ~ id:", id); | ||
| 59 | + | ||
| 57 | </script> | 60 | </script> |
| 58 | 61 | ||
| 59 | <style lang="less" scoped> | 62 | <style lang="less" scoped> | ... | ... |
-
Please register or login to post a comment