分离可用音质控制逻辑
This commit is contained in:
@@ -34,9 +34,6 @@ export default {
|
||||
types() {
|
||||
return this.source ? this.sourceInfo.sourceList[this.source] : []
|
||||
},
|
||||
isAPITemp() {
|
||||
return this.setting.apiSource == 'temp'
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
tabId(n, o) {
|
||||
@@ -124,14 +121,7 @@ export default {
|
||||
this.isShowDownload = false
|
||||
},
|
||||
handleAddDownloadMultiple(type) {
|
||||
switch (this.source) {
|
||||
// case 'kg':
|
||||
case 'tx':
|
||||
case 'wy':
|
||||
type = '128k'
|
||||
case 'xm':
|
||||
if (type == 'flac') type = 'wav'
|
||||
}
|
||||
if (this.source == 'xm' && type == 'flac') type = 'wav'
|
||||
this.createDownloadMultiple({ list: [...this.selectdData], type })
|
||||
this.isShowDownloadMultiple = false
|
||||
this.resetSelect()
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
table
|
||||
tbody(@contextmenu="handleContextMenu" ref="dom_tbody")
|
||||
tr(v-for='(item, index) in list' :key='item.songmid' :id="'mid_' + item.songmid"
|
||||
@click="handleDoubleClick($event, index)" :class="[isPlayList && playIndex === index ? $style.active : '', (isAPITemp && item.source != 'kw') ? $style.disabled : '']")
|
||||
@click="handleDoubleClick($event, index)" :class="[isPlayList && playIndex === index ? $style.active : '', assertApiSupport(item.source) ? null : $style.disabled]")
|
||||
td.nobreak.center(style="width: 37px;" :class="$style.noSelect" @click.stop) {{index + 1}}
|
||||
td.break(style="width: 25%;")
|
||||
span.select {{item.name}}
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
<script>
|
||||
import { mapMutations, mapGetters, mapActions } from 'vuex'
|
||||
import { throttle, scrollTo, clipboardWriteText } from '../utils'
|
||||
import { throttle, scrollTo, clipboardWriteText, assertApiSupport } from '../utils'
|
||||
export default {
|
||||
name: 'List',
|
||||
data() {
|
||||
@@ -88,9 +88,6 @@ export default {
|
||||
list() {
|
||||
return this.listData.list
|
||||
},
|
||||
isAPITemp() {
|
||||
return this.setting.apiSource == 'temp'
|
||||
},
|
||||
listData() {
|
||||
if (!this.listId) return this.defaultList
|
||||
let targetList
|
||||
@@ -333,7 +330,7 @@ export default {
|
||||
}
|
||||
},
|
||||
testPlay(index) {
|
||||
if (this.isAPITemp && this.list[index].source != 'kw') return
|
||||
if (!this.assertApiSupport(this.list[index].source)) return
|
||||
this.setPlayList({ list: this.list, listId: this.listId, index })
|
||||
},
|
||||
handleRemove(index) {
|
||||
@@ -343,7 +340,7 @@ export default {
|
||||
switch (info.action) {
|
||||
case 'download': {
|
||||
const minfo = this.list[info.index]
|
||||
if (this.isAPITemp && minfo.source != 'kw') return
|
||||
if (!this.assertApiSupport(minfo.source)) return
|
||||
this.musicInfo = minfo
|
||||
this.$nextTick(() => {
|
||||
this.isShowDownload = true
|
||||
@@ -378,7 +375,7 @@ export default {
|
||||
// asyncSetArray(this.selectdData, isSelect ? [...this.list] : [])
|
||||
},
|
||||
handleAddDownloadMultiple(type) {
|
||||
const list = this.setting.apiSource == 'temp' ? this.selectdData.filter(s => s.source == 'kw') : [...this.selectdData]
|
||||
const list = this.selectdData.filter(s => this.assertApiSupport(s.source))
|
||||
this.createDownloadMultiple({ list, type })
|
||||
this.removeAllSelect()
|
||||
this.isShowDownloadMultiple = false
|
||||
@@ -420,6 +417,9 @@ export default {
|
||||
clipboardWriteText(str)
|
||||
})
|
||||
},
|
||||
assertApiSupport(source) {
|
||||
return assertApiSupport(source)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
span.select {{item.albumName}}
|
||||
td(style="width: 15%; padding-left: 0; padding-right: 0;")
|
||||
material-list-buttons(:index="index" :remove-btn="false" :class="$style.listBtn"
|
||||
:play-btn="item.source == 'kw' || !isAPITemp"
|
||||
:download-btn="item.source == 'kw' || !isAPITemp"
|
||||
:play-btn="assertApiSupport(item.source)"
|
||||
:download-btn="assertApiSupport(item.source)"
|
||||
@btn-click="handleListBtnClick")
|
||||
td(style="width: 10%;")
|
||||
span(:class="[$style.time, $style.noSelect]") {{item.interval || '--/--'}}
|
||||
@@ -53,14 +53,14 @@
|
||||
p {{$t('view.search.no_item')}}
|
||||
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-flow-btn(:show="isShowEditBtn && (searchSourceId == 'kw' || searchSourceId == 'all' || !isAPITemp)" :remove-btn="false" @btn-click="handleFlowBtnClick")
|
||||
material-flow-btn(:show="isShowEditBtn && (searchSourceId == 'all' || assertApiSupport(searchSourceId))" :remove-btn="false" @btn-click="handleFlowBtnClick")
|
||||
material-list-add-modal(:show="isShowListAdd" :musicInfo="musicInfo" @close="isShowListAdd = false")
|
||||
material-list-add-multiple-modal(:show="isShowListAddMultiple" :musicList="selectdData" @close="handleListAddModalClose")
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapActions, mapMutations } from 'vuex'
|
||||
import { scrollTo, clipboardWriteText } from '../utils'
|
||||
import { scrollTo, clipboardWriteText, assertApiSupport } from '../utils'
|
||||
// import music from '../utils/music'
|
||||
export default {
|
||||
name: 'Search',
|
||||
@@ -151,9 +151,6 @@ export default {
|
||||
listInfo() {
|
||||
return this.setting.search.searchSource == 'all' ? this.allList : this.sourceList[this.setting.search.searchSource]
|
||||
},
|
||||
isAPITemp() {
|
||||
return this.setting.apiSource == 'temp'
|
||||
},
|
||||
hotSearchList() {
|
||||
return this.$store.getters['hotSearch/list'][this.setting.search.searchSource] || []
|
||||
},
|
||||
@@ -303,7 +300,7 @@ export default {
|
||||
targetSong = this.selectdData[0]
|
||||
this.listAddMultiple({ id: 'default', list: this.filterList(this.selectdData) })
|
||||
} else {
|
||||
if (this.isAPITemp && this.listInfo.list[index].source != 'kw') return
|
||||
if (!this.assertApiSupport(this.listInfo.list[index].source)) return
|
||||
targetSong = this.listInfo.list[index]
|
||||
this.listAdd({ id: 'default', musicInfo: targetSong })
|
||||
}
|
||||
@@ -353,7 +350,10 @@ export default {
|
||||
}
|
||||
},
|
||||
filterList(list) {
|
||||
return this.setting.apiSource == 'temp' ? list.filter(s => s.source == 'kw') : [...list]
|
||||
return this.searchSourceId == 'all'
|
||||
? list.filter(s => this.assertApiSupport(s.source))
|
||||
: this.assertApiSupport(this.searchSourceId)
|
||||
? [...list] : []
|
||||
},
|
||||
handleListAddModalClose(isClearSelect) {
|
||||
if (isClearSelect) this.removeAllSelect()
|
||||
@@ -383,6 +383,9 @@ export default {
|
||||
},
|
||||
})
|
||||
},
|
||||
assertApiSupport(source) {
|
||||
return assertApiSupport(source)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapMutations, mapActions } from 'vuex'
|
||||
import { scrollTo } from '../utils'
|
||||
import { scrollTo, assertApiSupport } from '../utils'
|
||||
// import music from '../utils/music'
|
||||
export default {
|
||||
name: 'SongList',
|
||||
@@ -108,9 +108,6 @@ export default {
|
||||
}
|
||||
return list
|
||||
},
|
||||
isAPITemp() {
|
||||
return this.setting.apiSource == 'temp'
|
||||
},
|
||||
tagList() {
|
||||
let tagInfo = this.tags[this.source]
|
||||
return tagInfo ? [{ name: '热门标签', list: [...tagInfo.hotTag] }, ...tagInfo.tags] : []
|
||||
@@ -208,7 +205,7 @@ export default {
|
||||
this.resetSelect()
|
||||
} else {
|
||||
targetSong = this.listDetail.list[index]
|
||||
if (this.isAPITemp && targetSong.source != 'kw') return
|
||||
if (!this.assertApiSupport(targetSong.source)) return
|
||||
this.listAdd({ id: 'default', musicInfo: targetSong })
|
||||
}
|
||||
let targetIndex = this.defaultList.list.findIndex(
|
||||
@@ -250,14 +247,7 @@ export default {
|
||||
this.isShowDownload = false
|
||||
},
|
||||
handleAddDownloadMultiple(type) {
|
||||
switch (this.source) {
|
||||
// case 'kg':
|
||||
case 'tx':
|
||||
case 'wy':
|
||||
type = '128k'
|
||||
case 'xm':
|
||||
if (type == 'flac') type = 'wav'
|
||||
}
|
||||
if (this.source == 'xm' && type == 'flac') type = 'wav'
|
||||
this.createDownloadMultiple({ list: this.filterList(this.selectdData), type })
|
||||
this.resetSelect()
|
||||
this.isShowDownloadMultiple = false
|
||||
@@ -334,7 +324,7 @@ export default {
|
||||
this.handleGetListDetail(this.importSongListText, 1)
|
||||
},
|
||||
filterList(list) {
|
||||
return this.setting.apiSource == 'temp' ? list.filter(s => s.source == 'kw') : [...list]
|
||||
return list.filter(s => this.assertApiSupport(s.source))
|
||||
},
|
||||
setTagListWidth() {
|
||||
this.isInitedTagListWidth = true
|
||||
@@ -347,6 +337,9 @@ export default {
|
||||
return Promise.reject(err)
|
||||
})
|
||||
},
|
||||
assertApiSupport(source) {
|
||||
return assertApiSupport(source)
|
||||
},
|
||||
/* addSongListDetail() {
|
||||
// this.detailLoading = true
|
||||
// this.getListDetailAll(this.selectListInfo.id).then(() => {
|
||||
|
||||
Reference in New Issue
Block a user