优化歌单、排行榜一键播放按钮的播放机制

This commit is contained in:
lyswhut
2021-12-23 15:28:01 +08:00
parent 469a88f368
commit 3ff0dbb7ef
6 changed files with 91 additions and 18 deletions
+4
View File
@@ -49,6 +49,7 @@ export const loveList = reactive({
export const tempList = reactive({
id: 'temp',
name: '临时列表',
meta: {},
})
export const userLists = window.userLists = reactive([])
@@ -88,13 +89,16 @@ export const updateList = ({
list,
source,
sourceListId,
meta,
locationUpdateTime,
}) => {
let targetList
switch (id) {
case defaultList.id:
case loveList.id:
break
case tempList.id:
tempList.meta = meta || {}
break
default:
targetList = userLists.find(l => l.id == id)
@@ -39,14 +39,17 @@ const useInitEnvParamPlay = () => {
const playSongListDetail = async(source, link, playIndex) => {
if (link == null) return
let list
let id
try {
list = await getListDetailAll({ source, id: decodeURIComponent(link) })
id = decodeURIComponent(link)
list = await getListDetailAll({ source, id })
} catch (err) {
console.log(err)
}
setTempList({
list,
index: getListPlayIndex(list, playIndex),
id: `${source}__${id}`,
})
}