feat: prettier task supported (#40)

* feat: add config to resolve path alias.

* feat: use vue-i18n for language switch

* feat: add .editorconfig for ide

* fix: add no-referrer to avoid CROB

* fix: setCookie and fix typo

* feat: integrate vue-i18n

* feat: player component i18n support

* fix: duplicate key warning in explore page

* fix: like songs number changed in library page

* fire: remove todo

* fix: same text search on enter will cause error

* fix: scrobble error params type

* feat: prettier task supported

* fix: prettier ignore config update

* fix: conflict
This commit is contained in:
Hawtim Zhang 2020-10-22 21:44:34 +08:00 committed by GitHub
parent 56fe497db9
commit c042faa001
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 1755 additions and 1445 deletions

View file

@ -42,7 +42,7 @@ export default {
openMenu(e) {
this.showMenu = true;
this.$nextTick(
function() {
function () {
this.$refs.menu.focus();
this.setMenu(e.y, e.x);
}.bind(this)

View file

@ -60,27 +60,27 @@ export default {
name: "CoverRow",
components: {
Cover,
ExplicitSymbol
ExplicitSymbol,
},
props: {
items: Array,
type: String,
subText: {
type: String,
default: "none"
default: "none",
},
imageSize: {
type: Number,
default: 512
default: 512,
},
showPlayButton: {
type: Boolean,
default: false
default: false,
},
showPlayCount: {
type: Boolean,
default: false
}
default: false,
},
},
methods: {
getUrl(item) {
@ -102,8 +102,8 @@ export default {
item.publishTime
).getFullYear()}`;
if (this.subText === "appleMusic") return "by Apple Music";
}
}
},
},
};
</script>

View file

@ -54,13 +54,13 @@ import ButtonIcon from "@/components/ButtonIcon.vue";
export default {
name: "Navbar",
components: {
ButtonIcon
ButtonIcon,
},
data() {
return {
inputFocus: false,
keywords: "",
langs: ["zh-CN", "en"]
langs: ["zh-CN", "en"],
};
},
methods: {
@ -77,7 +77,7 @@ export default {
return;
this.$router.push({
name: "search",
query: { keywords: this.keywords }
query: { keywords: this.keywords },
});
},
changeLang() {
@ -89,8 +89,8 @@ export default {
}
this.$i18n.locale = lang;
this.$store.commit("changeLang", lang);
}
}
},
},
};
</script>

View file

@ -131,13 +131,13 @@ export default {
name: "Player",
components: {
ButtonIcon,
VueSlider
VueSlider,
},
data() {
return {
interval: null,
progress: 0,
oldVolume: 0.5
oldVolume: 0.5,
};
},
created() {
@ -145,7 +145,7 @@ export default {
this.progress = ~~this.howler.seek();
}, 1000);
if (this.isLoggedIn) {
userLikedSongsIDs(this.settings.user.userId).then(data => {
userLikedSongsIDs(this.settings.user.userId).then((data) => {
this.updateLikedSongs(data.ids);
});
}
@ -162,7 +162,7 @@ export default {
set(value) {
this.updatePlayerState({ key: "volume", value });
Howler.volume(value);
}
},
},
playing() {
if (this.howler.state() === "loading") {
@ -176,7 +176,7 @@ export default {
},
isLoggedIn() {
return isLoggedIn();
}
},
},
methods: {
...mapMutations([
@ -184,13 +184,13 @@ export default {
"turnOffShuffleMode",
"updatePlayerState",
"updateRepeatStatus",
"updateLikedSongs"
"updateLikedSongs",
]),
...mapActions([
"nextTrack",
"previousTrack",
"playTrackOnListByID",
"addNextTrackEvent"
"addNextTrackEvent",
]),
play() {
if (this.playing) {
@ -259,7 +259,7 @@ export default {
if (this.liked.songs.includes(id)) like = false;
likeATrack({ id, like }).then(() => {
if (like === false) {
this.updateLikedSongs(this.liked.songs.filter(d => d !== id));
this.updateLikedSongs(this.liked.songs.filter((d) => d !== id));
} else {
let newLikeSongs = this.liked.songs;
newLikeSongs.push(id);
@ -272,7 +272,7 @@ export default {
this.$router.push({ path: "/library/liked-songs" });
else
this.$router.push({
path: "/" + this.player.listInfo.type + "/" + this.player.listInfo.id
path: "/" + this.player.listInfo.type + "/" + this.player.listInfo.id,
});
},
goToAlbum() {
@ -280,8 +280,8 @@ export default {
},
goToArtist(id) {
this.$router.push({ path: "/artist/" + id });
}
}
},
},
};
</script>

View file

@ -27,7 +27,7 @@ import {
playPlaylistByID,
playAlbumByID,
playAList,
appendTrackToPlayerList
appendTrackToPlayerList,
} from "@/utils/play";
import TrackListItem from "@/components/TrackListItem.vue";
@ -37,7 +37,7 @@ export default {
name: "TrackList",
components: {
TrackListItem,
ContextMenu
ContextMenu,
},
props: {
tracks: Array,
@ -45,17 +45,17 @@ export default {
id: Number,
itemWidth: {
type: Number,
default: -1
default: -1,
},
dbclickTrackFunc: {
type: String,
default: "default"
}
default: "default",
},
},
data() {
return {
rightClickedTrack: null,
listStyles: {}
listStyles: {},
};
},
created() {
@ -66,7 +66,7 @@ export default {
...mapState(["liked"]),
isRightClickedTrackLiked() {
return this.liked.songs.includes(this.rightClickedTrack?.id);
}
},
},
methods: {
...mapMutations(["updateLikedSongs"]),
@ -95,7 +95,7 @@ export default {
} else if (this.type === "album") {
playAlbumByID(this.id, trackID);
} else if (this.type === "tracklist") {
let trackIDs = this.tracks.map(t => t.id);
let trackIDs = this.tracks.map((t) => t.id);
playAList(trackIDs, this.tracks[0].ar[0].id, "artist", trackID);
}
},
@ -112,17 +112,17 @@ export default {
let like = true;
let likedSongs = this.liked.songs;
if (likedSongs.includes(id)) like = false;
likeATrack({ id, like }).then(data => {
likeATrack({ id, like }).then((data) => {
if (data.code !== 200) return;
if (like === false) {
this.updateLikedSongs(likedSongs.filter(d => d !== id));
this.updateLikedSongs(likedSongs.filter((d) => d !== id));
} else {
likedSongs.push(id);
this.updateLikedSongs(likedSongs);
}
});
}
}
},
},
};
</script>

View file

@ -21,7 +21,10 @@
track.no
}}</span>
<button v-show="isPlaying">
<svg-icon icon-class="volume" style="height:16px;width:16px"></svg-icon>
<svg-icon
icon-class="volume"
style="height: 16px; width: 16px"
></svg-icon>
</button>
</div>
<div class="title-and-artist">
@ -59,7 +62,7 @@
icon-class="heart"
:style="{
visibility:
focus && !isLiked && track.playable ? 'visible' : 'hidden'
focus && !isLiked && track.playable ? 'visible' : 'hidden',
}"
></svg-icon>
<svg-icon icon-class="heart-solid" v-show="isLiked"></svg-icon>
@ -81,7 +84,7 @@ export default {
name: "TrackListItem",
components: { ArtistsInLine, ExplicitSymbol },
props: {
track: Object
track: Object,
},
data() {
return { focus: false, trackStyle: {} };
@ -123,7 +126,7 @@ export default {
},
isLoggedIn() {
return isLoggedIn();
}
},
},
methods: {
goToAlbum() {
@ -134,12 +137,12 @@ export default {
},
likeThisSong() {
this.$parent.likeASong(this.track.id);
}
},
},
created() {
if (this.$parent.itemWidth !== -1)
this.trackStyle = { width: this.$parent.itemWidth + "px" };
}
},
};
</script>