index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <section class="video section">
  3. <div class="video-category__wrapper section-wrapper podcasts-wrapper">
  4. <h1 class="video-category-title">{{ podcasts.category.name }}</h1>
  5. <div class="video-category-loader" v-if="!podcasts.news">
  6. <v-progress-circular indeterminate></v-progress-circular>
  7. </div>
  8. <div class="video-category-list" v-else>
  9. <PodcastItem
  10. class="video-category-item"
  11. v-for="podcast in podcasts.news"
  12. :key="podcast.id"
  13. :item="podcast"
  14. ></PodcastItem>
  15. </div>
  16. <div class="video-category-pagination">
  17. <Pagination
  18. :length="podcasts.total_pages"
  19. v-if="podcasts.news"
  20. :visible="10"
  21. v-model="pagination"
  22. white
  23. @input="changePage"
  24. ></Pagination>
  25. </div>
  26. </div>
  27. </section>
  28. </template>
  29. <script>
  30. import { mapGetters } from "vuex";
  31. export default {
  32. watchQuery: ["pagination"],
  33. created() {
  34. this.pagination = Number(this.$route.query.pagination) || 1;
  35. },
  36. async fetch({ store, route }) {
  37. await store.dispatch("modules/news/setCategoryNewsList", {
  38. category: route.params.category,
  39. pagination: route.query.pagination || 1,
  40. });
  41. },
  42. methods: {
  43. async changePage() {
  44. window.scrollTo({ top: 0, behavior: "smooth" });
  45. this.$router.push({
  46. name: this.$route.name,
  47. query: { pagination: this.pagination }
  48. })
  49. }
  50. },
  51. computed: {
  52. ...mapGetters({
  53. podcasts: "modules/news/categoryNewsList",
  54. }),
  55. },
  56. head() {
  57. return {
  58. title: "Амик - " + this.podcasts.category.name,
  59. meta: [
  60. {
  61. name: "description",
  62. content: this.podcasts.category.meta.description,
  63. },
  64. {
  65. name: "keys",
  66. content: this.podcasts.category.meta.key,
  67. },
  68. ],
  69. link: [
  70. {rel: 'canonical', href: this.podcasts.category ? 'https://www.amic.ru/podcasts/' + this.podcasts.category.alias : ''}
  71. ]
  72. };
  73. },
  74. };
  75. </script>
  76. <style lang="less" scoped>
  77. .video-category {
  78. padding-top: 30px;
  79. color: white;
  80. &-title {
  81. font-size: 30px;
  82. color: #000;
  83. margin-bottom: 20px;
  84. }
  85. &-loader {
  86. text-align: center;
  87. }
  88. &-list {
  89. display: flex;
  90. flex-wrap: wrap;
  91. margin: 0 -10px;
  92. @media screen and(max-width: 1300px) {
  93. justify-content: space-around;
  94. }
  95. }
  96. &-pagination {
  97. padding: 20px 0;
  98. }
  99. &-item {
  100. flex: 100%;
  101. max-width: 417px;
  102. margin: 10px;
  103. }
  104. }
  105. </style>