添加源有效性校验

This commit is contained in:
lyswhut
2022-03-30 13:14:23 +08:00
parent bca5b13516
commit 5099ba9c96
5 changed files with 10 additions and 5 deletions
@@ -30,6 +30,9 @@ const getters = {
sources(state, getters, rootState, { sourceNames }) {
return sources.map(item => ({ id: item.id, name: sourceNames[item.id] }))
},
sourceIds() {
return sources.map(item => item.id)
},
boards(state) {
return state.boards
},
+1 -1
View File
@@ -52,7 +52,7 @@ sources.forEach(source => {
// getters
const getters = {
sourceInfo(state, getters, rootState, { sourceNames }) {
return { sources: sources.map(item => ({ id: item.id, name: sourceNames[item.id] })), sortList }
return { sourceIds: sources.map(item => item.id), sources: sources.map(item => ({ id: item.id, name: sourceNames[item.id] })), sortList }
},
tags: state => state.tags,
isVisibleListDetail: state => state.isVisibleListDetail,
+2 -1
View File
@@ -78,7 +78,7 @@ export default {
},
computed: {
...mapGetters(['setting']),
...mapGetters('leaderboard', ['sources', 'boards', 'info']),
...mapGetters('leaderboard', ['sources', 'sourceIds', 'boards', 'info']),
boardList() {
return this.source && this.boards[this.source] ? this.boards[this.source] : []
},
@@ -129,6 +129,7 @@ export default {
},
mounted() {
this.source = this.setting.leaderboard.source
if (!this.sourceIds.includes(this.source)) this.source = this.sourceIds[0]
this.tabId = this.setting.leaderboard.tabId
this.page = this.listInfo.page
},
+2 -1
View File
@@ -97,7 +97,7 @@ export default {
case 'tx':
case 'mg':
case 'kg':
case 'xm':
// case 'xm':
list.push({
name: this.$t('songlist__open_list', { name: this.sourceInfo.sources.find(s => s.id == this.source).name }),
id: 'importSongList',
@@ -164,6 +164,7 @@ export default {
},
mounted() {
this.source = this.setting.songList.source
if (!this.sourceInfo.sourceIds.includes(this.source)) this.source = this.sourceInfo.sourceIds[0]
this.isToggleSource = true
this.tagInfo = this.setting.songList.tagInfo
this.sortId = this.setting.songList.sortId