From e16176d6ea1744ed4a69bbe13837368c68d9d85f Mon Sep 17 00:00:00 2001 From: zilong Date: Mon, 1 Nov 2021 14:44:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=8D=95=E6=9B=B2=E6=90=9C?= =?UTF-8?q?=E7=B4=A2,=E5=85=B6=E4=BB=96pr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Songlist.vue | 2 +- src/store/index.js | 21 +++++++++- src/views/SearchResult.vue | 64 +++++++++++++++++++++---------- src/views/common/Search.vue | 1 + src/views/common/Searching.vue | 21 +++++++++- src/views/common/SongCtrl.vue | 10 +++-- src/views/common/ZPlayingList.vue | 16 +++++--- src/views/discover/Recommend.vue | 6 +-- 8 files changed, 105 insertions(+), 36 deletions(-) diff --git a/src/components/Songlist.vue b/src/components/Songlist.vue index 5dae589..711141d 100644 --- a/src/components/Songlist.vue +++ b/src/components/Songlist.vue @@ -185,7 +185,7 @@ export default { user-select: none; .trh{ - background-color: #eee; + background-color: #f0f0f0; font-weight: 600; td{ // background-color: red; diff --git a/src/store/index.js b/src/store/index.js index 0dc0da2..5fa4f85 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -5,7 +5,7 @@ export default createStore({ // appVersion: "0.0.1", // debugStr: "测试debug字符", showSongDetail: false, //是否显示歌曲详情 - keywords: '', //查询关键字 + keywords: "", //查询关键字 settings: { currentRoute: "/discover/recommend", //当前路由 songId: 0, //歌曲id @@ -125,6 +125,25 @@ export default createStore({ saveLoaclSettings(state.settings); } }, + // 搜索历史 + addSearchHistory(state, history) { + let h = state.settings.searchHistory.filter( + (item) => item != history + ); + h.unshift(history); + state.settings.searchHistory = h; + saveLoaclSettings(state.settings); + }, + removeSearchHistory(state, history) { + state.settings.searchHistory = state.settings.searchHistory.filter( + (item) => item != history + ); + saveLoaclSettings(state.settings); + }, + clearSearchHistory(state) { + state.settings.searchHistory = [] + saveLoaclSettings(state.settings); + }, }, actions: {}, modules: {}, diff --git a/src/views/SearchResult.vue b/src/views/SearchResult.vue index 03d78b7..6ebbe4e 100644 --- a/src/views/SearchResult.vue +++ b/src/views/SearchResult.vue @@ -1,38 +1,44 @@ @@ -146,12 +162,18 @@ export default {}; // border-bottom: solid 2px red; // } } - .bt{ + .bt { margin-top: -2px; height: 2px; background-color: #f0f0f0; } } } + + .pager{ + margin: 18px; + display: flex; + justify-content: center; + } } diff --git a/src/views/common/Search.vue b/src/views/common/Search.vue index c8247db..9400a80 100644 --- a/src/views/common/Search.vue +++ b/src/views/common/Search.vue @@ -17,6 +17,7 @@ const search = () => { if (keywords.value.length > 0){ pubsub.publish("zp.toggleSearch"); // elSearch.value.blur() + store.commit('addSearchHistory', keywords.value) router.push(`/search/1/${keywords.value}`); } }; diff --git a/src/views/common/Searching.vue b/src/views/common/Searching.vue index b148019..2514452 100644 --- a/src/views/common/Searching.vue +++ b/src/views/common/Searching.vue @@ -1,11 +1,13 @@