diff --git a/components.d.ts b/components.d.ts index 3c9cc2d..11a6d09 100644 --- a/components.d.ts +++ b/components.d.ts @@ -97,18 +97,15 @@ declare module 'vue' { NP: typeof import('naive-ui')['NP'] NPopconfirm: typeof import('naive-ui')['NPopconfirm'] NPopover: typeof import('naive-ui')['NPopover'] - NProgress: typeof import('naive-ui')['NProgress'] NQrCode: typeof import('naive-ui')['NQrCode'] NRadio: typeof import('naive-ui')['NRadio'] NRadioGroup: typeof import('naive-ui')['NRadioGroup'] - NResult: typeof import('naive-ui')['NResult'] NScrollbar: typeof import('naive-ui')['NScrollbar'] NSelect: typeof import('naive-ui')['NSelect'] NSkeleton: typeof import('naive-ui')['NSkeleton'] NSlider: typeof import('naive-ui')['NSlider'] NSpin: typeof import('naive-ui')['NSpin'] NSwitch: typeof import('naive-ui')['NSwitch'] - NTab: typeof import('naive-ui')['NTab'] NTabPane: typeof import('naive-ui')['NTabPane'] NTabs: typeof import('naive-ui')['NTabs'] NTag: typeof import('naive-ui')['NTag'] diff --git a/electron.vite.config.ts b/electron.vite.config.ts index 5fa11c7..7a79650 100644 --- a/electron.vite.config.ts +++ b/electron.vite.config.ts @@ -6,7 +6,7 @@ import vue from "@vitejs/plugin-vue"; import AutoImport from "unplugin-auto-import/vite"; import Components from "unplugin-vue-components/vite"; import viteCompression from "vite-plugin-compression"; -import VueDevTools from "vite-plugin-vue-devtools"; +// import VueDevTools from "vite-plugin-vue-devtools"; import wasm from "vite-plugin-wasm"; export default defineConfig(({ command, mode }) => { @@ -49,7 +49,7 @@ export default defineConfig(({ command, mode }) => { root: ".", plugins: [ vue(), - mode === "development" && VueDevTools(), + // mode === "development" && VueDevTools(), AutoImport({ imports: [ "vue", diff --git a/electron/main/ipc/ipc-lyric.ts b/electron/main/ipc/ipc-lyric.ts index 1c2f07f..a24dd24 100644 --- a/electron/main/ipc/ipc-lyric.ts +++ b/electron/main/ipc/ipc-lyric.ts @@ -16,11 +16,16 @@ const initLyricIpc = (): void => { // 切换桌面歌词 ipcMain.on("toggle-desktop-lyric", (_event, val: boolean) => { if (val) { - lyricWin = lyricWindow.create(); + if (!lyricWin) { + lyricWin = lyricWindow.create(); + } else { + lyricWin?.show(); + } lyricWin?.setAlwaysOnTop(true, "screen-saver"); } else { - lyricWin?.destroy(); - lyricWin = null; + // 关闭:不销毁窗口,直接隐藏,保留位置与状态 + if (!lyricWin) return; + lyricWin.hide(); } }); diff --git a/src/api/song.ts b/src/api/song.ts index d73bc31..9b5bbcd 100644 --- a/src/api/song.ts +++ b/src/api/song.ts @@ -73,7 +73,7 @@ export const songLyric = (id: number) => { */ export const songLyricTTML = async (id: number) => { if (isElectron) { - return request({ url: "/lyric/ttml", params: { id } }); + return request({ url: "/lyric/ttml", params: { id, noCookie: true } }); } else { const url = `https://amll-ttml-db.stevexmh.net/ncm/${id}`; try { diff --git a/src/components/Player/FullPlayer.vue b/src/components/Player/FullPlayer.vue index b1a20b8..17d50f7 100644 --- a/src/components/Player/FullPlayer.vue +++ b/src/components/Player/FullPlayer.vue @@ -55,7 +55,7 @@ -
+
{ flex-direction: column; align-items: center; justify-content: center; + will-change: width, opacity, transform; transition: width 0.3s, opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), @@ -232,6 +233,7 @@ onBeforeUnmount(() => { max-width: 50%; display: flex; flex-direction: column; + transition: opacity 0.3s; .player-data { margin-top: 0; margin-bottom: 26px; @@ -272,6 +274,9 @@ onBeforeUnmount(() => { .content-left { width: 100%; } + .content-right { + opacity: 0; + } } } } diff --git a/src/components/Player/MainAMLyric.vue b/src/components/Player/MainAMLyric.vue index 3f03fc9..7abe002 100644 --- a/src/components/Player/MainAMLyric.vue +++ b/src/components/Player/MainAMLyric.vue @@ -4,7 +4,9 @@ :key="amLyricsData?.[0]?.words?.length" :class="['lyric-am', { pure: statusStore.pureLyricMode }]" > +
歌词正在加载中...
(null); // 实时播放进度 -const playSeek = ref(player.getSeek()); +const playSeek = ref( + Math.floor((player.getSeek() + statusStore.getSongOffset(musicStore.playSong?.id)) * 1000), +); // 实时更新播放进度 const { pause: pauseSeek, resume: resumeSeek } = useRafFn(() => { - const seekInSeconds = player.getSeek(); + const songId = musicStore.playSong?.id; + const offsetSeconds = statusStore.getSongOffset(songId); + const seekInSeconds = player.getSeek() + offsetSeconds; playSeek.value = Math.floor(seekInSeconds * 1000); }); @@ -164,4 +169,14 @@ onBeforeUnmount(() => { font-family: var(--ja-font-family); } } + +.lyric-loading { + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + color: var(--amll-lyric-view-color, #efefef); + font-size: 22px; +} diff --git a/src/components/Player/MainLyric.vue b/src/components/Player/MainLyric.vue index 0f68bae..ebf3650 100644 --- a/src/components/Player/MainLyric.vue +++ b/src/components/Player/MainLyric.vue @@ -26,7 +26,8 @@ @after-enter="lyricsScroll(statusStore.lyricIndex)" @after-leave="lyricsScroll(statusStore.lyricIndex)" > - +
歌词正在加载中...
+