mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-24 16:27:23 +08:00
🐞 fix(Play): 修复播放监听和vip歌曲解析问题
This commit is contained in:
@@ -196,6 +196,13 @@ const onAudio = () => {
|
|||||||
audio.value.removeEventListener('ended', handleEnded)
|
audio.value.removeEventListener('ended', handleEnded)
|
||||||
audio.value.addEventListener('timeupdate', handleGetAudioTime)
|
audio.value.addEventListener('timeupdate', handleGetAudioTime)
|
||||||
audio.value.addEventListener('ended', handleEnded)
|
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);
|
background-color: rgba(0, 0, 0, 0.747);
|
||||||
|
|
||||||
.music-content {
|
.music-content {
|
||||||
width: 200px;
|
width: 140px;
|
||||||
@apply ml-4;
|
@apply ml-4;
|
||||||
|
|
||||||
&-title {
|
&-title {
|
||||||
|
|||||||
+5
-6
@@ -1,5 +1,5 @@
|
|||||||
import { createStore } from "vuex";
|
import { createStore } from 'vuex'
|
||||||
import { SongResult } from "@/type/music";
|
import { SongResult } from '@/type/music'
|
||||||
import { getMusicUrl, getParsingMusicUrl } from '@/api/music'
|
import { getMusicUrl, getParsingMusicUrl } from '@/api/music'
|
||||||
import homeRouter from '@/router/home'
|
import homeRouter from '@/router/home'
|
||||||
import { getMusicProxyUrl } from '@/utils'
|
import { getMusicProxyUrl } from '@/utils'
|
||||||
@@ -67,7 +67,7 @@ const getSongUrl = async (id: number) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('error', error)
|
console.error('error', error)
|
||||||
}
|
}
|
||||||
url = data.data[0].url
|
url = url ? url : data.data[0].url
|
||||||
return getMusicProxyUrl(url)
|
return getMusicProxyUrl(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,10 +77,9 @@ const updatePlayMusic = async (state: State) => {
|
|||||||
state.play = true
|
state.play = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const store = createStore({
|
const store = createStore({
|
||||||
state: state,
|
state: state,
|
||||||
mutations: mutations,
|
mutations: mutations,
|
||||||
});
|
})
|
||||||
|
|
||||||
export default store;
|
export default store
|
||||||
|
|||||||
Reference in New Issue
Block a user