pull/2369/head
QiuLiang-99 2025-05-03 15:49:17 +08:00
parent ea733cad04
commit 19de946df1
5 changed files with 20 additions and 2 deletions

View File

@ -24,7 +24,8 @@ import {
} from '@renderer/store/player/state' } 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'])
// todo item
// todo item
const playlist = ref(tempPlayList) const playlist = ref(tempPlayList)
const songs = computed(() => const songs = computed(() =>
playlist.value.map(music => ({ playlist.value.map(music => ({

View File

@ -490,6 +490,14 @@ export const playNext = async(isAutoToggle = false): Promise<void> => {
* *
*/ */
export const playPrev = async(isAutoToggle = false): Promise<void> => { export const playPrev = async(isAutoToggle = false): Promise<void> => {
if (currentPlayIndex.value > 0) { // 如果稍后播放列表存在歌曲则直接播放改列表的歌曲
const playMusicInfo = tempPlayList[--(currentPlayIndex.value) ]
// removeTempPlayList(0)
handlePlayNext(playMusicInfo)
console.log('play temp list')
return
}
////////////预计此处往下的代码失去作用(被接管)/////////////
if (playMusicInfo.musicInfo == null) { if (playMusicInfo.musicInfo == null) {
handleToggleStop() handleToggleStop()
return return

View File

@ -230,6 +230,8 @@ export const clearPlayedList = () => {
* @param list * @param list
*///todo *///todo
export const addTempPlayList = (list: LX.Player.TempPlayListItem[]) => { export const addTempPlayList = (list: LX.Player.TempPlayListItem[]) => {
// todo 添加到下一首播放而不是到最后一首
// todo 重复歌曲不添加
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 }) => {
if (isTop) { if (isTop) {

View File

@ -73,6 +73,7 @@ export const tempPlayList = shallowReactive<LX.Player.PlayMusicInfo[]>([])//todo
export const currentPlayIndex = ref<number>(0) export const currentPlayIndex = ref<number>(0)
export const currentPlaybackOrder = ref<number[]>([])
window.lxData.playInfo = playInfo window.lxData.playInfo = playInfo
window.lxData.playMusicInfo = playMusicInfo window.lxData.playMusicInfo = playMusicInfo

View File

@ -1,6 +1,8 @@
import { addTempPlayList, clearTempPlayeList, getList } from '@renderer/store/player/action' import { addTempPlayList, clearTempPlayeList, getList } from '@renderer/store/player/action'
import { tempPlayList, currentPlayIndex } from '@renderer/store/player/state' import { tempPlayList, currentPlayIndex, currentPlaybackOrder } from '@renderer/store/player/state'
import { playNext } from '@renderer/core/player' import { playNext } from '@renderer/core/player'
import { appSetting } from '@renderer/store/setting'
// import { arrShuffle } from '@common/utils/common'
// setup 函数或组件初始化中 // setup 函数或组件初始化中
@ -22,6 +24,10 @@ export default ({ props, selectedList, list, removeAllSelect }) => {
for(let music of currentchooselist) { for(let music of currentchooselist) {
addTempPlayList([{ listId: props.listId, musicInfo: music }]) addTempPlayList([{ listId: props.listId, musicInfo: music }])
} }
if (appSetting['player.togglePlayMethod'] == 'random') {
// todo 随机播放
// arrShuffle(tempPlayList)
}
playNext() playNext()
} }