更新已收藏的在线列表时,将始终重新加载,不再使用缓存

pull/930/merge
lyswhut 2022-01-18 15:34:48 +08:00
parent bad2e98757
commit 30d5f53c1d
5 changed files with 11 additions and 7 deletions

View File

@ -9,6 +9,7 @@
- 为可视化音频的频谱整体添加频谱均值加成,使频谱显示更有节奏感
- 优化程序初始化逻辑,修复无网络的情况下的初始化问题
- 我的列表-列表名的右击菜单更新已收藏的在线列表时将始终重新加载不再使用缓存解决在原平台更新歌单后在LX点击更新可能看到的还是在原平台更新前的歌单的问题
### 修复

View File

@ -66,11 +66,12 @@ const actions = {
return listInfo
})
},
getListAll({ state, rootState }, id) {
getListAll({ state, rootState }, { id, isRefresh = false }) {
// console.log(source, id)
let [source, bangId] = id.split('__')
const loadData = (id, page) => {
let key = `${source}${id}${page}`
if (isRefresh && cache.has(key)) cache.delete(key)
return cache.has(key)
? Promise.resolve(cache.get(key))
: music[source].leaderboard.getList(bangId, page).then(result => {

View File

@ -81,10 +81,11 @@ const actions = {
commit('clearList')
return music[source].songList.getList(sortId, tabId, page).then(result => commit('setList', { result, key, page }))
},
getListDetail({ state, commit }, { id, source, page }) {
getListDetail({ state, commit }, { id, source, page, isRefresh = false }) {
let key = `sdetail__${source}__${id}__${page}`
if (state.listDetail.list.length && state.listDetail.key == key) return Promise.resolve(state.listDetail.list)
commit('clearListDetail')
if (isRefresh && cache.has(key)) cache.delete(key)
return (
cache.has(key)
? Promise.resolve(cache.get(key))
@ -94,10 +95,11 @@ const actions = {
return result.list
})
},
getListDetailAll({ state, rootState }, { source, id }) {
getListDetailAll({ state, rootState }, { source, id, isRefresh = false }) {
// console.log(source, id)
const loadData = (id, page) => {
let key = `sdetail__${source}__${id}__${page}`
if (isRefresh && cache.has(key)) cache.delete(key)
return cache.has(key)
? Promise.resolve(cache.get(key))
: music[source].songList.getListDetail(id, page).then(result => {

View File

@ -211,7 +211,7 @@ export default {
async addSongListDetail({ boardId, boardName, source, id }) {
// console.log(this.listDetail.info)
// if (!this.listDetail.info.name) return
const list = await this.getListAll(boardId)
const list = await this.getListAll({ id: boardId })
this.createUserList({
name: boardName,
id,
@ -230,7 +230,7 @@ export default {
})
isPlayingList = true
}
const fullList = await this.getListAll(boardId)
const fullList = await this.getListAll({ id: boardId })
if (!fullList.length) return
if (isPlayingList) {
if (tempList.meta.id == id) {

View File

@ -339,9 +339,9 @@ export default {
let promise
if (/board__/.test(sourceListId)) {
const id = sourceListId.replace(/board__/, '')
promise = this.getBoardListAll(id)
promise = this.getBoardListAll({ id, isRefresh: true })
} else {
promise = this.getListDetailAll({ source, id: sourceListId })
promise = this.getListDetailAll({ source, id: sourceListId, isRefresh: true })
}
return promise.finally(() => {
this.fetchingListStatus[id] = false