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.

249 lines
6.6 KiB

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