2018-08-11 07:47:10 +02:00
|
|
|
<template>
|
2022-02-19 06:18:01 +01:00
|
|
|
<div class="fd-page-with-tabs">
|
2022-02-19 06:39:14 +01:00
|
|
|
<tabs-audiobooks />
|
2018-08-11 07:47:10 +02:00
|
|
|
<content-with-heading>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #options>
|
2022-02-19 07:47:54 +01:00
|
|
|
<index-button-list :index="albums.indexList" />
|
2020-09-27 19:22:33 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="title is-4" v-text="$t('page.audiobooks.albums.title')" />
|
2022-05-29 18:49:00 +02:00
|
|
|
<p
|
|
|
|
class="heading"
|
|
|
|
v-text="$t('page.audiobooks.albums.count', { count: albums.count })"
|
|
|
|
/>
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-02-19 07:47:54 +01:00
|
|
|
<list-albums :albums="albums" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
2023-07-18 15:48:56 +02:00
|
|
|
import { GroupByList, byName } from '@/lib/GroupByList'
|
|
|
|
import IndexButtonList from '@/components/IndexButtonList.vue'
|
2022-02-19 06:18:01 +01:00
|
|
|
import ListAlbums from '@/components/ListAlbums.vue'
|
2023-07-18 15:48:56 +02:00
|
|
|
import TabsAudiobooks from '@/components/TabsAudiobooks.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
2022-02-19 06:18:01 +01:00
|
|
|
const dataObject = {
|
2023-06-07 21:25:54 +02:00
|
|
|
load(to) {
|
2020-06-30 10:24:11 +02:00
|
|
|
return webapi.library_albums('audiobook')
|
2018-08-11 07:47:10 +02:00
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
set(vm, response) {
|
2022-02-19 07:47:54 +01:00
|
|
|
vm.albums = new GroupByList(response.data)
|
2023-06-04 13:54:01 +02:00
|
|
|
vm.albums.group(byName('name_sort', true))
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2020-09-20 08:15:46 +02:00
|
|
|
name: 'PageAudiobooksAlbums',
|
2022-02-19 06:39:14 +01:00
|
|
|
components: {
|
|
|
|
TabsAudiobooks,
|
|
|
|
ContentWithHeading,
|
|
|
|
IndexButtonList,
|
|
|
|
ListAlbums
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
next((vm) => dataObject.set(vm, response))
|
|
|
|
})
|
|
|
|
},
|
2022-02-19 07:47:54 +01:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
beforeRouteUpdate(to, from, next) {
|
2022-02-19 07:47:54 +01:00
|
|
|
if (!this.albums.isEmpty()) {
|
|
|
|
next()
|
|
|
|
return
|
|
|
|
}
|
2022-02-19 06:39:14 +01:00
|
|
|
const vm = this
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
dataObject.set(vm, response)
|
|
|
|
next()
|
|
|
|
})
|
|
|
|
},
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
data() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return {
|
2022-02-19 07:47:54 +01:00
|
|
|
albums: new GroupByList()
|
2020-09-27 19:22:33 +02:00
|
|
|
}
|
2023-06-30 03:51:38 +02:00
|
|
|
}
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|