新增:直接播放QQ音乐排行榜音乐

This commit is contained in:
lyswhut
2019-08-17 02:22:43 +08:00
parent 43bc2b6b90
commit bccadcf13d
21 changed files with 241 additions and 108 deletions
+8 -1
View File
@@ -19,7 +19,14 @@ const getters = {
// actions
const actions = {
getUrl({ commit, state }, { musicInfo, type }) {
return music[musicInfo.source].getMusicUrl(musicInfo, type).then(result => commit('setUrl', { musicInfo, url: result.url, type }))
if (state.cancelFn) state.cancelFn()
const { promise, cancelHttp } = music[musicInfo.source].getMusicUrl(musicInfo, type)
state.cancelFn = cancelHttp
return promise.then(result => {
return commit('setUrl', { musicInfo, url: result.url, type })
}).finally(() => {
state.cancelFn = null
})
},
getPic({ commit, state }, musicInfo) {
return music[musicInfo.source].getPic(musicInfo).then(url => commit('getPic', { musicInfo, url }))