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

This commit is contained in:
lyswhut
2022-01-18 15:34:48 +08:00
parent bad2e98757
commit 30d5f53c1d
5 changed files with 11 additions and 7 deletions
+2 -1
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 => {
+4 -2
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 => {