实现了播放的逻辑处理,但只接管了“我的列表”的播放行为
parent
22dc28b9e9
commit
ea733cad04
|
@ -33,41 +33,7 @@ const songs = computed(() =>
|
|||
album: music.musicInfo.meta.albumName,
|
||||
})),
|
||||
)
|
||||
// const showPlaylist = () => {
|
||||
// if (tempPlayList.length) { // 如果稍后播放列表存在歌曲则直接播放改列表的歌曲
|
||||
// for (let music of tempPlayList) {
|
||||
// songs.value.push(
|
||||
// {
|
||||
// title: music.musicInfo.name,
|
||||
// artist: music.musicInfo.singer,
|
||||
// album: music.musicInfo.meta.albumName,
|
||||
// },
|
||||
// )
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
// if (playMusicInfo.musicInfo == null) {
|
||||
// handleToggleStop()
|
||||
// console.log('musicInfo empty')
|
||||
// return
|
||||
// }
|
||||
|
||||
// // console.log(playInfo.playerListId)
|
||||
// const currentListId = playInfo.playerListId
|
||||
// if (!currentListId) {
|
||||
// handleToggleStop()
|
||||
// console.log('currentListId empty')
|
||||
// return
|
||||
// }
|
||||
// // const currentList = getList(currentListId)
|
||||
// // songs.value.push({
|
||||
// // title: music.musicInfo.name,
|
||||
// // artist: music.musicInfo.singer,
|
||||
// // album: music.musicInfo.meta.albumName,
|
||||
// // })
|
||||
// }
|
||||
// showPlaylist()
|
||||
const emitClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { isEmpty, setPause, setPlay, setResource, setStop } from '@renderer/plugins/player'
|
||||
import { isPlay, playedList, playInfo, playMusicInfo, tempPlayList, musicInfo as _musicInfo } from '@renderer/store/player/state'
|
||||
import { isPlay, playedList, playInfo, playMusicInfo, tempPlayList, musicInfo as _musicInfo, currentPlayIndex } from '@renderer/store/player/state'
|
||||
import {
|
||||
getList,
|
||||
clearPlayedList,
|
||||
|
@ -376,14 +376,15 @@ const handlePlayNext = (playMusicInfo: LX.Player.PlayMusicInfo) => {
|
|||
*/
|
||||
export const playNext = async(isAutoToggle = false): Promise<void> => {
|
||||
console.log('skip next', isAutoToggle)
|
||||
//todo 需要修改逻辑,不要删除
|
||||
if (tempPlayList.length) { // 如果稍后播放列表存在歌曲则直接播放改列表的歌曲
|
||||
const playMusicInfo = tempPlayList[0]
|
||||
removeTempPlayList(0)
|
||||
const playMusicInfo = tempPlayList[++(currentPlayIndex.value) ]
|
||||
// removeTempPlayList(0)
|
||||
handlePlayNext(playMusicInfo)
|
||||
console.log('play temp list')
|
||||
return
|
||||
}
|
||||
|
||||
////////////预计此处往下的代码失去作用(被接管)/////////////
|
||||
if (playMusicInfo.musicInfo == null) {
|
||||
handleToggleStop()
|
||||
console.log('musicInfo empty')
|
||||
|
|
|
@ -241,7 +241,8 @@ export const addTempPlayList = (list: LX.Player.TempPlayListItem[]) => {
|
|||
if (topList.length) arrUnshift(tempPlayList, topList.map(({ musicInfo, listId }) => ({ musicInfo, listId, isTempPlay: true })))
|
||||
if (bottomList.length) arrPush(tempPlayList, bottomList.map(({ musicInfo, listId }) => ({ musicInfo, listId, isTempPlay: true })))
|
||||
|
||||
if (!playMusicInfo.musicInfo) void playNext()
|
||||
// if (!playMusicInfo.musicInfo) void playNext()
|
||||
// 造成了奇怪的bug
|
||||
}
|
||||
/**
|
||||
* 从稍后播放列表移除歌曲
|
||||
|
|
|
@ -71,7 +71,7 @@ export const playedList = window.lxData.playedList = shallowReactive<LX.Player.P
|
|||
|
||||
export const tempPlayList = shallowReactive<LX.Player.PlayMusicInfo[]>([])//todo
|
||||
|
||||
export const PlayList = shallowReactive<LX.Player.PlayMusicInfo[]>([])
|
||||
export const currentPlayIndex = ref<number>(0)
|
||||
|
||||
|
||||
window.lxData.playInfo = playInfo
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
import { addTempPlayList } from '@renderer/store/player/action'
|
||||
import { playList } from '@renderer/core/player'
|
||||
// import { tempPlayList } from '@renderer/store/player/state'
|
||||
|
||||
import useMusicAdd from '@renderer/views/List/MusicList/useMusicAdd'
|
||||
import { LIST_IDS } from '@common/constants'
|
||||
import { getList } from '@renderer/store/player/action'
|
||||
|
||||
import { addTempPlayList, clearTempPlayeList, getList } from '@renderer/store/player/action'
|
||||
import { tempPlayList, currentPlayIndex } from '@renderer/store/player/state'
|
||||
import { playNext } from '@renderer/core/player'
|
||||
// setup 函数或组件初始化中
|
||||
|
||||
|
||||
|
@ -13,25 +8,21 @@ export default ({ props, selectedList, list, removeAllSelect }) => {
|
|||
let clickTime = 0
|
||||
let clickIndex = -1
|
||||
|
||||
// 处理添加音乐到歌单的逻辑
|
||||
const {
|
||||
// handleShowMusicAddModal,
|
||||
// handleShowMusicMoveModal,
|
||||
} = useMusicAdd({ selectedList, list })
|
||||
|
||||
const handlePlayMusic = (index) => {
|
||||
currentPlayIndex.value = index
|
||||
// todo 播放选中的歌曲
|
||||
// todo 修改播放歌曲逻辑
|
||||
// playList(props.listId, index)
|
||||
// handlePlayMusicLater(index, true)
|
||||
// todo 若为空,则添加整个歌单
|
||||
// todo 歌单本身就有乱序排序功能
|
||||
addTempPlayList([{ listId: props.listId, musicInfo: list.value[index] }])
|
||||
// playList(LIST_IDS.TEMP, index)
|
||||
// const testlist =getList(props.listId)
|
||||
const testlist =getList(LIST_IDS.TEMP)
|
||||
for (let i=0; i<testlist.length; i++){
|
||||
console.log(testlist[i])
|
||||
if (tempPlayList.length > 0 ) {// 双击操作会切换到当前歌单
|
||||
clearTempPlayeList()
|
||||
}
|
||||
const currentchooselist = getList(props.listId)
|
||||
for(let music of currentchooselist) {
|
||||
addTempPlayList([{ listId: props.listId, musicInfo: music }])
|
||||
}
|
||||
playNext()
|
||||
}
|
||||
|
||||
const handlePlayMusicLater = (index, single) => {
|
||||
|
|
Loading…
Reference in New Issue