diff --git a/src/App.vue b/src/App.vue index fd423e5..63cfae8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -69,7 +69,6 @@ export default { }, }, created() { - this.settings.showLibraryDefault && this.$router.push('/library'); if (this.isElectron) ipcRenderer(this); window.addEventListener('keydown', this.handleKeydown); this.fetchData(); diff --git a/src/background.js b/src/background.js index 050184b..2525632 100644 --- a/src/background.js +++ b/src/background.js @@ -107,6 +107,7 @@ class Background { console.log('creating app window'); const appearance = this.store.get('settings.appearance'); + const showLibraryDefault = this.store.get('settings.showLibraryDefault'); this.window = new BrowserWindow({ width: this.store.get('window.width') || 1440, @@ -135,11 +136,19 @@ class Background { if (process.env.WEBPACK_DEV_SERVER_URL) { // Load the url of the dev server if in development mode - this.window.loadURL(process.env.WEBPACK_DEV_SERVER_URL); + this.window.loadURL( + showLibraryDefault + ? `${process.env.WEBPACK_DEV_SERVER_URL}/#/library` + : process.env.WEBPACK_DEV_SERVER_URL + ); if (!process.env.IS_TEST) this.window.webContents.openDevTools(); } else { createProtocol('app'); - this.window.loadURL('http://localhost:27232'); + this.window.loadURL( + showLibraryDefault + ? 'http://localhost:27232/#/library' + : 'http://localhost:27232' + ); } } @@ -236,7 +245,7 @@ class Background { console.log('app ready event'); // for development - if (process.env.NODE_ENV !== 'production') { + if (process.env.NODE_ENV === 'development') { this.initDevtools(); } @@ -262,7 +271,10 @@ class Background { createMenu(this.window); // create tray - if (['win32', 'linux'].includes(process.platform)) { + if ( + ['win32', 'linux'].includes(process.platform) || + process.env.NODE_ENV === 'development' + ) { this.tray = createTray(this.window); } diff --git a/src/components/Modal.vue b/src/components/Modal.vue index b6b6f01..4ddc909 100644 --- a/src/components/Modal.vue +++ b/src/components/Modal.vue @@ -68,6 +68,7 @@ export default { display: flex; justify-content: center; align-items: center; + z-index: 1000; } .modal { diff --git a/src/locale/lang/zh-CN.js b/src/locale/lang/zh-CN.js index 859b933..3ec55c2 100644 --- a/src/locale/lang/zh-CN.js +++ b/src/locale/lang/zh-CN.js @@ -45,7 +45,7 @@ export default { withAlbums: '张专辑', artist: '艺人', videos: '个MV', - following: '已关注', + following: '正在关注', follow: '关注', }, album: { diff --git a/src/store/actions.js b/src/store/actions.js index 609cf00..bff9910 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -71,6 +71,11 @@ export default { fetchLikedSongsWithDetails: ({ state, commit }) => { return getPlaylistDetail(state.data.likedSongPlaylistID, true).then( result => { + if (result.playlist?.trackIds?.length === 0) { + return new Promise(resolve => { + resolve(); + }); + } return getTrackDetail( result.playlist.trackIds .slice(0, 12) diff --git a/src/store/plugins/sendSettings.js b/src/store/plugins/sendSettings.js index 89eafa4..3bfe8ad 100644 --- a/src/store/plugins/sendSettings.js +++ b/src/store/plugins/sendSettings.js @@ -5,11 +5,7 @@ export function getSendSettingsPlugin() { store.subscribe((mutation, state) => { // console.log(mutation); if (mutation.type !== 'updateSettings') return; - ipcRenderer.send('settings', { - minimizeToTray: state.settings.minimizeToTray, - enableGlobalShortcut: state.settings.enableGlobalShortcut, - appearance: state.settings.appearance, - }); + ipcRenderer.send('settings', state.settings); }); }; } diff --git a/src/utils/common.js b/src/utils/common.js index 4b6aa84..b7f2355 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -37,6 +37,7 @@ export function isTrackPlayable(track) { } export function mapTrackPlayableStatus(tracks, privileges = []) { + if (tracks?.length === undefined) return tracks; return tracks.map(t => { const privilege = privileges.find(item => item.id === t.id) || {}; if (t.privilege) { diff --git a/src/views/artist.vue b/src/views/artist.vue index a6fe2cb..d576c90 100644 --- a/src/views/artist.vue +++ b/src/views/artist.vue @@ -323,8 +323,8 @@ export default { margin-bottom: 26px; color: var(--color-text); img { - height: 192px; - width: 192px; + height: 248px; + width: 248px; border-radius: 50%; margin-right: 56px; box-shadow: rgba(0, 0, 0, 0.2) 0px 12px 16px -8px; @@ -364,7 +364,7 @@ export default { margin-top: 24px; display: -webkit-box; -webkit-box-orient: vertical; - -webkit-line-clamp: 3; + -webkit-line-clamp: 2; overflow: hidden; cursor: pointer; white-space: pre-line; diff --git a/src/views/library.vue b/src/views/library.vue index 3c03316..a31b569 100644 --- a/src/views/library.vue +++ b/src/views/library.vue @@ -238,6 +238,7 @@ export default { this.$router.push({ path: '/library/liked-songs' }); }, getRandomLyric() { + if (this.liked.songs.length === 0) return; getLyric( this.liked.songs[randomNum(0, this.liked.songs.length - 1)] ).then(data => { diff --git a/src/views/settings.vue b/src/views/settings.vue index 72bdff3..4f83a2c 100644 --- a/src/views/settings.vue +++ b/src/views/settings.vue @@ -283,7 +283,7 @@ -