2021-10-23 10:48:11 +01:00
|
|
|
<template>
|
|
|
|
<div>
|
2022-02-19 06:39:14 +01:00
|
|
|
<tabs-music />
|
2021-10-23 10:48:11 +01: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="composers.indexList" />
|
2021-12-30 11:15:14 +00: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.composers.title')" />
|
2022-05-29 18:49:00 +02:00
|
|
|
<p
|
|
|
|
class="heading"
|
|
|
|
v-text="$t('page.composers.count', { count: composers.total })"
|
|
|
|
/>
|
2021-10-23 10:48:11 +01:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-02-19 07:47:54 +01:00
|
|
|
<list-composers :composers="composers" />
|
2021-10-23 10:48:11 +01:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
|
|
|
import TabsMusic from '@/components/TabsMusic.vue'
|
|
|
|
import IndexButtonList from '@/components/IndexButtonList.vue'
|
|
|
|
import ListComposers from '@/components/ListComposers.vue'
|
2021-10-23 10:48:11 +01:00
|
|
|
import webapi from '@/webapi'
|
2022-02-19 07:47:54 +01:00
|
|
|
import { byName, GroupByList } from '@/lib/GroupByList'
|
2021-10-23 10:48:11 +01:00
|
|
|
|
2022-02-19 06:18:01 +01:00
|
|
|
const dataObject = {
|
2021-10-23 10:48:11 +01:00
|
|
|
load: function (to) {
|
2022-03-26 22:01:47 +01:00
|
|
|
return webapi.library_composers('music')
|
2021-10-23 10:48:11 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
2022-02-19 07:47:54 +01:00
|
|
|
vm.composers = new GroupByList(response.data)
|
|
|
|
vm.composers.group(byName('name_sort'))
|
2021-10-23 10:48:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageComposers',
|
2021-12-30 11:15:14 +00:00
|
|
|
components: { ContentWithHeading, TabsMusic, IndexButtonList, ListComposers },
|
2021-10-23 10:48:11 +01:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
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.composers.isEmpty()) {
|
|
|
|
next()
|
|
|
|
return
|
|
|
|
}
|
2022-02-19 06:39:14 +01:00
|
|
|
const vm = this
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
dataObject.set(vm, response)
|
|
|
|
next()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
2021-10-23 10:48:11 +01:00
|
|
|
return {
|
2022-02-19 07:47:54 +01:00
|
|
|
composers: new GroupByList()
|
2021-10-23 10:48:11 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-19 07:47:54 +01:00
|
|
|
methods: {}
|
2021-10-23 10:48:11 +01:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|