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