123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <template>
- <section class="catalog section">
- <div class="catalog__wrapper section-wrapper">
- <div class="catalog__container">
- <CatalogMenu />
- <main class="catalog__main">
- <div class="catalog-main">
- <div class="catalog-main__wrapper">
- <div class="catalog-main__topic">
- <ul class="catalog-main__topic-list">
- <li class="catalog-main__topic-item">
- <a
- class="catalog-main__topic-link"
- href="javascript:void(0)"
- >Новости</a
- >
- </li>
- <li class="catalog-main__topic-item">
- <nuxt-link
- to="/news?page=1"
- class="catalog-main__topic-link"
- href="javascript:void(0)"
- ></nuxt-link>
- </li>
- </ul>
- </div>
- <div class="catalog-main__header">
- <h1 class="catalog-main__title">Новости</h1>
- <div
- class="catalog-main__filter"
- @click="$modal.show('filter-modal')"
- >
- <BaseIcon name="filter"></BaseIcon>
- </div>
- <!-- <a
- class="
- catalog-main__subscribe
- button button_grey-dark button_grey-dark-short
- "
- ><span class="button__text">Подписаться</span></a
- > -->
- </div>
- <div class="catalog-main__list">
- <div class="catalog-list">
- <CatalogList
- :categoryNewsList="categoryNewsList.news"
- :pages="categoryNewsList.total_pages"
- @loadMore="onLoadMore"
- />
- </div>
- </div>
- </div>
- </div>
- </main>
- </div>
- </div>
- <CatalogFilter @apply="onApplyFilter" :filter="filter"></CatalogFilter>
- </section>
- </template>
- <script>
- import { mapGetters } from "vuex";
- export default {
- watchQuery: ["pagination", "date_start", "date_end"],
- data: () => ({
- filter: {
- date: null,
- },
- }),
- computed: {
- ...mapGetters({
- newsItem: "modules/news/newsItem",
- categoryNewsList: "modules/news/categoryNewsList",
- }),
- },
- props: {
- category: {
- type: Object,
- },
- },
- head() {
- return {
- title: "Лента новостей",
- meta: [
- {
- name: "description",
- content:
- "Все основные новости Алтайского края, Барнаула, России и мира подобранные для вас вопросы и ответы.",
- },
- {
- name: "keys",
- content:
- "Все основные новости Алтайского края, Барнаула, России и мира подобранные для вас вопросы и ответы.",
- },
- ],
- link: [
- {rel: 'canonical', href: 'https://www.amic.ru/news'}
- ]
- };
- },
- beforeRouteEnter(to, from, next) {
- next();
- },
- methods: {
- onApplyFilter() {
- const [date_start = "", date_end = ""] = this.filter.activity;
- this.$router.push({
- name: this.$route.name,
- query: { pagination: 1, date_start, date_end },
- });
- this.$modal.hide("filter-modal");
- },
- async onLoadMore(loadMoreCounter,filter = {}) {
- var payload = Object.assign({
- category: false,
- pagination: loadMoreCounter,
- filter: filter
- });
- await this.$store.dispatch("modules/news/loadCategoryNews", payload);
- },
- },
- async fetch({ store, route }) {
- await store.dispatch("modules/news/setCategoryNewsList", {
- category: false,
- pagination: route.query.pagination || 1,
- filter: {
- date_start: route.query.date_start || null,
- date_end: route.query.date_end || null,
- },
- });
- await store.dispatch("modules/news/setCategoriesList");
- },
- async asyncData({ store }) {
- await store.dispatch("modules/ads/getAds");
- },
- };
- </script>
- <style>
- </style>
|