diff --git a/src/renderer/store/modules/songList.js b/src/renderer/store/modules/songList.js index e94873e3..ccb4eec2 100644 --- a/src/renderer/store/modules/songList.js +++ b/src/renderer/store/modules/songList.js @@ -67,7 +67,6 @@ const actions = { let source = rootState.setting.songList.source let key = `${source}${id}${page}` if (state.listDetail.list.length && state.listDetail.key == key) return true - commit('clearListDetail') return music[source].songList.getListDetail(id, page).then(result => commit('setListDetail', { result, key, page })) }, } @@ -98,6 +97,7 @@ const mutations = { state.selectListInfo = info }, clearListDetail(state) { + console.log('object') state.listDetail.list = [] }, } diff --git a/src/renderer/utils/music/kw/songList.js b/src/renderer/utils/music/kw/songList.js index e34bc159..0c75b125 100644 --- a/src/renderer/utils/music/kw/songList.js +++ b/src/renderer/utils/music/kw/songList.js @@ -86,7 +86,6 @@ export default { } else { id = null } - console.log(id, type) this._requestObj_list = httpFatch(this.getListUrl({ sortId, id, type, page })) return this._requestObj_list.promise.then(({ body }) => { if (!id || type == '10000') { diff --git a/src/renderer/views/SongList.vue b/src/renderer/views/SongList.vue index 2222fbaf..5accd32f 100644 --- a/src/renderer/views/SongList.vue +++ b/src/renderer/views/SongList.vue @@ -27,7 +27,7 @@ p(:title="item.desc") {{item.desc}} li(:class="$style.item" style="cursor: default;" v-if="listData.list && listData.list.length && listData.list.length % 3 == 2") div(:class="$style.pagination") - material-pagination(:count="listData.total" :limit="listData.limit" :page="listData.page" @btn-click="handleTogglePage") + material-pagination(:count="listData.total" :limit="listData.limit" :page="listData.page" @btn-click="handleToggleListPage") material-download-modal(:show="isShowDownload" :musicInfo="musicInfo" @select="handleAddDownload" @close="isShowDownload = false") material-download-multiple-modal(:show="isShowDownloadMultiple" :list="selectdData" @select="handleAddDownloadMultiple" @close="isShowDownloadMultiple = false") @@ -118,7 +118,7 @@ export default { methods: { ...mapMutations(['setSongList']), ...mapActions('songList', ['getTags', 'getList', 'getListDetail']), - ...mapMutations('songList', ['setVisibleListDetail', 'setSelectListInfo']), + ...mapMutations('songList', ['setVisibleListDetail', 'setSelectListInfo', 'clearListDetail']), ...mapActions('download', ['createDownload', 'createDownloadMultiple']), ...mapMutations('list', ['defaultListAdd', 'defaultListAddMultiple']), ...mapMutations('player', ['setList']), @@ -170,13 +170,20 @@ export default { }, }) }, - handleTogglePage(page) { + handleToggleListPage(page) { this.getList(page).then(() => { this.$nextTick(() => { scrollTo(this.$refs.dom_scrollContent, 0) }) }) }, + handleToggleListDetailPage(page) { + this.getListDetail({ id: this.selectListInfo.id, page }).then(() => { + this.$nextTick(() => { + scrollTo(this.$refs.dom_scrollContent, 0) + }) + }) + }, handleAddDownload(type) { this.createDownload({ musicInfo: this.musicInfo, type }) this.isShowDownload = false @@ -194,7 +201,10 @@ export default { handleItemClick(index) { this.setSelectListInfo(this.listData.list[index]) this.setVisibleListDetail(true) - this.getListDetail({ id: this.selectListInfo.id, page: 1 }) + this.clearListDetail() + this.$nextTick(() => { + this.getListDetail({ id: this.selectListInfo.id, page: 1 }) + }) }, handleFlowBtnClick(action) { switch (action) { @@ -215,7 +225,7 @@ export default { case 'listBtnClick': return this.handleListBtnClick(data) case 'togglePage': - return this.handleTogglePage(data) + return this.handleToggleListDetailPage(data) case 'flowBtnClick': return this.handleFlowBtnClick(data) case 'testPlay':