优化随机播放机制

This commit is contained in:
lyswhut
2020-08-10 22:24:38 +08:00
parent 6606edafb9
commit 85c683b714
3 changed files with 67 additions and 2 deletions
+13
View File
@@ -9,6 +9,7 @@ const state = {
playIndex: -1,
changePlay: false,
isShowPlayerDetail: false,
playedList: [],
}
let urlRequest
@@ -22,6 +23,7 @@ const getters = {
changePlay: satte => satte.changePlay,
playIndex: state => state.playIndex,
isShowPlayerDetail: state => state.isShowPlayerDetail,
playedList: state => state.playedList,
}
// actions
@@ -84,6 +86,7 @@ const mutations = {
state.listInfo = list
state.playIndex = index
state.changePlay = true
if (state.playedList.length) this.commit('player/clearPlayedList')
},
setPlayIndex(state, index) {
state.playIndex = index
@@ -96,6 +99,16 @@ const mutations = {
resetChangePlay(state) {
state.changePlay = false
},
setPlayedList(state, item) {
if (state.playedList.includes(item)) return
state.playedList.push(item)
},
removePlayedList(state, index) {
state.playedList.splice(index, 1)
},
clearPlayedList(state) {
state.playedList = []
},
visiblePlayerDetail(state, visible) {
state.isShowPlayerDetail = visible
},