From 82e56c3d5179d41bb7f3e8449c778e39cf479efd Mon Sep 17 00:00:00 2001 From: zilong Date: Mon, 1 Nov 2021 00:28:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E5=AE=8C=E6=88=90=E5=8D=95?= =?UTF-8?q?=E6=9B=B2=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 40 ++++ src/assets/svgs/SearchOutline.svg | 1 + src/components/Songlist.vue | 332 ++++++++++++++++++++++++++++++ src/components/SongsList.vue | 60 ++++++ src/network/search.js | 46 +++++ src/router/index.js | 9 + src/store/index.js | 2 + src/views/SearchResult.vue | 157 ++++++++++++++ src/views/common/Search.vue | 60 +++++- src/views/common/Searching.vue | 226 ++++++++++++++++++++ 10 files changed, 925 insertions(+), 8 deletions(-) create mode 100644 src/assets/svgs/SearchOutline.svg create mode 100644 src/components/Songlist.vue create mode 100644 src/components/SongsList.vue create mode 100644 src/network/search.js create mode 100644 src/views/SearchResult.vue create mode 100644 src/views/common/Searching.vue diff --git a/src/App.vue b/src/App.vue index 64ca028..9b36d7d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,6 +13,7 @@ import SongStatus from "./views/common/SongStatus.vue"; import SongProgress from "@/views/common/SongProgress.vue"; import PlayingList from "@/views/common/PlayingList.vue"; import ZPlayingList from "@/views/common/ZPlayingList.vue"; +import Searching from "@/views/common/Searching.vue"; import SongDetail from "@/views/common/SongDetail.vue"; import pubsub from "pubsub-js"; import { @@ -47,6 +48,7 @@ store.commit("loadCaches"); const showPlaying = ref(false); //是否显示播放列表 const showSongDetail = ref(false); //是否显示歌曲详细信息 +const showSearch = ref(false); //是否显示搜索 watch( ()=> store.state.showSongDetail, @@ -78,6 +80,12 @@ const token = pubsub.subscribe("zp", (msg, data) => { case "zp.toggleSongDetail": showSongDetail.value = store.state.showSongDetail = !showSongDetail.value; break; + case "zp.showSearch": + showSearch.value = true; + break; + case "zp.toggleSearch": + showSearch.value = !showSearch.value ; + break; } }); @@ -91,6 +99,7 @@ onUnmounted(() => { const wpEl = ref('') const hideWins = (e) => { // console.log(e.clientX > 0,e, wpEl.value.clientWidth); + //显示当前播放 if (showPlaying.value && e.clientX > 0 && e.clientX < wpEl.value.clientWidth - 500 @@ -99,6 +108,15 @@ const hideWins = (e) => { ) { showPlaying.value = false; } + //显示搜索 + if (showSearch.value + && e.clientX > 0 + && e.clientX < wpEl.value.clientWidth - 360 + && e.clientY > 40 + && e.clientY < wpEl.value.clientHeight - 64 + ) { + showSearch.value = false; + } }; @@ -144,6 +162,11 @@ const hideWins = (e) => { +
+ +