重构歌曲列表

This commit is contained in:
lyswhut
2019-09-01 18:09:54 +08:00
parent c81c33a430
commit 78c0badd95
15 changed files with 662 additions and 115 deletions
+14 -3
View File
@@ -1,5 +1,5 @@
import fs from 'fs'
import { shell, remote } from 'electron'
import { shell, remote, clipboard } from 'electron'
import path from 'path'
import os from 'os'
import crypto from 'crypto'
@@ -162,7 +162,7 @@ export const isChildren = (parent, children) => {
* @param {*} setting
*/
export const updateSetting = setting => {
const defaultVersion = '1.0.4'
const defaultVersion = '1.0.5'
const defaultSetting = {
version: defaultVersion,
player: {
@@ -183,6 +183,11 @@ export const updateSetting = setting => {
source: 'kw',
tabId: 'kwbiaosb',
},
songList: {
source: 'kw',
sortId: 'kwhot',
tagId: '',
},
themeId: 0,
sourceId: 'kw',
apiSource: 'test',
@@ -202,7 +207,7 @@ export const updateSetting = setting => {
objectDeepMerge(defaultSetting, overwriteSetting)
setting = defaultSetting
}
if (setting.apiSource != 'test') setting.apiSource = 'test' // 强制设置回 test 接口源
if (setting.apiSource != 'temp') setting.apiSource = 'test' // 强制设置回 test 接口源
return setting
}
@@ -228,3 +233,9 @@ export const setTitle = title => {
* @param {*} str
*/
export const toMD5 = str => crypto.createHash('md5').update(str).digest('hex')
/**
* 复制文本到剪贴板
* @param {*} str
*/
export const clipboardWriteText = str => clipboard.writeText(str)
+2
View File
@@ -1,9 +1,11 @@
import leaderboard from './leaderboard'
import api_source from '../api-source'
import musicInfo from './musicInfo'
import songList from './songList'
const bd = {
leaderboard,
songList,
getMusicUrl(songInfo, type) {
return api_source('bd').getMusicUrl(songInfo, type)
},
+2
View File
@@ -13,10 +13,12 @@ export default {
sortList: [
{
name: '最热',
tabId: 'bdhot',
id: '最热',
},
{
name: '最新',
tabId: 'bdnew',
id: '最新',
},
],
+2 -1
View File
@@ -1,9 +1,10 @@
import leaderboard from './leaderboard'
import api_source from '../api-source'
import songList from './songList'
const kg = {
leaderboard,
songList,
getMusicUrl(songInfo, type) {
return api_source('kg').getMusicUrl(songInfo, type)
},
+5
View File
@@ -12,22 +12,27 @@ export default {
sortList: [
{
name: '推荐',
tabId: 'kgrecommend',
id: '5',
},
{
name: '最热',
tabId: 'kghot',
id: '6',
},
{
name: '最新',
tabId: 'kgnew',
id: '7',
},
{
name: '热藏',
tabId: 'kghotcollect',
id: '3',
},
{
name: '飙升',
tabId: 'kgup',
id: '8',
},
],
+2
View File
@@ -6,6 +6,7 @@ import leaderboard from './leaderboard'
import lyric from './lyric'
import pic from './pic'
import api_source from '../api-source'
import songList from './songList'
const kw = {
_musicInfoRequestObj: null,
@@ -32,6 +33,7 @@ const kw = {
tempSearch,
musicSearch,
leaderboard,
songList,
getLyric(songInfo) {
// let singer = songInfo.singer.indexOf('、') > -1 ? songInfo.singer.split('、')[0] : songInfo.singer
return lyric.getLyric(songInfo.songmid)
+2
View File
@@ -13,10 +13,12 @@ export default {
sortList: [
{
name: '最热',
tabId: 'kwhot',
id: 'hot',
},
{
name: '最新',
tabId: 'kwnew',
id: 'new',
},
],