fix: bugs

This commit is contained in:
qier222 2021-05-18 15:54:51 +08:00
parent ad0c585371
commit 41a30a25c0
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
11 changed files with 315 additions and 33 deletions

View file

@ -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();

View file

@ -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);
}

View file

@ -68,6 +68,7 @@ export default {
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
.modal {

View file

@ -45,7 +45,7 @@ export default {
withAlbums: '张专辑',
artist: '艺人',
videos: '个MV',
following: '关注',
following: '正在关注',
follow: '关注',
},
album: {

View file

@ -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)

View file

@ -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);
});
};
}

View file

@ -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) {

View file

@ -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;

View file

@ -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 => {

View file

@ -283,7 +283,7 @@
</div>
</div>
<div class="item">
<div v-if="isElectron" class="item">
<div class="left">
<div class="title"> {{ $t('settings.showLibraryDefault') }}</div>
</div>