You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
5.0 KiB

2 years ago
  1. <template>
  2. <!-- eslint-disable vue/no-use-v-if-with-v-for,vue/no-confusing-v-for-v-if -->
  3. <div class="highlight-exhibitions">
  4. <div class="computer hidden-sm-and-down">
  5. <Block :title="$t('Highlight Exhibitions')" :arrow="true" @rightArrowOnClick="handleRightArrowClick"
  6. @leftArrowOnClick="handleLeftArrowClick" :carousel="carousel" :carouselPagesNum="carouselPagesNum">
  7. <v-carousel v-model="carousel" hide-delimiter-background :show-arrows="false" class="px-0 mb-5">
  8. <v-carousel-item v-for="p in carouselPagesNum" :key="p">
  9. <v-container class="container-1366 pb-0">
  10. <v-row>
  11. <v-col class="pt-0 pb-5" cols="6" v-for="index in 6" :key="index">
  12. <HightlightExhibitionsCard :item="exhibitions[index - 1 + (p - 1) * 6]"
  13. v-if="index - 1 + (p - 1) * 6 < exhibitions.length" />
  14. </v-col>
  15. </v-row>
  16. </v-container>
  17. </v-carousel-item>
  18. </v-carousel>
  19. </Block>
  20. </div>
  21. <div class="tablet d-none d-sm-flex d-md-none">
  22. <v-container class="py-0">
  23. <v-row class="row1 mb-7 mt-10 ml-7" no-gutters>
  24. <v-col class="primary--text tw-body-1">
  25. {{ $t("Highlight Exhibitions") }}
  26. </v-col>
  27. </v-row>
  28. <v-sheet class="ml-7 mr-0 pl-0" max-width="3000" v-if="exhibitions">
  29. <v-slide-group center-active class="ml-0 pl-0">
  30. <v-slide-item v-for="index in Math.ceil(exhibitions.length / 5)" :key="index" class="me-7">
  31. <div>
  32. <HightlightExhibitionsCard v-for="item in 5" :key="item" :item="exhibitions[(index - 1) * 5 + item - 1]"
  33. v-if="(index - 1) * 5 + item - 1 < exhibitions.length" class="mb-5" />
  34. </div>
  35. </v-slide-item>
  36. </v-slide-group>
  37. </v-sheet>
  38. </v-container>
  39. </div>
  40. <div class="phone hidden-sm-and-up">
  41. <v-container class="main-container">
  42. <div class="mb-7 mt-10 primary--text tw-text-[18px]">
  43. {{ $t("Highlight Exhibitions") }}
  44. </div>
  45. <v-row class="myGrid myGrid__2 Grid__column_gap__20 Grid__row_gap__20 mx-0">
  46. <v-col class="pa-0" v-for="(item, index) in exhibitions" :key="index" v-if="index < 6">
  47. <HighlightExhibitionsCardMobile :item="item"></HighlightExhibitionsCardMobile>
  48. </v-col>
  49. </v-row>
  50. <v-spacer class="d-flex justify-center">
  51. <v-btn :to="localePath('/exhibition')" v-if="exhibitions.length > 5"
  52. class="text-capitalize mt-10 px-10 mx-auto rounded-xl" outlined>
  53. {{ $t("see more") }}
  54. </v-btn>
  55. </v-spacer>
  56. </v-container>
  57. </div>
  58. </div>
  59. </template>
  60. <script>
  61. import HightlightExhibitionsCard from "~/components/home/HightlightExhibitionsCard.vue";
  62. import HighlightExhibitionsCardMobile from "~/components/home/HighlightExhibitionsCardMobile.vue";
  63. import Block from "~/components/home/Block.vue";
  64. export default {
  65. components: {
  66. HightlightExhibitionsCard,
  67. HighlightExhibitionsCardMobile,
  68. Block,
  69. },
  70. async fetch({ $axios, i18n }) {
  71. let langQuery = "?lang=" + i18n.localeProperties["langQuery"] + "&";
  72. // return await $axios
  73. // .get("/trending/exhibitions" + langQuery)
  74. // .then((res) => {
  75. // console.log("asyncDatares");
  76. // console.log(res);
  77. // return { exhibitions: res.data.exhibitions };
  78. // })
  79. // .catch((err) => {
  80. // console.error(err);
  81. // });
  82. },
  83. data() {
  84. return {
  85. carousel: 0,
  86. carouselPagesNum: 3,
  87. exhibitions: [],
  88. };
  89. },
  90. async mounted() {
  91. let langQuery = "?lang=" + this.$i18n.localeProperties["langQuery"] + "&";
  92. // await this.$axios
  93. // .get("/trending/exhibitions" + langQuery)
  94. // .then((res) => {
  95. // this.exhibitions = res.data.exhibitions;
  96. // })
  97. // .catch((err) => {
  98. // console.error(err);
  99. // });
  100. // this.$nextTick(() => {
  101. // this.carouselPagesNum = Math.ceil(this.exhibitions.length / 6);
  102. // if (this.exhibitions.length > 18) {
  103. // this.exhibitions = this.exhibitions.slice(0, 18);
  104. // }
  105. // });
  106. },
  107. methods: {
  108. // handleRightArrowClick(title_) {
  109. // if (title_ == "Highlight Exhibitions") {
  110. // this.carousel += 1;
  111. // }
  112. // },
  113. handleRightArrowClick() {
  114. if (this.carousel != 1) {
  115. this.carousel++;
  116. }
  117. },
  118. handleLeftArrowClick() {
  119. if (this.carousel != 0) {
  120. this.carousel--;
  121. }
  122. },
  123. },
  124. };
  125. </script>
  126. <style lang="scss" scoped>
  127. .row1 {
  128. position: relative;
  129. }
  130. .right-arrow {
  131. position: absolute;
  132. top: 20%;
  133. right: -20px;
  134. }
  135. .arrow {
  136. border: 1px solid;
  137. padding: 10px 15px;
  138. border-radius: 10px;
  139. width: 50px;
  140. }
  141. .text {
  142. text-align: center;
  143. }
  144. .little-text {
  145. font-size: 5px;
  146. }
  147. .v-btn--outlined {
  148. border: thin solid #000;
  149. }
  150. .my-card {
  151. border-radius: 10px !important;
  152. }
  153. .keep-width {
  154. min-width: 608px;
  155. }
  156. .to-right {
  157. width: 44px !important;
  158. }
  159. :deep() {
  160. .v-carousel__controls {
  161. display: none;
  162. }
  163. }
  164. </style>