From 0bbc2558a54d58ba9a1d7727ec7038f93f98db1e Mon Sep 17 00:00:00 2001 From: alger Date: Fri, 8 Oct 2021 17:16:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A6=96=E9=A1=B5=E6=AD=8C?= =?UTF-8?q?=E5=8D=95cat=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/list.ts | 17 +++++++-- src/components/PlaylistType.vue | 11 ++++++ src/components/common/MPop.vue | 41 ++++++++++++++++++++++ src/layout/components/PlayBar.vue | 3 +- src/views/list/index.vue | 57 +++++++++++++++++++++++++------ src/views/user/index.vue | 5 +++ 6 files changed, 120 insertions(+), 14 deletions(-) create mode 100644 src/components/common/MPop.vue diff --git a/src/api/list.ts b/src/api/list.ts index d873be5..096cbbe 100644 --- a/src/api/list.ts +++ b/src/api/list.ts @@ -1,5 +1,5 @@ import request from "@/utils/request"; -import { IList, IRecommendList } from "@/type/list"; +import { IList } from "@/type/list"; import type { IListDetail } from "@/type/listDetail"; interface IListByTagParams { @@ -8,14 +8,27 @@ interface IListByTagParams { limit: number; } +interface IListByCatParams { + cat: string; + offset: number; + limit: number; +} + // 根据tag 获取歌单列表 export function getListByTag(params: IListByTagParams) { return request.get("/top/playlist/highquality", { params: params }); } +// 根据cat 获取歌单列表 +export function getListByCat(params: IListByCatParams) { + return request.get("/top/playlist", { + params: params, + }); +} + // 获取推荐歌单 export function getRecommendList(limit: number = 30) { - return request.get("/personalized", { params: { limit } }); + return request.get("/personalized", { params: { limit } }); } // 获取歌单详情 diff --git a/src/components/PlaylistType.vue b/src/components/PlaylistType.vue index 4fb52fc..745a8c6 100644 --- a/src/components/PlaylistType.vue +++ b/src/components/PlaylistType.vue @@ -9,6 +9,7 @@ :class="setAnimationClass('animate__bounceIn')" :style="setAnimationDelay(index <= 13 ? index : index - 13)" v-if="isShowAllPlaylistCategory || index <= 13" + @click="handleClickPlaylistType(item.name)" >{{ item.name }}
(); // 是否显示全部歌单分类 @@ -43,6 +45,15 @@ const loadPlaylistCategory = async () => { playlistCategory.value = data; }; +const router = useRouter(); +const handleClickPlaylistType = (type: any) => { + router.push({ + path: "/list", + query: { + type: type, + } + }); +}; // 页面初始化 onMounted(() => { loadPlaylistCategory(); diff --git a/src/components/common/MPop.vue b/src/components/common/MPop.vue new file mode 100644 index 0000000..a17a278 --- /dev/null +++ b/src/components/common/MPop.vue @@ -0,0 +1,41 @@ + + + + + \ No newline at end of file diff --git a/src/layout/components/PlayBar.vue b/src/layout/components/PlayBar.vue index 6a62214..90b5192 100644 --- a/src/layout/components/PlayBar.vue +++ b/src/layout/components/PlayBar.vue @@ -187,7 +187,8 @@ const onAudio = (audio: any) => { allTime.value = audio.duration if (audio.currentTime >= audio.duration) { - store.commit("setPlayMusic", false); + // store.commit("setPlayMusic", false); + audio.play() } // 获取音量 audioVolume.value = audio.volume diff --git a/src/views/list/index.vue b/src/views/list/index.vue index 8038192..f3c8b58 100644 --- a/src/views/list/index.vue +++ b/src/views/list/index.vue @@ -1,19 +1,16 @@