From 9590f0408847c90cd0bf5c1718e6f088fa2d7035 Mon Sep 17 00:00:00 2001 From: hsy <3271660881@qq.com> Date: Thu, 7 Jul 2022 19:55:28 +0800 Subject: [PATCH] feat_hsy --- src/components/PlayListDetail.vue | 10 ++- src/components/PlayLists.vue | 2 +- src/components/Player.vue | 129 +++++++++++++++++++++++++++--- src/components/SideBar.vue | 47 ++++++++--- src/index.css | 6 +- src/router/index.js | 9 +++ src/views/Login.vue | 20 ++++- src/views/Player.vue | 10 +-- 8 files changed, 197 insertions(+), 36 deletions(-) diff --git a/src/components/PlayListDetail.vue b/src/components/PlayListDetail.vue index 28043b4..0e99cab 100644 --- a/src/components/PlayListDetail.vue +++ b/src/components/PlayListDetail.vue @@ -42,7 +42,13 @@ export default { emitter.on("sendId", async (id) => { let res = await GetArtistDesc("artist/desc", id); songerDec.value = res.data.briefDesc; - coverPic.value = res.data.topicData[0].coverUrl; + if (res.data.topicData) { + //当图片数据存在时 + coverPic.value = res.data.topicData[0].coverUrl; + } else { + //当图片数据不存在时 + coverPic.value = ""; + } }); return { songerDec, @@ -66,6 +72,8 @@ export default { height: 200px; width: 200px; border-radius: 20px; + overflow: hidden; /** 弹性子元素的overflow失效问题 */ + flex: 0 0 auto; /** 给弹性子元素加上 flex:0 0 auto; */ } .detail-img .img { height: 200px; diff --git a/src/components/PlayLists.vue b/src/components/PlayLists.vue index 3333c43..2336ba1 100644 --- a/src/components/PlayLists.vue +++ b/src/components/PlayLists.vue @@ -99,7 +99,7 @@ export default { getTopSongs("artist/top/song", id).then((res) => { playlists.length = 0; // 清空数组 playlists.push(res.data.songs); - // console.log(playlists); + // console.log(playlists[0][0]); // 存储所有歌曲的 id playlists[0].forEach((item) => { ids.push(item.id); diff --git a/src/components/Player.vue b/src/components/Player.vue index b0dde80..24a1e91 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -1,38 +1,146 @@ - - + + 您的浏览器不支持 audio 元素。 - + - 新地球 - - 林俊杰 + 太傻 - + 巫启贤 - + - 02:03 / 5:00 + {{ nowTime }} / {{ durationTime }} @@ -40,8 +148,7 @@ export default {