From 017b47fded9c714c5d702e0e72d44d4cdf25774d Mon Sep 17 00:00:00 2001 From: alger Date: Thu, 12 Sep 2024 16:44:42 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=90=84=E7=A7=8D=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 1 + src/App.vue | 4 +--- src/components/MusicList.vue | 2 +- src/components/common/SearchItem.vue | 1 - src/components/common/SongItem.vue | 10 +++++----- src/hooks/MusicHistoryHook.ts | 8 ++++---- src/hooks/MusicHook.ts | 15 +++++++++++--- src/layout/AppLayout.vue | 14 +------------ src/layout/components/MusicFull.vue | 12 +++++------ src/layout/components/PlayBar.vue | 30 +++++++++++++++------------- src/store/index.ts | 12 +++++------ src/type/music.ts | 7 +++++-- src/views/search/index.vue | 1 - src/views/set/index.vue | 4 +++- 14 files changed, 61 insertions(+), 60 deletions(-) diff --git a/components.d.ts b/components.d.ts index c777cfd..78bddce 100644 --- a/components.d.ts +++ b/components.d.ts @@ -25,6 +25,7 @@ declare module 'vue' { NSlider: typeof import('naive-ui')['NSlider'] NSwitch: typeof import('naive-ui')['NSwitch'] NTooltip: typeof import('naive-ui')['NTooltip'] + NVirtualList: typeof import('naive-ui')['NVirtualList'] PlayBottom: typeof import('./src/components/common/PlayBottom.vue')['default'] PlayListsItem: typeof import('./src/components/common/PlayListsItem.vue')['default'] PlaylistType: typeof import('./src/components/PlaylistType.vue')['default'] diff --git a/src/App.vue b/src/App.vue index 06a029d..caaa1c6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,9 +3,7 @@ - - - + diff --git a/src/components/MusicList.vue b/src/components/MusicList.vue index 35d9cc3..8a83910 100644 --- a/src/components/MusicList.vue +++ b/src/components/MusicList.vue @@ -3,7 +3,7 @@ :show="show" :height="isMobile ? '100vh' : '70vh'" placement="bottom" - :drawer-style="{ backgroundColor: 'transparent' }" + :style="{ backgroundColor: 'transparent' }" >
diff --git a/src/components/common/SearchItem.vue b/src/components/common/SearchItem.vue index 4559808..16a3353 100644 --- a/src/components/common/SearchItem.vue +++ b/src/components/common/SearchItem.vue @@ -50,7 +50,6 @@ const handleClick = async () => { if (props.item.type === '专辑') { showPop.value = true; const res = await getAlbum(props.item.id); - console.log('res.data', res.data); songList.value = res.data.songs.map((song: any) => { song.al.picUrl = song.al.picUrl || props.item.picUrl; return song; diff --git a/src/components/common/SongItem.vue b/src/components/common/SongItem.vue index c77ad77..3d9ca33 100644 --- a/src/components/common/SongItem.vue +++ b/src/components/common/SongItem.vue @@ -7,8 +7,8 @@
- {{ artists.name }}{{ artistsindex < item.song.artists.length - 1 ? ' / ' : '' }}{{ artists.name }}{{ artistsindex < item.artists.length - 1 ? ' / ' : '' }}
@@ -32,12 +32,12 @@ diff --git a/src/store/index.ts b/src/store/index.ts index 65f0934..5282e71 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -3,17 +3,17 @@ import { createStore } from 'vuex'; import { getMusicUrl, getParsingMusicUrl } from '@/api/music'; import { useMusicHistory } from '@/hooks/MusicHistoryHook'; import homeRouter from '@/router/home'; -import { SongResult } from '@/type/music'; +import type { Song } from '@/type/music'; import { getMusicProxyUrl } from '@/utils'; interface State { menus: any[]; play: boolean; isPlay: boolean; - playMusic: SongResult; + playMusic: Song; playMusicUrl: string; user: any; - playList: SongResult[]; + playList: Song[]; playListIndex: number; setData: any; lyric: any; @@ -24,7 +24,7 @@ const state: State = { menus: homeRouter, play: false, isPlay: false, - playMusic: {} as SongResult, + playMusic: {} as Song, playMusicUrl: '', user: localStorage.getItem('user') ? JSON.parse(localStorage.getItem('user') as string) : null, playList: [], @@ -42,7 +42,7 @@ const mutations = { setMenus(state: State, menus: any[]) { state.menus = menus; }, - async setPlay(state: State, playMusic: SongResult) { + async setPlay(state: State, playMusic: Song) { state.playMusic = { ...playMusic, playLoading: true }; state.playMusicUrl = await getSongUrl(playMusic.id); state.play = true; @@ -55,7 +55,7 @@ const mutations = { setPlayMusic(state: State, play: boolean) { state.play = play; }, - setPlayList(state: State, playList: SongResult[]) { + setPlayList(state: State, playList: Song[]) { state.playListIndex = playList.findIndex((item) => item.id === state.playMusic.id); state.playList = playList; }, diff --git a/src/type/music.ts b/src/type/music.ts index cb88a4b..bfa3e25 100644 --- a/src/type/music.ts +++ b/src/type/music.ts @@ -1,7 +1,7 @@ export interface IRecommendMusic { code: number; category: number; - result: SongResult[]; + result: Song[]; } export interface SongResult { @@ -18,7 +18,7 @@ export interface SongResult { playLoading?: boolean; } -interface Song { +export interface Song { name: string; id: number; position: number; @@ -64,6 +64,9 @@ interface Song { lMusic: BMusic; exclusive: boolean; privilege: Privilege; + count?: number; + playLoading?: boolean; + picUrl?: string; } interface Privilege { diff --git a/src/views/search/index.vue b/src/views/search/index.vue index c2e30dd..e66e2c7 100644 --- a/src/views/search/index.vue +++ b/src/views/search/index.vue @@ -133,7 +133,6 @@ const loadSearch = async (keywords: any) => { // songs map 替换属性 songs.forEach((item: any) => { item.picUrl = item.al.picUrl; - item.song = item; item.artists = item.ar; }); albums.forEach((item: any) => { diff --git a/src/views/set/index.vue b/src/views/set/index.vue index 40d7abc..88f1423 100644 --- a/src/views/set/index.vue +++ b/src/views/set/index.vue @@ -49,7 +49,9 @@ const windowData = window as any; const handleSave = () => { store.commit('setSetData', setData.value); - windowData.electronAPI.restart(); + if (windowData.electronAPI) { + windowData.electronAPI.restart(); + } };