优化临时播放逻辑

This commit is contained in:
lyswhut
2023-01-11 09:28:31 +08:00
parent bf310adc12
commit 9cc36e2a6a
11 changed files with 20 additions and 14 deletions
@@ -65,6 +65,7 @@ import {
} from '@renderer/store/player/action'
import { appSetting } from '@renderer/store/setting'
import { togglePlay, playNext, playPrev } from '@renderer/core/player'
import { LIST_IDS } from '@common/constants'
export default {
name: 'CorePlayBar',
@@ -98,7 +99,7 @@ export default {
const handleToMusicLocation = () => {
const listId = playMusicInfo.listId
if (!listId || listId == '__temp__' || listId == 'download' || !playMusicInfo.musicInfo) return
if (!listId || listId == LIST_IDS.DOWNLOAD || !playMusicInfo.musicInfo) return
if (playInfo.playIndex == -1) return
router.push({
path: '/list',
@@ -65,6 +65,7 @@ import {
} from '@renderer/store/player/action'
import { appSetting } from '@renderer/store/setting'
import { togglePlay, playNext, playPrev } from '@renderer/core/player'
import { LIST_IDS } from '@common/constants'
export default {
name: 'CorePlayBar',
@@ -98,7 +99,7 @@ export default {
const handleToMusicLocation = () => {
const listId = playMusicInfo.listId
if (!listId || listId == '__temp__' || listId == 'download' || !playMusicInfo.musicInfo) return
if (!listId || listId == LIST_IDS.DOWNLOAD || !playMusicInfo.musicInfo) return
if (playInfo.playIndex == -1) return
router.push({
path: '/list',
@@ -67,6 +67,7 @@ import {
} from '@renderer/store/player/action'
import { appSetting } from '@renderer/store/setting'
import { togglePlay, playNext, playPrev } from '@renderer/core/player'
import { LIST_IDS } from '@common/constants'
export default {
name: 'CorePlayBar',
@@ -100,7 +101,7 @@ export default {
const handleToMusicLocation = () => {
const listId = playMusicInfo.listId
if (!listId || listId == '__temp__' || listId == 'download' || !playMusicInfo.musicInfo) return
if (!listId || listId == LIST_IDS.DOWNLOAD || !playMusicInfo.musicInfo) return
if (playInfo.playIndex == -1) return
router.push({
path: '/list',
@@ -5,6 +5,7 @@ import { addTempPlayList } from '@renderer/store/player/action'
import { appSetting } from '@renderer/store/setting'
import { Ref } from '@common/utils/vueTools'
import { playList } from '@renderer/core/player'
import { LIST_IDS } from '@common/constants'
export default ({ selectedList, props, removeAllSelect, emit }: {
selectedList: Ref<LX.Music.MusicInfoOnline[]>
@@ -34,10 +35,10 @@ export default ({ selectedList, props, removeAllSelect, emit }: {
const handlePlayMusicLater = (index: number, single: boolean) => {
if (selectedList.value.length && !single) {
addTempPlayList(selectedList.value.map(s => ({ listId: '__temp__', musicInfo: s })))
addTempPlayList(selectedList.value.map(s => ({ listId: LIST_IDS.PLAY_LATER, musicInfo: s })))
removeAllSelect()
} else {
addTempPlayList([{ listId: '__temp__', musicInfo: props.list[index] }])
addTempPlayList([{ listId: LIST_IDS.PLAY_LATER, musicInfo: props.list[index] }])
}
}