mark
parent
8fd7fa208f
commit
51c08d3bf3
|
@ -15,52 +15,59 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import {
|
||||
statusText,
|
||||
musicInfo,
|
||||
isShowPlayerDetail,
|
||||
isPlay,
|
||||
playInfo,
|
||||
playMusicInfo,
|
||||
// musicInfo,
|
||||
// isPlay,
|
||||
// playMusicInfo, playInfo,
|
||||
tempPlayList,
|
||||
} from '@renderer/store/player/state'
|
||||
import { isPlay, playedList, playInfo, playMusicInfo, tempPlayList, musicInfo as _musicInfo } from '@renderer/store/player/state'
|
||||
import { togglePlay, playNext, playPrev } from '@renderer/core/player'
|
||||
// import { togglePlay, playNext, playPrev } from '@renderer/core/player'
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
const songs = ref([
|
||||
{ title: '海阔天空', artist: 'Beyond', album: '乐与怒' },
|
||||
{ title: '夜曲', artist: '周杰伦', album: '十一月的萧邦' },
|
||||
{ title: '告白气球', artist: '周杰伦', album: '周杰伦的床边故事' },
|
||||
{ title: '平凡之路', artist: '朴树', album: '平凡之路' },
|
||||
])
|
||||
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: musicInfo.name, artist: musicInfo.singer, album: musicInfo.album }
|
||||
const playlist = ref(tempPlayList)
|
||||
const songs = computed(() =>
|
||||
playlist.value.map(music => ({
|
||||
title: music.musicInfo.name,
|
||||
artist: music.musicInfo.singer,
|
||||
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')
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ export const playListById = (listId: string, id: string) => {
|
|||
// pause()
|
||||
const musicInfo = getList(listId).find(m => m.id == id)
|
||||
if (!musicInfo) return
|
||||
setPlayMusicInfo(listId, musicInfo)
|
||||
setPlayMusicInfo(listId, musicInfo)//todo 设置播放音乐
|
||||
if (appSetting['player.isAutoCleanPlayedList'] || prevListId != listId) clearPlayedList()
|
||||
clearTempPlayeList()
|
||||
handlePlay()
|
||||
|
@ -258,7 +258,7 @@ export const playList = (listId: string, index: number) => {
|
|||
const prevListId = playInfo.playerListId
|
||||
setPlayListId(listId)
|
||||
// pause()
|
||||
setPlayMusicInfo(listId, getList(listId)[index])
|
||||
setPlayMusicInfo(listId, getList(listId)[index])//todo 设置播放音乐
|
||||
if (appSetting['player.isAutoCleanPlayedList'] || prevListId != listId) clearPlayedList()
|
||||
clearTempPlayeList()
|
||||
handlePlay()
|
||||
|
@ -366,7 +366,7 @@ export const getNextPlayMusicInfo = async(): Promise<LX.Player.PlayMusicInfo | n
|
|||
|
||||
const handlePlayNext = (playMusicInfo: LX.Player.PlayMusicInfo) => {
|
||||
// pause()
|
||||
setPlayMusicInfo(playMusicInfo.listId, playMusicInfo.musicInfo, playMusicInfo.isTempPlay)
|
||||
setPlayMusicInfo(playMusicInfo.listId, playMusicInfo.musicInfo, playMusicInfo.isTempPlay)//todo 设置播放音乐
|
||||
handlePlay()
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -228,7 +228,7 @@ export const clearPlayedList = () => {
|
|||
/**
|
||||
* 添加歌曲到稍后播放列表
|
||||
* @param list 歌曲列表
|
||||
*/
|
||||
*///todo
|
||||
export const addTempPlayList = (list: LX.Player.TempPlayListItem[]) => {
|
||||
const topList: Array<Omit<LX.Player.TempPlayListItem, 'top'>> = []
|
||||
const bottomList = list.filter(({ isTop, ...musicInfo }) => {
|
||||
|
|
|
@ -69,7 +69,10 @@ export const playInfo = shallowReactive<LX.Player.PlayInfo>({
|
|||
|
||||
export const playedList = window.lxData.playedList = shallowReactive<LX.Player.PlayMusicInfo[]>([])
|
||||
|
||||
export const tempPlayList = shallowReactive<LX.Player.PlayMusicInfo[]>([])
|
||||
export const tempPlayList = shallowReactive<LX.Player.PlayMusicInfo[]>([])//todo
|
||||
|
||||
export const PlayList = shallowReactive<LX.Player.PlayMusicInfo[]>([])
|
||||
|
||||
|
||||
window.lxData.playInfo = playInfo
|
||||
window.lxData.playMusicInfo = playMusicInfo
|
||||
|
|
Loading…
Reference in New Issue