mark
parent
ea733cad04
commit
19de946df1
|
@ -24,7 +24,8 @@ import {
|
|||
} from '@renderer/store/player/state'
|
||||
// import { togglePlay, playNext, playPrev } from '@renderer/core/player'
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
// todo 点击item切换歌曲
|
||||
// todo 当前播放歌曲的item高亮
|
||||
const playlist = ref(tempPlayList)
|
||||
const songs = computed(() =>
|
||||
playlist.value.map(music => ({
|
||||
|
|
|
@ -490,6 +490,14 @@ export const playNext = 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) {
|
||||
handleToggleStop()
|
||||
return
|
||||
|
|
|
@ -230,6 +230,8 @@ export const clearPlayedList = () => {
|
|||
* @param list 歌曲列表
|
||||
*///todo
|
||||
export const addTempPlayList = (list: LX.Player.TempPlayListItem[]) => {
|
||||
// todo 添加到下一首播放而不是到最后一首
|
||||
// todo 重复歌曲不添加
|
||||
const topList: Array<Omit<LX.Player.TempPlayListItem, 'top'>> = []
|
||||
const bottomList = list.filter(({ isTop, ...musicInfo }) => {
|
||||
if (isTop) {
|
||||
|
|
|
@ -73,6 +73,7 @@ export const tempPlayList = shallowReactive<LX.Player.PlayMusicInfo[]>([])//todo
|
|||
|
||||
export const currentPlayIndex = ref<number>(0)
|
||||
|
||||
export const currentPlaybackOrder = ref<number[]>([])
|
||||
|
||||
window.lxData.playInfo = playInfo
|
||||
window.lxData.playMusicInfo = playMusicInfo
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
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 { appSetting } from '@renderer/store/setting'
|
||||
// import { arrShuffle } from '@common/utils/common'
|
||||
// setup 函数或组件初始化中
|
||||
|
||||
|
||||
|
@ -22,6 +24,10 @@ export default ({ props, selectedList, list, removeAllSelect }) => {
|
|||
for(let music of currentchooselist) {
|
||||
addTempPlayList([{ listId: props.listId, musicInfo: music }])
|
||||
}
|
||||
if (appSetting['player.togglePlayMethod'] == 'random') {
|
||||
// todo 随机播放
|
||||
// arrShuffle(tempPlayList)
|
||||
}
|
||||
playNext()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue