fix: render weekData error

master
hawtimzhang 3 years ago
parent 107bf53a39
commit 4613feff18

@ -22,6 +22,10 @@ export default {
artists: [],
mvs: [],
cloudDisk: [],
playHistory: {
weekData: [],
allData: [],
},
},
contextMenu: {
clickObjectID: 0,

@ -35,14 +35,14 @@ function setTitle(track) {
? `${track.name} · ${track.ar[0].name} - YesPlayMusic`
: 'YesPlayMusic';
if (isCreateTray) {
ipcRenderer.send('updateTrayTooltip', document.title);
ipcRenderer?.send('updateTrayTooltip', document.title);
}
store.commit('updateTitle', document.title);
}
function setTrayLikeState(isLiked) {
if (isCreateTray) {
ipcRenderer.send('updateTrayLikeState', isLiked);
ipcRenderer?.send('updateTrayLikeState', isLiked);
}
}
@ -223,7 +223,7 @@ export default class {
_setPlaying(isPlaying) {
this._playing = isPlaying;
if (isCreateTray) {
ipcRenderer.send('updateTrayPlayState', this._playing);
ipcRenderer?.send('updateTrayPlayState', this._playing);
}
}
_setIntervals() {
@ -235,7 +235,7 @@ export default class {
this._progress = this._howler.seek();
localStorage.setItem('playerCurrentTrackTime', this._progress);
if (isCreateMpris) {
ipcRenderer.send('playerCurrentTrackTime', this._progress);
ipcRenderer?.send('playerCurrentTrackTime', this._progress);
}
}, 1000);
}
@ -561,7 +561,7 @@ export default class {
navigator.mediaSession.metadata = new window.MediaMetadata(metadata);
if (isCreateMpris) {
ipcRenderer.send('metadata', metadata);
ipcRenderer?.send('metadata', metadata);
}
}
_updateMediaSessionPositionState() {
@ -617,7 +617,7 @@ export default class {
}
let copyTrack = { ...track };
copyTrack.dt -= seekTime * 1000;
ipcRenderer.send('playDiscordPresence', copyTrack);
ipcRenderer?.send('playDiscordPresence', copyTrack);
}
_pauseDiscordPresence(track) {
if (
@ -626,7 +626,7 @@ export default class {
) {
return null;
}
ipcRenderer.send('pauseDiscordPresence', track);
ipcRenderer?.send('pauseDiscordPresence', track);
}
currentTrackID() {
@ -867,7 +867,7 @@ export default class {
sendSelfToIpcMain() {
if (process.env.IS_ELECTRON !== true) return false;
let liked = store.state.liked.songs.includes(this.currentTrack.id);
ipcRenderer.send('player', {
ipcRenderer?.send('player', {
playing: this.playing,
likedCurrentTrack: liked,
});
@ -883,13 +883,13 @@ export default class {
this.repeatMode = 'on';
}
if (isCreateMpris) {
ipcRenderer.send('switchRepeatMode', this.repeatMode);
ipcRenderer?.send('switchRepeatMode', this.repeatMode);
}
}
switchShuffle() {
this.shuffle = !this.shuffle;
if (isCreateMpris) {
ipcRenderer.send('switchShuffle', this.shuffle);
ipcRenderer?.send('switchShuffle', this.shuffle);
}
}
switchReversed() {

@ -267,7 +267,7 @@ export default {
// Pick 3 or fewer lyrics based on the lyric lines.
const lyricsToPick = Math.min(lyricLine.length, 3);
// The upperbound of the lyric line to pick
// The upperBound of the lyric line to pick
const randomUpperBound = lyricLine.length - lyricsToPick;
const startLyricLineIndex = randomNum(0, randomUpperBound - 1);
@ -292,7 +292,8 @@ export default {
playHistoryList() {
if (this.show && this.playHistoryMode === 'week') {
return this.liked.playHistory.weekData;
} else if (this.show && this.playHistoryMode === 'all') {
}
if (this.show && this.playHistoryMode === 'all') {
return this.liked.playHistory.allData;
}
return [];

Loading…
Cancel
Save