diff --git a/publish/changeLog.md b/publish/changeLog.md
index e69de29b..c6c83211 100644
--- a/publish/changeLog.md
+++ b/publish/changeLog.md
@@ -0,0 +1,3 @@
+#### 新增
+
+- 新增我喜欢播放列表
diff --git a/src/renderer/components/material/ListButtons.vue b/src/renderer/components/material/ListButtons.vue
index 63c685d7..75b9b1d5 100644
--- a/src/renderer/components/material/ListButtons.vue
+++ b/src/renderer/components/material/ListButtons.vue
@@ -3,6 +3,9 @@ div(:class="$style.btns")
button(type="button" v-if="playBtn" title="播放" @click.stop="handleClick('play')")
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 287.386 287.386' space='preserve')
use(xlink:href='#icon-testPlay')
+ button(type="button" v-if="listAddBtn" title="添加到..." @click.stop="handleClick('listAdd')")
+ svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 42 42' space='preserve')
+ use(xlink:href='#icon-addTo')
button(type="button" v-if="downloadBtn" title="下载" @click.stop="handleClick('download')")
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 475.078 475.077' space='preserve')
use(xlink:href='#icon-download')
@@ -56,6 +59,10 @@ export default {
type: Boolean,
default: true,
},
+ listAddBtn: {
+ type: Boolean,
+ default: true,
+ },
searchBtn: {
type: Boolean,
default: false,
diff --git a/src/renderer/components/material/SongList.vue b/src/renderer/components/material/SongList.vue
index 83117389..c828bfe8 100644
--- a/src/renderer/components/material/SongList.vue
+++ b/src/renderer/components/material/SongList.vue
@@ -11,8 +11,8 @@ div(:class="$style.songList")
:indeterminate="isIndeterminate" :title="isSelectAll && !isIndeterminate ? '全不选' : '全选'")
th.nobreak(style="width: 25%;") 歌曲名
th.nobreak(style="width: 20%;") 歌手
- th.nobreak(style="width: 22%;") 专辑
- th.nobreak(style="width: 18%;") 操作
+ th.nobreak(style="width: 20%;") 专辑
+ th.nobreak(style="width: 20%;") 操作
th.nobreak(style="width: 10%;") 时长
div.scroll(:class="$style.tbody" ref="dom_scrollContent")
table
@@ -25,9 +25,13 @@ div(:class="$style.songList")
span.badge.badge-info(v-if="item._types['320k']") 高品质
span.badge.badge-success(v-if="item._types.ape || item._types.flac") 无损
td.break(style="width: 20%;") {{item.singer}}
- td.break(style="width: 22%;") {{item.albumName}}
- td(style="width: 18%;")
- material-list-buttons(:index="index" :search-btn="true" :play-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')" :download-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')" :remove-btn="false" @btn-click="handleListBtnClick")
+ td.break(style="width: 20%;") {{item.albumName}}
+ td(style="width: 20%; padding-left: 0; padding-right: 0;")
+ material-list-buttons(:index="index" :search-btn="true"
+ :remove-btn="false" @btn-click="handleListBtnClick"
+ :listAdd-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')"
+ :play-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')"
+ :download-btn="item.source == 'kw' || (!isAPITemp && item.source != 'tx' && item.source != 'wy')")
//- button.btn-info(type='button' v-if="item._types['128k'] || item._types['192k'] || item._types['320k'] || item._types.flac" @click.stop='openDownloadModal(index)') 下载
//- button.btn-secondary(type='button' v-if="item._types['128k'] || item._types['192k'] || item._types['320k']" @click.stop='testPlay(index)') 试听
//- button.btn-success(type='button' v-if="(item._types['128k'] || item._types['192k'] || item._types['320k']) && userInfo" @click.stop='showListModal(index)') +
diff --git a/src/renderer/components/material/listAddModal.vue b/src/renderer/components/material/listAddModal.vue
new file mode 100644
index 00000000..936ec32b
--- /dev/null
+++ b/src/renderer/components/material/listAddModal.vue
@@ -0,0 +1,103 @@
+
+material-modal(:show="show" :bg-close="bgClose" @close="handleClose")
+ main(:class="$style.main")
+ h2
+ | 添加
+ span(:class="$style.name") {{this.musicInfo && `${musicInfo.name}`}}
+ | 到...
+ material-btn(:class="$style.btn" :title="`把该歌曲添加到 ${item.name}`" :key="item.id" @click="handleClick(index)" v-for="(item, index) in lists") {{item.name}}
+
+
+
+
+
+
diff --git a/src/renderer/components/material/listAddMultipleModal.vue b/src/renderer/components/material/listAddMultipleModal.vue
new file mode 100644
index 00000000..5c61b416
--- /dev/null
+++ b/src/renderer/components/material/listAddMultipleModal.vue
@@ -0,0 +1,97 @@
+
+material-modal(:show="show" :bg-close="bgClose" @close="handleClose")
+ main(:class="$style.main")
+ h2 添加已选的 {{musicList.length}} 首歌曲到...
+ material-btn(:class="$style.btn" :title="`把该歌曲添加到 ${item.name}`" :key="item.id" @click="handleClick(index)" v-for="(item, index) in lists") {{item.name}}
+
+
+
+
+
+
diff --git a/src/renderer/store/modules/list.js b/src/renderer/store/modules/list.js
index c6c552d0..0fa59622 100644
--- a/src/renderer/store/modules/list.js
+++ b/src/renderer/store/modules/list.js
@@ -44,7 +44,12 @@ const getList = (state, id) => {
// mitations
const mutations = {
initList(state, { defaultList, loveList }) {
- if (defaultList !== undefined) state.defaultList = defaultList
+ if (defaultList !== undefined) {
+ // 处理0.6.2及以前的版本默认列表没有ID的兼容问题
+ if (!defaultList.id) defaultList.id = 'default'
+
+ state.defaultList = defaultList
+ }
if (loveList !== undefined) state.loveList = loveList
},
setList(state, { id, list }) {
diff --git a/src/renderer/views/Download.vue b/src/renderer/views/Download.vue
index a059dee1..22aa0e22 100644
--- a/src/renderer/views/Download.vue
+++ b/src/renderer/views/Download.vue
@@ -26,7 +26,7 @@ div(:class="$style.download")
td.break(style="width: 10%;") {{item.type && item.type.toUpperCase()}}
td(style="width: 20%; padding-left: 0; padding-right: 0;")
material-list-buttons(:index="index" :download-btn="false" :file-btn="true" :start-btn="!item.isComplate && item.status != downloadStatus.WAITING && (item.status != downloadStatus.RUN)"
- :pause-btn="!item.isComplate && (item.status == downloadStatus.RUN || item.status == downloadStatus.WAITING)"
+ :pause-btn="!item.isComplate && (item.status == downloadStatus.RUN || item.status == downloadStatus.WAITING)" :list-add-btn="false"
:play-btn="item.status == downloadStatus.COMPLETED" @btn-click="handleListBtnClick")
material-flow-btn(:show="isShowEditBtn" :play-btn="false" :download-btn="false" :add-btn="false" :start-btn="true" :pause-btn="true" @btn-click="handleFlowBtnClick")
div(:class="$style.noItem" v-else)
diff --git a/src/renderer/views/Leaderboard.vue b/src/renderer/views/Leaderboard.vue
index db5aa697..4e3edece 100644
--- a/src/renderer/views/Leaderboard.vue
+++ b/src/renderer/views/Leaderboard.vue
@@ -6,6 +6,8 @@
material-song-list(v-model="selectdData" @action="handleSongListAction" :source="source" :page="page" :limit="info.limit" :total="info.total" :list="list")
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-list-add-modal(:show="isShowListAdd" :musicInfo="musicInfo" @close="isShowListAdd = false")
+ material-list-add-multiple-modal(:show="isShowListAddMultiple" :musicList="selectdData" @close="handleListAddModalClose")
diff --git a/src/renderer/views/Setting.vue b/src/renderer/views/Setting.vue
index 288ce8ae..58c0c109 100644
--- a/src/renderer/views/Setting.vue
+++ b/src/renderer/views/Setting.vue
@@ -162,7 +162,7 @@ export default {
name: 'Setting',
computed: {
...mapGetters(['setting', 'themes', 'version']),
- ...mapGetters('list', ['defaultList']),
+ ...mapGetters('list', ['defaultList', 'loveList']),
isLatestVer() {
return this.version.newVersion && this.version.version === this.version.newVersion.version
},
@@ -325,19 +325,30 @@ export default {
})
},
importPlayList(path) {
- let defautlList
+ let listData
try {
- defautlList = JSON.parse(fs.readFileSync(path, 'utf8'))
+ listData = JSON.parse(fs.readFileSync(path, 'utf8'))
} catch (error) {
return
}
- if (defautlList.type !== 'defautlList') return
- this.setList({ id: 'default', list: defautlList.data.list })
+ console.log(listData.type)
+
+ // 兼容0.6.2及以前版本的列表数据
+ if (listData.type === 'defautlList') return this.setList({ id: 'default', list: listData.data.list })
+
+ if (listData.type !== 'playList') return
+
+ for (const list of listData.data) {
+ this.setList({ id: list.id, list: list.list })
+ }
},
exportPlayList(path) {
const data = {
- type: 'defautlList',
- data: this.defaultList,
+ type: 'playList',
+ data: [
+ this.defaultList,
+ this.loveList,
+ ],
}
fs.writeFile(path, JSON.stringify(data, null, 2), 'utf8', err => {
console.log(err)
@@ -353,13 +364,20 @@ export default {
if (allData.type !== 'allData') return
this.setSetting(updateSetting(allData.setting))
this.init()
- this.setList({ id: 'default', list: allData.defaultList.list })
+ if (allData.defaultList) return this.setList({ id: 'default', list: allData.defaultList.list })
+
+ for (const list of allData.playList) {
+ this.setList({ id: list.id, list: list.list })
+ }
},
exportAllData(path) {
let allData = {
type: 'allData',
setting: this.setting,
- defaultList: this.defaultList,
+ playList: [
+ this.defaultList,
+ this.loveList,
+ ],
}
fs.writeFile(path, JSON.stringify(allData, null, 2), 'utf8', err => {
console.log(err)
diff --git a/src/renderer/views/SongList.vue b/src/renderer/views/SongList.vue
index e2b84377..cf267594 100644
--- a/src/renderer/views/SongList.vue
+++ b/src/renderer/views/SongList.vue
@@ -31,6 +31,8 @@
material-pagination(:count="listData.total" :limit="listData.limit" :page="listData.page" @btn-click="handleToggleListPage")
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-list-add-modal(:show="isShowListAdd" :musicInfo="musicInfo" @close="isShowListAdd = false")
+ material-list-add-multiple-modal(:show="isShowListAddMultiple" :musicList="selectdData" @close="handleListAddModalClose")