From 9178682fd53e28a04c632fa84613451a8bcb4d6e Mon Sep 17 00:00:00 2001 From: mackt <1033530438@qq.com> Date: Sun, 28 Apr 2024 10:32:00 +0800 Subject: [PATCH] =?UTF-8?q?update(FM):=201.=20=E7=82=B9=E5=87=BB=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E4=B8=8D=E6=94=B9=E5=8F=98=E6=92=AD=E6=94=BE=E7=8A=B6?= =?UTF-8?q?=E6=80=81=202.=20=E5=88=9D=E6=AC=A1=E8=AF=B7=E6=B1=82=20random?= =?UTF-8?q?=20song=20=E6=95=B0=E9=87=8F=E6=94=B9=E4=B8=BA=2030?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Button/ButtonFM.tsx | 39 ++++++++++++------------------ 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/src/components/Button/ButtonFM.tsx b/src/components/Button/ButtonFM.tsx index d19ddb5..e2db585 100644 --- a/src/components/Button/ButtonFM.tsx +++ b/src/components/Button/ButtonFM.tsx @@ -9,27 +9,20 @@ import { useAudioStore } from '@/store'; export default function ButtonFM() { const { toast } = useToast(); - const { - playListInfo, - setPlayListInfo, - setPlayList, - setAudioId, - setPlayState, - setPlayQueue, - setPlayOrder, - setShowCard, - } = useAudioStore( - useShallow((state) => ({ - playListInfo: state.playListInfo, - setPlayListInfo: state.setPlayListInfo, - setAudioId: state.setAudioId, - setPlayState: state.setPlayState, - setPlayList: state.setPlayList, - setPlayQueue: state.setPlayQueue, - setPlayOrder: state.setPlayOrder, - setShowCard: state.setShowCard, - })), - ); + const { playListInfo, setPlayListInfo, setPlayList, setAudioId, setPlayQueue, setPlayOrder, setShowCard } = + useAudioStore( + useShallow((state) => ({ + playState: state.playState, + playListInfo: state.playListInfo, + setPlayListInfo: state.setPlayListInfo, + setAudioId: state.setAudioId, + setPlayState: state.setPlayState, + setPlayList: state.setPlayList, + setPlayQueue: state.setPlayQueue, + setPlayOrder: state.setPlayOrder, + setShowCard: state.setShowCard, + })), + ); /** * 1. 在 random 接口拿 30 首歌 @@ -41,11 +34,11 @@ export default function ButtonFM() { const handlePlayFM = async () => { if (playListInfo.type === 'fm') { setShowCard(true); - setPlayState(true); + // if (!playState) setPlayState(true); return; } - const res = await apiGetSongRandom(5); + const res = await apiGetSongRandom(30); if (res.code === 200 && res.data.length > 0) { const setRes = setPlayListInfo({