Merge branch 'dev' of github.com:lyswhut/lx-music-desktop into dev

pull/389/head
lyswhut 2020-09-28 08:35:53 +08:00
commit a68c626fa2
5 changed files with 18 additions and 17 deletions

View File

@ -1,8 +1,11 @@
### 优化
- 优化我的列表滚动条位置的保存逻辑
- 更新设置-备份与恢复功能的描述
- 修复初始化搜索历史列表功能
- 修复重启软件后试听列表与收藏列表无法恢复上次的滚动位置的问题
### 修复 ### 修复
- 修复桌面歌词窗口不允许拖出桌面之外的位置计算偏移Bug - 修复桌面歌词窗口不允许拖出桌面之外的位置计算偏移Bug
- 修复网易云KTV嗨榜无法加载的问题 - 修复网易云KTV嗨榜无法加载的问题
### 优化
- 更新设置-备份与恢复功能的描述

View File

@ -48,7 +48,6 @@ const names = {
get_playlist: 'get_playlist', get_playlist: 'get_playlist',
save_playlist: 'save_playlist', save_playlist: 'save_playlist',
get_data: 'get_data', get_data: 'get_data',
set_data: 'set_data',
save_data: 'save_data', save_data: 'save_data',
get_hot_key: 'get_hot_key', get_hot_key: 'get_hot_key',
}, },

View File

@ -94,7 +94,7 @@ export default {
}) })
}, 1000) }, 1000)
this.saveSearchHistoryList = throttle(n => { this.saveSearchHistoryList = throttle(n => {
rendererSend(NAMES.mainWindow.set_data, { rendererSend(NAMES.mainWindow.save_data, {
path: 'searchHistoryList', path: 'searchHistoryList',
data: n, data: n,
}) })
@ -292,7 +292,7 @@ export default {
rendererInvoke(NAMES.mainWindow.get_data, 'searchHistoryList').then(historyList => { rendererInvoke(NAMES.mainWindow.get_data, 'searchHistoryList').then(historyList => {
if (historyList == null) { if (historyList == null) {
historyList = [] historyList = []
rendererInvoke(NAMES.mainWindow.set_data, { path: 'searchHistoryList', data: historyList }) rendererSend(NAMES.mainWindow.save_data, { path: 'searchHistoryList', data: historyList })
} else { } else {
this.setSearchHistoryList(historyList) this.setSearchHistoryList(historyList)
} }

View File

@ -54,8 +54,8 @@ const actions = {
// mitations // mitations
const mutations = { const mutations = {
initList(state, { defaultList, loveList, userList }) { initList(state, { defaultList, loveList, userList }) {
if (defaultList != null) state.defaultList.list = defaultList.list if (defaultList != null) Object.assign(state.defaultList, { list: defaultList.list, location: defaultList.location })
if (loveList != null) state.loveList.list = loveList.list if (loveList != null) Object.assign(state.loveList, { list: loveList.list, location: loveList.location })
if (userList != null) state.userList = userList if (userList != null) state.userList = userList
allListInit(state.defaultList, state.loveList, state.userList) allListInit(state.defaultList, state.loveList, state.userList)
state.isInitedList = true state.isInitedList = true

View File

@ -86,7 +86,6 @@ export default {
// isShowEditBtn: false, // isShowEditBtn: false,
isShowDownloadMultiple: false, isShowDownloadMultiple: false,
delayShow: false, delayShow: false,
routeLeaveLocation: null,
isShowListAdd: false, isShowListAdd: false,
isShowListAddMultiple: false, isShowListAddMultiple: false,
delayTimeout: null, delayTimeout: null,
@ -289,18 +288,14 @@ export default {
// }, // },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.clearDelayTimeout() this.clearDelayTimeout()
this.routeLeaveLocation = (this.list.length && this.$refs.dom_scrollContent.scrollTop) || 0 this.setListScroll({ id: this.listId, location: (this.list.length && this.$refs.dom_scrollContent.scrollTop) || 0 })
next() next()
}, },
created() { created() {
this.listId = this.$route.query.id || this.defaultList.id this.listId = this.$route.query.id || this.defaultList.id
this.setPrevSelectListId(this.listId) this.setPrevSelectListId(this.listId)
this.handleScroll = throttle(e => { this.handleSaveScroll = throttle((listId, location) => {
if (this.routeLeaveLocation) { this.setListScroll({ id: listId, location })
this.setListScroll({ id: this.listId, location: this.routeLeaveLocation })
} else {
this.setListScroll({ id: this.listId, location: e.target.scrollTop })
}
}, 1000) }, 1000)
this.listenEvent() this.listenEvent()
}, },
@ -310,6 +305,7 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
this.unlistenEvent() this.unlistenEvent()
this.setListScroll({ id: this.listId, location: (this.list.length && this.$refs.dom_scrollContent.scrollTop) || 0 })
}, },
methods: { methods: {
...mapMutations(['setPrevSelectListId']), ...mapMutations(['setPrevSelectListId']),
@ -369,6 +365,9 @@ export default {
this.restoreScroll(this.$route.query.scrollIndex, false) this.restoreScroll(this.$route.query.scrollIndex, false)
} }
}, },
handleScroll(e) {
this.handleSaveScroll(this.listId, e.target.scrollTop)
},
clearDelayTimeout() { clearDelayTimeout() {
if (this.delayTimeout) { if (this.delayTimeout) {
clearTimeout(this.delayTimeout) clearTimeout(this.delayTimeout)