From 350abb961db920366d7cea5daa91425b24e8fd11 Mon Sep 17 00:00:00 2001 From: mackt <1033530438@qq.com> Date: Sun, 28 Apr 2024 11:49:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(Player):=20=E6=B7=BB=E5=8A=A0=20vol=20?= =?UTF-8?q?=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/vol/[journalId]/page.tsx | 2 +- src/components/AudioPlayer/PlayerCard.tsx | 43 +++++++++++++++++------ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/app/vol/[journalId]/page.tsx b/src/app/vol/[journalId]/page.tsx index 7d4cc09..82dc51c 100644 --- a/src/app/vol/[journalId]/page.tsx +++ b/src/app/vol/[journalId]/page.tsx @@ -43,7 +43,7 @@ export default async function JournalDetail({ params: { journalId } }: { params: {tag} diff --git a/src/components/AudioPlayer/PlayerCard.tsx b/src/components/AudioPlayer/PlayerCard.tsx index 2080b82..3858586 100644 --- a/src/components/AudioPlayer/PlayerCard.tsx +++ b/src/components/AudioPlayer/PlayerCard.tsx @@ -1,6 +1,7 @@ import { useState, useEffect } from 'react'; import Image from 'next/image'; +import { useRouter } from 'next/navigation'; import { useShallow } from 'zustand/react/shallow'; import clientHttp from '@/utils/request/client'; @@ -17,13 +18,15 @@ interface Prop { } export default function PlayerCard({ show, className }: Prop) { - const { audioId, playList, playQueue, playState, setPlayList, setPlayQueue } = useAudioStore( + const router = useRouter(); + const { audioId, playList, playQueue, playState, setShowCard, setPlayList, setPlayQueue } = useAudioStore( useShallow((state) => { return { playState: state.playState, audioId: state.audioId, playList: state.playList, playQueue: state.playQueue, + setShowCard: state.setShowCard, setPlayList: state.setPlayList, setPlayQueue: state.setPlayQueue, }; @@ -57,6 +60,11 @@ export default function PlayerCard({ show, className }: Prop) { } }; + const handleGoVol = (no: string) => { + router.push(`/vol/${no}`); + setShowCard(false); + }; + useEffect(() => { getLrc(audioInfo?.lrc ?? ''); }, [audioInfo]); @@ -70,8 +78,9 @@ export default function PlayerCard({ show, className }: Prop) {
- {audioInfo?.title ?? ''} -
- {/* 歌手/专辑 */} - {audioInfo?.artist && audioInfo?.album && ( -{`${audioInfo.artist}/${audioInfo.album}`}
- )} + + {/* 歌曲信息 */} ++ {audioInfo?.title ?? ''} +
+ {/* 歌手/专辑 */} + {audioInfo?.artist && audioInfo?.album && ( +{`${audioInfo.artist}/${audioInfo.album}`}
+ )} +