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