fix navigation and search routing

This commit is contained in:
Jonas Heinrich 2020-11-11 15:53:33 +01:00
parent f421548979
commit b8f9cfe90e
4 changed files with 11 additions and 12 deletions

View File

@ -69,7 +69,7 @@ class SearchProvider implements IProvider {
$result['favicon'], $result['favicon'],
$result['name'], $result['name'],
str_replace(",",", ",$result['tags']), str_replace(",",", ",$result['tags']),
$this->url->linkToRouteAbsolute('radio.page.index') . 'search#'.$term, $this->url->linkToRouteAbsolute('radio.page.index') . '#/search/' . $term,
'icon-radio-trans' 'icon-radio-trans'
); );
}, $parsed); }, $parsed);

View File

@ -179,21 +179,21 @@ export default {
const vm = this const vm = this
const queryBase = this.$apiUrl + '/json/stations' const queryBase = this.$apiUrl + '/json/stations'
let queryURI = queryBase
let sortBy = 'clickcount'
if (vm.offset === 0) { if (vm.offset === 0) {
vm.pageLoading = true vm.pageLoading = true
} }
let sortBy = 'clickcount'
if (menuState === 'TOP') { if (menuState === 'TOP') {
sortBy = 'clickcount' sortBy = 'clickcount'
} else if (menuState === 'NEW') { } else if (menuState === 'NEW') {
sortBy = 'lastchangetime' sortBy = 'lastchangetime'
} } else if (menuState === 'SEARCH') {
// const searchQuery = vm.$route.hash.substr(1)
let queryURI = queryBase const searchQuery = vm.$route.params.query
if (menuState === 'SEARCH') { console.log(searchQuery)
const searchQuery = vm.$route.hash.substr(1)
queryURI = queryBase + '/byname/' + searchQuery queryURI = queryBase + '/byname/' + searchQuery
} else if (menuState === 'FAVORITES') { } else if (menuState === 'FAVORITES') {
queryURI = generateUrl('/apps/radio/api/favorites') queryURI = generateUrl('/apps/radio/api/favorites')
@ -221,6 +221,7 @@ export default {
vm.pageLoading = false vm.pageLoading = false
}) })
}, },
/** /**
* On scroll event, load more stations if bottom reached * On scroll event, load more stations if bottom reached
*/ */

View File

@ -103,8 +103,6 @@ export default {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
background: red; background: red;
position: relative;
} }
.volumeIcon { .volumeIcon {

View File

@ -9,8 +9,7 @@ import store from './store.js'
Vue.use(Router) Vue.use(Router)
const router = new Router({ const router = new Router({
mode: 'history', base: generateUrl('/apps/radio/'),
base: generateUrl('/apps/radio'),
linkActiveClass: 'active', linkActiveClass: 'active',
routes: [ routes: [
{ {
@ -39,9 +38,10 @@ const router = new Router({
name: 'CATEGORIES', name: 'CATEGORIES',
}, },
{ {
path: '/search', path: '/search/:query',
component: Main, component: Main,
name: 'SEARCH', name: 'SEARCH',
props: {},
}, },
], ],
}) })