mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-25 09:41:49 +08:00
feat: add music language preference
This commit is contained in:
parent
f89fc84f95
commit
78d90f15f5
|
@ -50,12 +50,14 @@ export function getArtistAlbum(params) {
|
|||
* @param {number=} type
|
||||
*/
|
||||
export function toplistOfArtists(type = null) {
|
||||
let params = {};
|
||||
if (type) {
|
||||
params.type = type;
|
||||
}
|
||||
return request({
|
||||
url: '/toplist/artist',
|
||||
method: 'get',
|
||||
params: {
|
||||
type,
|
||||
},
|
||||
params,
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,7 @@ let localStorage = {
|
|||
player: {},
|
||||
settings: {
|
||||
lang: null,
|
||||
musicLanguage: 'all',
|
||||
appearance: 'auto',
|
||||
musicQuality: 320000,
|
||||
lyricFontSize: 28,
|
||||
|
|
|
@ -121,12 +121,22 @@ export default {
|
|||
this.show = true;
|
||||
});
|
||||
newAlbums({
|
||||
area: 'EA',
|
||||
area: this.settings.musicLanguage ?? 'ALL',
|
||||
limit: 10,
|
||||
}).then(data => {
|
||||
this.newReleasesAlbum.items = data.albums;
|
||||
});
|
||||
toplistOfArtists(2).then(data => {
|
||||
|
||||
const toplistOfArtistsAreaTable = {
|
||||
all: null,
|
||||
zh: 1,
|
||||
ea: 2,
|
||||
jp: 4,
|
||||
kr: 3,
|
||||
};
|
||||
toplistOfArtists(
|
||||
toplistOfArtistsAreaTable[this.settings.musicLanguage ?? 'all']
|
||||
).then(data => {
|
||||
let indexs = [];
|
||||
while (indexs.length < 6) {
|
||||
let tmp = ~~(Math.random() * 100);
|
||||
|
|
|
@ -378,15 +378,9 @@ export default {
|
|||
Vibrant.from(cover, { colorCount: 1 })
|
||||
.getPalette()
|
||||
.then(palette => {
|
||||
const color = Color.rgb(palette.DarkMuted._rgb)
|
||||
.darken(0.1)
|
||||
.rgb()
|
||||
.string();
|
||||
const color2 = Color.rgb(palette.DarkMuted._rgb)
|
||||
.lighten(0.28)
|
||||
.rotate(-30)
|
||||
.rgb()
|
||||
.string();
|
||||
const orignColor = Color.rgb(palette.DarkMuted._rgb);
|
||||
const color = orignColor.darken(0.1).rgb().string();
|
||||
const color2 = orignColor.lighten(0.28).rotate(-30).rgb().string();
|
||||
this.background = `linear-gradient(to top left, ${color}, ${color2})`;
|
||||
});
|
||||
},
|
||||
|
|
|
@ -54,6 +54,20 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="left">
|
||||
<div class="title"> 音乐语种偏好 </div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<select v-model="musicLanguage">
|
||||
<option value="all">无偏好</option>
|
||||
<option value="zh">华语</option>
|
||||
<option value="ea">欧美</option>
|
||||
<option value="jp">日语</option>
|
||||
<option value="kr">韩语</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>音质</h3>
|
||||
<div class="item">
|
||||
|
@ -454,6 +468,17 @@ export default {
|
|||
this.$store.commit('changeLang', lang);
|
||||
},
|
||||
},
|
||||
musicLanguage: {
|
||||
get() {
|
||||
return this.settings.musicLanguage ?? 'all';
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('updateSettings', {
|
||||
key: 'musicLanguage',
|
||||
value,
|
||||
});
|
||||
},
|
||||
},
|
||||
appearance: {
|
||||
get() {
|
||||
if (this.settings.appearance === undefined) return 'auto';
|
||||
|
|
Loading…
Reference in New Issue
Block a user