原接口已挂,暂时切换到临时接口

This commit is contained in:
lyswhut
2019-08-17 21:43:53 +08:00
parent 214745ae87
commit 6e07719c2c
9 changed files with 113 additions and 37 deletions
+7 -6
View File
@@ -8,6 +8,8 @@ const state = {
changePlay: false,
}
let request
// getters
const getters = {
list: state => state.list || [],
@@ -19,13 +21,12 @@ const getters = {
// actions
const actions = {
getUrl({ commit, state }, { musicInfo, 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 })
if (request && request.cancelHttp) request.cancelHttp()
request = music[musicInfo.source].getMusicUrl(musicInfo, type)
return request.promise.then(result => {
commit('setUrl', { musicInfo, url: result.url, type })
}).finally(() => {
state.cancelFn = null
request = null
})
},
getPic({ commit, state }, musicInfo) {