🐞 fix(Play): 修复播放监听和vip歌曲解析问题

This commit is contained in:
alger
2023-12-21 11:26:03 +08:00
parent 19140cd680
commit 7e6788a057
2 changed files with 13 additions and 7 deletions

View File

@@ -196,6 +196,13 @@ const onAudio = () => {
audio.value.removeEventListener('ended', handleEnded)
audio.value.addEventListener('timeupdate', handleGetAudioTime)
audio.value.addEventListener('ended', handleEnded)
// 监听音乐播放暂停
audio.value.addEventListener('pause', () => {
store.commit('setPlayMusic', false)
})
audio.value.addEventListener('play', () => {
store.commit('setPlayMusic', true)
})
}
}
@@ -259,7 +266,7 @@ const setMusicFull = () => {
background-color: rgba(0, 0, 0, 0.747);
.music-content {
width: 200px;
width: 140px;
@apply ml-4;
&-title {

View File

@@ -1,5 +1,5 @@
import { createStore } from "vuex";
import { SongResult } from "@/type/music";
import { createStore } from 'vuex'
import { SongResult } from '@/type/music'
import { getMusicUrl, getParsingMusicUrl } from '@/api/music'
import homeRouter from '@/router/home'
import { getMusicProxyUrl } from '@/utils'
@@ -67,7 +67,7 @@ const getSongUrl = async (id: number) => {
} catch (error) {
console.error('error', error)
}
url = data.data[0].url
url = url ? url : data.data[0].url
return getMusicProxyUrl(url)
}
@@ -77,10 +77,9 @@ const updatePlayMusic = async (state: State) => {
state.play = true
}
const store = createStore({
state: state,
mutations: mutations,
});
})
export default store;
export default store