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.

225 lines
6.5 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <section :class="['tw-relative tw-mt-[48px] xl:tw-mx-auto']">
  3. <div class="swiper-container focusExhibitionWrapper2 xl:tw-max-w-[1060px] xl:tw-mx-auto" ref="focusExhibitionWrapper2"
  4. @mouseenter="enter" @mouseleave="leave">
  5. <div :class="['swiper-wrapper']">
  6. <template v-for="(item, index) in focusExhibitionlist2">
  7. <div :key="index" :class="['swiper-slide tw-p-[10px]']" v-if="item.ExhibitionList.length > 0 && index <=5">
  8. <div class="tw-px-[10px] md:tw-px-[20px] tw-py-[40px] tw-rounded-[24px] bg-col-to-tr tw-h-full">
  9. <div class="tw-flex tw-flex-col tw-rounded-[24px] tw-h-full">
  10. <div class="tw-flex tw-justify-center" style="width:100%;">
  11. <div class="t18 tw-text-center tw-mb-[20px] tw-font-bold">
  12. {{item.CategoryName}}
  13. </div>
  14. </div>
  15. <div class="tw-justify-center tw-grid tw-grid-cols-2 md:tw-grid-cols-1 xl:tw-grid-cols-1 tw-gap-[10px]" style="width:100%;">
  16. <template v-if="item.ExhibitionList!=undefined && item.ExhibitionList && item.ExhibitionList.length>0">
  17. <template v-for="(item2, index2) in item.ExhibitionList">
  18. <div v-if="WindowsWidth<=414 ? index2<=3 : index2<=2" :key="index2" class="tw-py-[10px] tw-h-full">
  19. <skeletonSlot class="tw-h-full">
  20. <focusExhibitionsCard :item="item2" class="tw-h-full"></focusExhibitionsCard>
  21. </skeletonSlot>
  22. </div>
  23. </template>
  24. </template>
  25. </div>
  26. <nuxt-link :to="localePath(`/exhibition?category=${item.CategoryID}`)" class="tw-flex tw-justify-center tw-mt-[20px]">
  27. <div class="tw-flex-none">
  28. <v-img max-height="21" :src="require(`@/assets/svg/more.svg`)"></v-img>
  29. </div>
  30. <div class="tw-shrink tw-mx-[10px] tw-text-[#cecece]">
  31. {{$t('Explore more')}}
  32. </div>
  33. <div class="tw-flex-none">
  34. <v-img max-height="21" :src="require(`@/assets/svg/more.svg`)"></v-img>
  35. </div>
  36. </nuxt-link>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. </div>
  42. </div>
  43. <div
  44. :class="[
  45. 'swiper-button-prev ad2 tw-text-black tw-hidden',
  46. focusExhibitionWrapper2
  47. ? 'xl:tw-flex xl:tw-justify-center xl:tw-items-center'
  48. : '',
  49. ]"
  50. ></div>
  51. <div
  52. :class="[
  53. 'swiper-button-next ad2 tw-text-black tw-hidden',
  54. focusExhibitionWrapper2
  55. ? 'xl:tw-flex xl:tw-justify-center xl:tw-items-center'
  56. : '',
  57. ]"
  58. ></div>
  59. </section>
  60. </template>
  61. <script>
  62. import skeletonSlot from "~/components/newComponent/skeleton/skeletonSlot.vue";
  63. import focusExhibitionsCard from "~/components/home/FocusExhibitionsCard.vue";
  64. import Swiper from "swiper/bundle";
  65. export default {
  66. components: {
  67. skeletonSlot,
  68. focusExhibitionsCard,
  69. Swiper,
  70. },
  71. props: {
  72. focusExhibitionlist2: {
  73. type: Array,
  74. },
  75. },
  76. data() {
  77. return {
  78. focusExhibitionWrapper2: null,
  79. exhibitions: [],
  80. WindowsWidth: 1920,
  81. };
  82. },
  83. created() {
  84. if (process.client) {
  85. this.WindowsWidth = window.innerWidth;
  86. }
  87. },
  88. beforeDestroy() {
  89. window.removeEventListener("resize", this.onResize);
  90. },
  91. computed: {
  92. WindowWidth() {
  93. if (process.client) {
  94. this.WindowsWidth = window.innerWidth;
  95. }
  96. return this.WindowsWidth;
  97. },
  98. },
  99. mounted() {
  100. let vm = this;
  101. vm.$nextTick(function () {
  102. vm.focusExhibitionWrapper2 = new Swiper(".swiper-container.focusExhibitionWrapper2", {
  103. direction: "horizontal",
  104. initialSlide: 0,
  105. slidesPerView: 1.2,
  106. centeredSlides: true,
  107. loop: false,
  108. loopedSlides: 0,
  109. observer: true, //修改swiper自己或子元素时,自动初始化swiper
  110. observeParents: true, //修改swiper的父元素时,自动初始化swiper
  111. spaceBetween: 32,
  112. // autoplay: {
  113. // disableOnInteraction: true,
  114. // delay: 5000,
  115. // },
  116. preloadImages: false,
  117. // lazy: {
  118. // loadPrevNext: true,
  119. // loadOnTransitionStart: true,
  120. // loadPrevNextAmount: 6,
  121. // },
  122. watchSlidesProgress: false,
  123. navigation: {
  124. nextEl: ".swiper-button-next.ad2",
  125. prevEl: ".swiper-button-prev.ad2",
  126. },
  127. breakpoints: {
  128. 768: {
  129. slidesPerView: 1.2,
  130. spaceBetween: 48,
  131. },
  132. 1366: {
  133. slidesPerView: 2,
  134. spaceBetween: 24,
  135. centeredSlides: false,
  136. grabCursor: true,
  137. },
  138. },
  139. });
  140. vm.focusExhibitionWrapper2.init();
  141. vm.focusExhibitionWrapper2.update();
  142. });
  143. },
  144. methods: {
  145. onResize() {
  146. if (process.client) {
  147. this.WindowsWidth = window.innerWidth;
  148. }
  149. },
  150. enter() {
  151. this.focusExhibitionWrapper2.autoplay.stop();
  152. },
  153. leave() {
  154. this.focusExhibitionWrapper2.autoplay.start();
  155. },
  156. },
  157. };
  158. </script>
  159. <style lang="scss" scoped>
  160. .swiper-container {
  161. width: 100% !important;
  162. }
  163. .swiper-button {
  164. &-prev {
  165. left: 0;
  166. width: 50px;
  167. &::before {
  168. content: "";
  169. display: block;
  170. width: 50px;
  171. height: 50px;
  172. border-radius: 50px;
  173. background: white;
  174. border: 1px solid #e6e6e8;
  175. transform: rotate(180deg);
  176. }
  177. &:after {
  178. content: "";
  179. display: block;
  180. position: absolute;
  181. right: 15px;
  182. background-image: url('~/assets/svg/u-angle-left-b.svg');
  183. background-position: center;
  184. background-repeat: no-repeat;
  185. background-size: cover;
  186. width: 24px;
  187. height: 24px;
  188. }
  189. }
  190. &-next {
  191. right: 0;
  192. width: 50px;
  193. &::before {
  194. content: "";
  195. display: block;
  196. width: 50px;
  197. height: 50px;
  198. border-radius: 50px;
  199. background: white;
  200. border: 1px solid #e6e6e8;
  201. }
  202. &:after {
  203. content: "";
  204. display: block;
  205. position: absolute;
  206. left: 15px;
  207. background-image: url('~/assets/svg/u-angle-right-b.svg');
  208. background-position: center;
  209. background-repeat: no-repeat;
  210. background-size: cover;
  211. width: 24px;
  212. height: 24px;
  213. }
  214. }
  215. }
  216. .bg-col-to-tr{
  217. box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.08);
  218. background: linear-gradient(to bottom right, rgba(220, 217, 255, 0.8), rgba(63, 61, 86, 0.6));
  219. }
  220. </style>