diff --git a/publish/changeLog.md b/publish/changeLog.md index ea180727..42066116 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -12,6 +12,7 @@ - 优化列表性能,软件整体性能 - 调整Mac平台下的图标大小 - 同步功能添加对列表顺序调整的控制,确保手动调整位置后的列表与不同的电脑同步时,列表位置不会被还原 +- 优化歌单详情、排行榜名右键的播放按钮的播放机制,现在不用等待整个列表(多页时)加载完成才能播放了 ### 修复 diff --git a/src/renderer/core/share/list.js b/src/renderer/core/share/list.js index a1a9c876..07f4d983 100644 --- a/src/renderer/core/share/list.js +++ b/src/renderer/core/share/list.js @@ -49,6 +49,7 @@ export const loveList = reactive({ export const tempList = reactive({ id: 'temp', name: '临时列表', + meta: {}, }) export const userLists = window.userLists = reactive([]) @@ -88,13 +89,16 @@ export const updateList = ({ list, source, sourceListId, + meta, locationUpdateTime, }) => { let targetList switch (id) { case defaultList.id: case loveList.id: + break case tempList.id: + tempList.meta = meta || {} break default: targetList = userLists.find(l => l.id == id) diff --git a/src/renderer/core/useApp/useHandleEnvParams.js b/src/renderer/core/useApp/useHandleEnvParams.js index ac0612d2..c03a88be 100644 --- a/src/renderer/core/useApp/useHandleEnvParams.js +++ b/src/renderer/core/useApp/useHandleEnvParams.js @@ -39,14 +39,17 @@ const useInitEnvParamPlay = () => { const playSongListDetail = async(source, link, playIndex) => { if (link == null) return let list + let id try { - list = await getListDetailAll({ source, id: decodeURIComponent(link) }) + id = decodeURIComponent(link) + list = await getListDetailAll({ source, id }) } catch (err) { console.log(err) } setTempList({ list, index: getListPlayIndex(list, playIndex), + id: `${source}__${id}`, }) } diff --git a/src/renderer/store/modules/player.js b/src/renderer/store/modules/player.js index 3234dee4..9ecd6291 100644 --- a/src/renderer/store/modules/player.js +++ b/src/renderer/store/modules/player.js @@ -388,14 +388,18 @@ const mutations = { if (tempPlayList.length) this.commit('player/clearTempPlayeList') playMusic() }, - setTempList(state, { list, index }) { - updateList({ id: tempList.id, list }) + setTempList(state, { list, id, index }) { + updateList({ id: tempList.id, meta: { id }, list }) this.commit('player/setList', { listId: tempList.id, index, }) window.eventHub.emit(eventListNames.listChange, [tempList.id]) }, + updateTempList(state, { id, list }) { + updateList({ id: tempList.id, meta: { id }, list }) + window.eventHub.emit(eventListNames.listChange, [tempList.id]) + }, // setPlayIndex(state, index) { // state.playIndex = index // }, diff --git a/src/renderer/views/Leaderboard.vue b/src/renderer/views/Leaderboard.vue index 45f7e42a..34114d61 100644 --- a/src/renderer/views/Leaderboard.vue +++ b/src/renderer/views/Leaderboard.vue @@ -36,6 +36,7 @@ diff --git a/src/renderer/views/songList/SongList.vue b/src/renderer/views/songList/SongList.vue index 24ed4e53..65f52e8f 100644 --- a/src/renderer/views/songList/SongList.vue +++ b/src/renderer/views/songList/SongList.vue @@ -58,6 +58,7 @@ div(:class="$style.container") import { mapGetters, mapMutations, mapActions } from 'vuex' import { scrollTo } from '@renderer/utils' import TagList from './components/TagList' +import { tempList } from '@renderer/core/share/list' export default { name: 'SongList', components: { @@ -181,6 +182,7 @@ export default { ...mapMutations('list', ['listAdd', 'listAddMultiple', 'createUserList']), ...mapMutations('player', { setTempList: 'setTempList', + updateTempList: 'updateTempList', setTempPlayList: 'setTempPlayList', }), listenEvent() { @@ -295,12 +297,32 @@ export default { }, async playSongListDetail() { if (!this.listDetail.info.name) return + const id = `${this.listDetail.source}__${this.listDetail.id}` + let isPlayingList = false + if (this.listDetail.list?.length) { + this.setTempList({ + list: [...this.listDetail.list], + index: 0, + id, + }) + isPlayingList = true + } const list = await this.fetchList() if (!list.length) return - this.setTempList({ - list, - index: 0, - }) + if (isPlayingList) { + if (tempList.meta.id == id) { + this.updateTempList({ + list, + id, + }) + } + } else { + this.setTempList({ + list, + index: 0, + id, + }) + } }, }, }