2020-06-30 10:24:11 +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 />
|
2020-06-30 10:24:11 +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="artists.indexList" />
|
2020-06-30 10:24:11 +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.artists.title')" />
|
2022-05-29 18:49:00 +02:00
|
|
|
<p
|
|
|
|
class="heading"
|
2022-06-04 13:57:08 +02:00
|
|
|
v-text="$t('page.audiobooks.artists.count', { count: artists.count })"
|
2022-05-29 18:49:00 +02:00
|
|
|
/>
|
2020-06-30 10:24:11 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-right />
|
|
|
|
<template #content>
|
2022-02-19 07:47:54 +01:00
|
|
|
<list-artists :artists="artists" />
|
2020-06-30 10:24:11 +02:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
|
|
|
import TabsAudiobooks from '@/components/TabsAudiobooks.vue'
|
|
|
|
import IndexButtonList from '@/components/IndexButtonList.vue'
|
|
|
|
import ListArtists from '@/components/ListArtists.vue'
|
2020-06-30 10:24:11 +02:00
|
|
|
import webapi from '@/webapi'
|
2023-06-07 21:25:54 +02:00
|
|
|
import { GroupByList, byName } from '@/lib/GroupByList'
|
2020-06-30 10:24:11 +02:00
|
|
|
|
2022-02-19 06:18:01 +01:00
|
|
|
const dataObject = {
|
2023-06-07 21:25:54 +02:00
|
|
|
load(to) {
|
2020-07-01 07:29:03 +02:00
|
|
|
return webapi.library_artists('audiobook')
|
2020-06-30 10:24:11 +02:00
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
set(vm, response) {
|
2022-02-19 07:47:54 +01:00
|
|
|
vm.artists_list = new GroupByList(response.data)
|
2020-06-30 10:24:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2020-07-01 07:29:03 +02:00
|
|
|
name: 'PageAudiobooksArtists',
|
2022-02-19 06:39:14 +01:00
|
|
|
components: {
|
|
|
|
ContentWithHeading,
|
|
|
|
TabsAudiobooks,
|
|
|
|
IndexButtonList,
|
|
|
|
ListArtists
|
|
|
|
},
|
|
|
|
|
|
|
|
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.artists_list.isEmpty()) {
|
|
|
|
next()
|
|
|
|
return
|
|
|
|
}
|
2022-02-19 06:39:14 +01:00
|
|
|
const vm = this
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
dataObject.set(vm, response)
|
|
|
|
next()
|
|
|
|
})
|
|
|
|
},
|
2020-06-30 10:24:11 +02:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
data() {
|
2020-06-30 10:24:11 +02:00
|
|
|
return {
|
2022-02-19 07:47:54 +01:00
|
|
|
artists_list: new GroupByList()
|
2020-06-30 10:24:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2022-02-19 07:47:54 +01:00
|
|
|
artists() {
|
|
|
|
if (!this.artists_list) {
|
|
|
|
return []
|
|
|
|
}
|
2023-06-04 13:54:01 +02:00
|
|
|
this.artists_list.group(byName('name_sort', true))
|
2022-02-19 07:47:54 +01:00
|
|
|
return this.artists_list
|
2020-06-30 10:24:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
methods: {}
|
2020-06-30 10:24:11 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|