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.

229 lines
6.6 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
  1. <template>
  2. <section :class="['tw-relative tw-mt-[48px] xl:tw-mx-auto']">
  3. <div class="swiper-container focusExhibitionWrapper1 xl:tw-max-w-[1060px] xl:tw-mx-auto" ref="focusExhibitionWrapper1"
  4. @mouseenter="enter" @mouseleave="leave">
  5. <div :class="['swiper-wrapper']">
  6. <template v-for="(item, index) in focusExhibitionlist1">
  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]">
  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 ad1 tw-text-black tw-hidden',
  46. focusExhibitionWrapper1
  47. ? 'xl:tw-flex xl:tw-justify-center xl:tw-items-center'
  48. : '',
  49. ]"
  50. ></div>
  51. <div
  52. :class="[
  53. 'swiper-button-next ad1 tw-text-black tw-hidden',
  54. focusExhibitionWrapper1
  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. focusExhibitionlist1: {
  73. type: Array,
  74. },
  75. },
  76. data() {
  77. return {
  78. focusExhibitionWrapper1: 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.focusExhibitionWrapper1 = new Swiper(".swiper-container.focusExhibitionWrapper1", {
  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.ad1",
  125. prevEl: ".swiper-button-prev.ad1",
  126. },
  127. breakpoints: {
  128. 414: {
  129. slidesPerView: 1,
  130. spaceBetween: 10,
  131. },
  132. 768: {
  133. slidesPerView: 1.2,
  134. spaceBetween: 48,
  135. },
  136. 1366: {
  137. slidesPerView: 2,
  138. spaceBetween: 24,
  139. centeredSlides: false,
  140. grabCursor: true,
  141. },
  142. },
  143. });
  144. vm.focusExhibitionWrapper1.init();
  145. vm.focusExhibitionWrapper1.update();
  146. });
  147. },
  148. methods: {
  149. onResize() {
  150. if (process.client) {
  151. this.WindowsWidth = window.innerWidth;
  152. }
  153. },
  154. enter() {
  155. this.focusExhibitionWrapper1.autoplay.stop();
  156. },
  157. leave() {
  158. this.focusExhibitionWrapper1.autoplay.start();
  159. },
  160. },
  161. };
  162. </script>
  163. <style lang="scss" scoped>
  164. .swiper-container {
  165. width: 100% !important;
  166. }
  167. .swiper-button {
  168. &-prev {
  169. left: 0;
  170. width: 50px;
  171. &::before {
  172. content: "";
  173. display: block;
  174. width: 50px;
  175. height: 50px;
  176. border-radius: 50px;
  177. background: white;
  178. border: 1px solid #e6e6e8;
  179. transform: rotate(180deg);
  180. }
  181. &:after {
  182. content: "";
  183. display: block;
  184. position: absolute;
  185. right: 15px;
  186. background-image: url('~/assets/svg/u-angle-left-b.svg');
  187. background-position: center;
  188. background-repeat: no-repeat;
  189. background-size: cover;
  190. width: 24px;
  191. height: 24px;
  192. }
  193. }
  194. &-next {
  195. right: 0;
  196. width: 50px;
  197. &::before {
  198. content: "";
  199. display: block;
  200. width: 50px;
  201. height: 50px;
  202. border-radius: 50px;
  203. background: white;
  204. border: 1px solid #e6e6e8;
  205. }
  206. &:after {
  207. content: "";
  208. display: block;
  209. position: absolute;
  210. left: 15px;
  211. background-image: url('~/assets/svg/u-angle-right-b.svg');
  212. background-position: center;
  213. background-repeat: no-repeat;
  214. background-size: cover;
  215. width: 24px;
  216. height: 24px;
  217. }
  218. }
  219. }
  220. .bg-col-to-tr{
  221. box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.08);
  222. background: linear-gradient(to bottom right, rgba(220, 217, 255, 0.8), rgba(63, 61, 86, 0.6));
  223. }
  224. </style>