master
qier222 4 years ago
parent fc08992244
commit 2f0e8e1e24
No known key found for this signature in database
GPG Key ID: 9C85007ED905F14D

@ -49,6 +49,7 @@ export default {
...mapActions(["showToast"]),
...mapMutations(["updateDailyTracks"]),
loadDailyTracks() {
if (!isAccountLoggedIn()) return;
dailyRecommendTracks()
.then((result) => {
this.updateDailyTracks(result.data.dailySongs);

@ -168,7 +168,11 @@ export default {
window.open("https://github.com/qier222/YesPlayMusic");
},
toLogin() {
this.$router.push({ name: "login" });
if (process.env.IS_ELECTRON === true) {
this.$router.push({ name: "loginAccount" });
} else {
this.$router.push({ name: "login" });
}
},
windowMinimize() {
ipcRenderer.send("minimize");

@ -7,7 +7,7 @@ const db = new Dexie("yesplaymusic");
db.version(2)
.stores({
trackSources: "&id, createTime",
trackSources: "&id",
})
.upgrade((tx) =>
tx
@ -29,8 +29,9 @@ async function deleteExcessCache() {
if (
store.state.settings.cacheLimit === false ||
tracksCacheBytes < store.state.settings.cacheLimit * Math.pow(1024, 2)
)
) {
return;
}
try {
const delCache = await db.trackSources.orderBy("createTime").first();
await db.trackSources.delete(delCache.id);

@ -39,23 +39,23 @@
</div>
<div class="subtitle">
<router-link
:to="`/artist/${currentTrack.ar[0].id}`"
:to="`/artist/${artist.id}`"
@click.native="toggleLyrics"
>{{ currentTrack.ar[0].name }}
>{{ artist.name }}
</router-link>
-
<router-link
:to="`/album/${currentTrack.al.id}`"
:to="`/album/${album.id}`"
:title="album.name"
@click.native="toggleLyrics"
:title="currentTrack.al.name"
>{{ currentTrack.al.name }}
>{{ album.name }}
</router-link>
</div>
</div>
<div class="buttons">
<button-icon
@click.native="playerRef.likeCurrentSong"
:title="$t('player.like')"
@click.native="playerRef.likeCurrentSong"
>
<svg-icon
:icon-class="
@ -214,18 +214,18 @@ export default {
return this.player.currentTrack;
},
imageUrl() {
return this.player.currentTrack.al.picUrl + "?param=1024y1024";
return this.player.currentTrack?.al?.picUrl + "?param=1024y1024";
},
progress: {
get() {
return this.$parent.$refs.player.progress;
return this.playerRef.progress;
},
set(value) {
this.$parent.$refs.player.setProgress(value);
this.playerRef.setProgress(value);
},
},
progressMax() {
return this.$parent.$refs.player.progressMax;
return this.playerRef.progressMax;
},
lyricWithTranslation() {
let ret = [];
@ -264,7 +264,7 @@ export default {
};
},
playerRef() {
return this.$parent.$refs.player;
return this.$parent.$refs.player ? this.$parent.$refs.player : {};
},
showLyrics() {
return this.$store.state.showLyrics;
@ -272,6 +272,14 @@ export default {
noLyric() {
return this.lyric.length == 0;
},
artist() {
// console.log(this.currentTrack);
// return this.currentTrack?.ar[0] || { id: 0, name: "unknown" };
return { id: 0, name: "unknown" };
},
album() {
return { id: 0, name: "unknown" };
},
},
created() {
this.getLyric();
@ -282,6 +290,7 @@ export default {
methods: {
...mapMutations(["toggleLyrics"]),
getLyric() {
if (!this.currentTrack.id) return;
return getLyric(this.currentTrack.id).then((data) => {
if (!data?.lrc?.lyric) {
this.lyric = [];
@ -300,12 +309,12 @@ export default {
},
setSeek() {
let value = this.$refs.progress.getValue();
this.$parent.$refs.player.setProgress(value);
this.$parent.$refs.player.player.seek(value);
this.playerRef.setProgress(value);
this.playerRef.player.seek(value);
},
seek(value) {
this.$parent.$refs.player.setProgress(value);
this.$parent.$refs.player.player.seek(value);
this.playerRef.setProgress(value);
this.playerRef.player.seek(value);
},
clickLyricLine(value) {
if (window.getSelection().toString().length === 0) {
@ -336,9 +345,9 @@ export default {
const showLyricsTranslation = this.$store.state.settings
.showLyricsTranslation;
if (showLyricsTranslation && line.contents[1]) {
return `<span>${line.contents[0]}<br/>${line.contents[1]}</span>`;
return `<span>${line?.contents[0]}<br/>${line.contents[1]}</span>`;
} else {
return `<span>${line.contents[0]}</span>`;
return `<span>${line?.contents[0]}</span>`;
}
},
moveToFMTrash() {

Loading…
Cancel
Save