From b8f9cfe90e04e91c9d05888f398f3320301fa239 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Wed, 11 Nov 2020 15:53:33 +0100 Subject: [PATCH] fix navigation and search routing --- lib/Search/SearchProvider.php | 2 +- src/components/Main.vue | 13 +++++++------ src/components/Player.vue | 2 -- src/router.js | 6 +++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/Search/SearchProvider.php b/lib/Search/SearchProvider.php index 149d849..f7d855e 100644 --- a/lib/Search/SearchProvider.php +++ b/lib/Search/SearchProvider.php @@ -69,7 +69,7 @@ class SearchProvider implements IProvider { $result['favicon'], $result['name'], str_replace(",",", ",$result['tags']), - $this->url->linkToRouteAbsolute('radio.page.index') . 'search#'.$term, + $this->url->linkToRouteAbsolute('radio.page.index') . '#/search/' . $term, 'icon-radio-trans' ); }, $parsed); diff --git a/src/components/Main.vue b/src/components/Main.vue index 0120d8a..f752290 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -179,21 +179,21 @@ export default { const vm = this const queryBase = this.$apiUrl + '/json/stations' + let queryURI = queryBase + let sortBy = 'clickcount' if (vm.offset === 0) { vm.pageLoading = true } - let sortBy = 'clickcount' if (menuState === 'TOP') { sortBy = 'clickcount' } else if (menuState === 'NEW') { sortBy = 'lastchangetime' - } - - let queryURI = queryBase - if (menuState === 'SEARCH') { - const searchQuery = vm.$route.hash.substr(1) + } else if (menuState === 'SEARCH') { + // const searchQuery = vm.$route.hash.substr(1) + const searchQuery = vm.$route.params.query + console.log(searchQuery) queryURI = queryBase + '/byname/' + searchQuery } else if (menuState === 'FAVORITES') { queryURI = generateUrl('/apps/radio/api/favorites') @@ -221,6 +221,7 @@ export default { vm.pageLoading = false }) }, + /** * On scroll event, load more stations if bottom reached */ diff --git a/src/components/Player.vue b/src/components/Player.vue index 09e67bb..e2a0324 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -103,8 +103,6 @@ export default { white-space: nowrap; overflow: hidden; background: red; - position: relative; - } .volumeIcon { diff --git a/src/router.js b/src/router.js index d597b6d..92b0f43 100644 --- a/src/router.js +++ b/src/router.js @@ -9,8 +9,7 @@ import store from './store.js' Vue.use(Router) const router = new Router({ - mode: 'history', - base: generateUrl('/apps/radio'), + base: generateUrl('/apps/radio/'), linkActiveClass: 'active', routes: [ { @@ -39,9 +38,10 @@ const router = new Router({ name: 'CATEGORIES', }, { - path: '/search', + path: '/search/:query', component: Main, name: 'SEARCH', + props: {}, }, ], })