| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- # Загрузка стилей компонента
- document.head.insertAdjacentHTML('beforeend','<style type="text/tailwindcss" page="Home">'+stylFns['app/pages/Home/index.styl']+'</style>')
- module.exports =
- name: 'HomePage'
- render: (new Function '_ctx', '_cache', renderFns['app/pages/Home/index.pug'])()
-
- data: ->
- featuredContent: []
- loading: true
- error: null
-
- beforeMount: ->
- @loadFeaturedContent()
-
- methods:
- loadFeaturedContent: ->
- try
- @loading = true
-
- # Загрузка различных типов контента
- promises = [
- AppDB.getSlides(limit: 6)
- AppDB.getUpcomingEvents(limit: 3)
- AppDB.getBlogPosts(limit: 3, featured: true)
- ]
-
- results = await Promise.all(promises)
-
- @featuredContent = [
- { type: 'slides', items: results[0], title: 'Главные события' }
- { type: 'events', items: results[1], title: 'Ближайшие мероприятия' }
- { type: 'blog', items: results[2], title: 'Последние новости' }
- ]
-
- @loading = false
-
- catch error
- @error = "Ошибка загрузки контента: "+error
- @loading = false
-
- # Получение текста с учетом текущего языка
- getText: (textArray) ->
- return AppDB.multilingual.getText(textArray, '')
-
- # Форматирование даты
- formatDate: (dateString) ->
- return new Date(dateString).toLocaleDateString('ru-RU', {
- year: 'numeric'
- month: 'long'
- day: 'numeric'
- })
-
- template: renderFns['app/pages/Home/index.pug']
|