新增搜索页面接口限制

pull/96/head
lyswhut 2019-09-21 20:34:40 +08:00
parent 5321469c1d
commit 99b0595e50
1 changed files with 18 additions and 5 deletions

View File

@ -29,7 +29,10 @@
td.break(style="width: 20%;") {{item.singer}} td.break(style="width: 20%;") {{item.singer}}
td.break(style="width: 25%;") {{item.albumName}} td.break(style="width: 25%;") {{item.albumName}}
td(style="width: 15%;") td(style="width: 15%;")
material-list-buttons(:index="index" :remove-btn="false" @btn-click="handleListBtnClick") material-list-buttons(:index="index" :remove-btn="false" :class="$style.listBtn"
:play-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')"
:download-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')"
@btn-click="handleListBtnClick")
td(style="width: 10%;") {{item.interval}} td(style="width: 10%;") {{item.interval}}
div(:class="$style.pagination") div(:class="$style.pagination")
material-pagination(:count="listInfo.total" :limit="listInfo.limit" :page="page" @btn-click="handleTogglePage") material-pagination(:count="listInfo.total" :limit="listInfo.limit" :page="page" @btn-click="handleTogglePage")
@ -37,7 +40,7 @@
p 搜我所想~~😉 p 搜我所想~~😉
material-download-modal(:show="isShowDownload" :musicInfo="musicInfo" @select="handleAddDownload" @close="isShowDownload = false") material-download-modal(:show="isShowDownload" :musicInfo="musicInfo" @select="handleAddDownload" @close="isShowDownload = false")
material-download-multiple-modal(:show="isShowDownloadMultiple" :list="selectdData" @select="handleAddDownloadMultiple" @close="isShowDownloadMultiple = false") material-download-multiple-modal(:show="isShowDownloadMultiple" :list="selectdData" @select="handleAddDownloadMultiple" @close="isShowDownloadMultiple = false")
material-flow-btn(:show="isShowEditBtn" :remove-btn="false" @btn-click="handleFlowBtnClick") material-flow-btn(:show="isShowEditBtn && (searchSourceId == 'kw' || searchSourceId == 'all' || !isAPITemp)" :remove-btn="false" @btn-click="handleFlowBtnClick")
</template> </template>
<script> <script>
@ -116,6 +119,9 @@ export default {
listInfo() { listInfo() {
return this.setting.search.searchSource == 'all' ? this.allList : this.sourceList[this.setting.search.searchSource] return this.setting.search.searchSource == 'all' ? this.allList : this.sourceList[this.setting.search.searchSource]
}, },
isAPITemp() {
return this.setting.apiSource == 'temp'
},
}, },
methods: { methods: {
...mapMutations(['setSearchSource']), ...mapMutations(['setSearchSource']),
@ -166,8 +172,9 @@ export default {
let targetSong let targetSong
if (index == null) { if (index == null) {
targetSong = this.selectdData[0] targetSong = this.selectdData[0]
this.defaultListAddMultiple(this.selectdData) this.defaultListAddMultiple(this.filterList(this.selectdData))
} else { } else {
if ((this.isAPITemp && this.listInfo.list[index].source != 'kw') || this.listInfo.list[index].source == 'tx' || this.listInfo.list[index].source == 'wy') return
targetSong = this.listInfo.list[index] targetSong = this.listInfo.list[index]
this.defaultListAdd(targetSong) this.defaultListAdd(targetSong)
} }
@ -190,7 +197,7 @@ export default {
this.isShowDownload = false this.isShowDownload = false
}, },
handleAddDownloadMultiple(type) { handleAddDownloadMultiple(type) {
this.createDownloadMultiple({ list: [...this.selectdData], type }) this.createDownloadMultiple({ list: this.filterList(this.selectdData), type })
this.resetSelect() this.resetSelect()
this.isShowDownloadMultiple = false this.isShowDownloadMultiple = false
}, },
@ -211,11 +218,14 @@ export default {
this.resetSelect() this.resetSelect()
break break
case 'add': case 'add':
this.defaultListAddMultiple(this.selectdData) this.defaultListAddMultiple(this.filterList(this.selectdData))
this.resetSelect() this.resetSelect()
break break
} }
}, },
filterList(list) {
return this.setting.apiSource == 'temp' ? list.filter(s => s.source == 'kw') : list.filter(s => s.source != 'tx' && s.source != 'wy')
},
}, },
} }
</script> </script>
@ -260,6 +270,9 @@ export default {
} }
} }
} }
.listBtn {
min-height: 24px;
}
.pagination { .pagination {
text-align: center; text-align: center;
padding: 15px 0; padding: 15px 0;