index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <!-- 传播交流页 -->
  3. <div class=" main-background main-background-type0">
  4. <!-- 轮播 -->
  5. <Carousel v-bind="carouselConfig" class="main-header-box small carousel-light">
  6. <Slide class="main-header-box small">
  7. <img src="@/assets/images/fusion/Banner.jpg" />
  8. </Slide>
  9. <template #addons>
  10. <Navigation />
  11. <Pagination />
  12. </template>
  13. </Carousel>
  14. <!-- 闽南节庆日历 -->
  15. <section class="main-section pb-0">
  16. <div class="content">
  17. <div class="title">
  18. <h2>闽南节庆日历</h2>
  19. </div>
  20. <div class="calandar row">
  21. <div class="col col-12 col-lg-6 col-xl-6 p-0">
  22. <ScrollRect class="left-list">
  23. <h3 class="month-title">{{monthSelected}}月</h3>
  24. <NuxtLink
  25. v-for="(item, index) in daysData"
  26. :key="index"
  27. :to="{ path: `/news/detail`, query: { id: item.id, modelId: 18 } }"
  28. class="link-wrapper"
  29. >
  30. <ImageTitleDescBlock
  31. :title="item.title"
  32. :image="item.image"
  33. :desc="item.desc || item.title"
  34. />
  35. </NuxtLink>
  36. </ScrollRect>
  37. </div>
  38. <div class="month-grid col-12 col-lg-6 col-xl-6 p-0">
  39. <ScrollRect
  40. class="grid"
  41. v-for="(month, k) in monthData"
  42. :key="k"
  43. :class="[ monthSelected === month.month ? 'active' : '' ]"
  44. @click="monthChange(month.month)"
  45. >
  46. <h3>{{ month.month }}月</h3>
  47. <div class="tags">
  48. <span
  49. v-for="(holiday, index) in month.holidays"
  50. :key="index"
  51. >
  52. {{ holiday.title }}
  53. </span>
  54. </div>
  55. </ScrollRect>
  56. </div>
  57. </div>
  58. </div>
  59. </section>
  60. <!-- 文旅融合 -->
  61. <section class="main-section">
  62. <div class="content">
  63. <div class="title">
  64. <h2>文旅融合</h2>
  65. </div>
  66. <ThreeImageList :list="list" />
  67. </div>
  68. </section>
  69. </div>
  70. </template>
  71. <script setup lang="ts">
  72. import { Carousel, Slide, Pagination, Navigation } from 'vue3-carousel'
  73. import { onMounted, ref, type Ref } from 'vue';
  74. import Image1 from '@/assets/images/fusion/Image1.jpg'
  75. import Image2 from '@/assets/images/fusion/Image2.jpg'
  76. import Image3 from '@/assets/images/inheritor/Image3.jpg'
  77. import Image4 from '@/assets/images/fusion/Image4.jpg'
  78. import Image5 from '@/assets/images/fusion/Image5.jpg'
  79. import Image6 from '@/assets/images/fusion/Image6.jpg'
  80. import ImageTitleDescBlock from '@/components/parts/ImageTitleDescBlock.vue';
  81. import ThreeImageList from '@/components/parts/ThreeImageList.vue';
  82. import CalendarContent from '@/api/fusion/CalendarContent';
  83. import { GetContentListItem, GetContentListParams } from '@/api/CommonContent';
  84. import { ScrollRect } from '@imengyu/vue-scroll-rect';
  85. const router = useRouter();
  86. const carouselConfig = {
  87. itemsToShow: 1,
  88. wrapAround: true,
  89. autoPlay: 5000,
  90. }
  91. const list = [
  92. {
  93. title: '闽南文化景区',
  94. desc: '让文化因传承而永存',
  95. image: Image1,
  96. link: router.resolve('/fusion/scenic-spot').href,
  97. },
  98. {
  99. title: '文化旅游路线',
  100. desc: '让文化因传承而永存',
  101. image: Image2,
  102. link: router.resolve('/fusion/route').href,
  103. },
  104. {
  105. title: '非遗研学点',
  106. desc: '',
  107. image: Image6,
  108. link: router.resolve('/fusion/point').href,
  109. },
  110. {
  111. title: '非遗作品',
  112. desc: '让文化因传承而永存',
  113. image: Image3,
  114. link: router.resolve('/inheritor/products').href,
  115. },
  116. {
  117. title: '融合发展',
  118. desc: '非遗与旅游融合发展推荐目录',
  119. image: Image4,
  120. link: router.resolve('/fusion/demo-site').href,
  121. },
  122. {
  123. title: '闽南时尚',
  124. desc: '让文化因传承而永存',
  125. image: Image5,
  126. link: router.resolve('/fusion/fashion').href,
  127. },
  128. ]
  129. const daysData = ref<GetContentListItem[]>([]) as Ref<GetContentListItem[]>
  130. const monthSelected = ref(new Date().getMonth() + 1)
  131. const { data: monthData } = await useAsyncData('funCalendarContent2', async () => {
  132. const res = await CalendarContent.getCalendarList(new GetContentListParams(), 1, 50)
  133. const year = new Date().getFullYear();
  134. const monthData : {
  135. month: number;
  136. holidays: GetContentListItem[];
  137. }[] = [
  138. {
  139. month: 1,
  140. holidays: []
  141. },
  142. {
  143. month: 2,
  144. holidays: []
  145. },
  146. {
  147. month: 3,
  148. holidays: []
  149. },
  150. {
  151. month: 4,
  152. holidays: []
  153. },
  154. {
  155. month: 5,
  156. holidays: []
  157. },
  158. {
  159. month: 6,
  160. holidays: []
  161. },
  162. {
  163. month: 7,
  164. holidays: []
  165. },
  166. {
  167. month: 8,
  168. holidays: []
  169. },
  170. {
  171. month: 9,
  172. holidays: []
  173. },
  174. {
  175. month: 10,
  176. holidays: []
  177. },
  178. {
  179. month: 11,
  180. holidays: []
  181. },
  182. {
  183. month: 12,
  184. holidays: []
  185. },
  186. ];
  187. res.list.filter(p =>
  188. p.dateYear === year
  189. ).forEach(item => {
  190. if (!item.desc)
  191. item.desc = item.title;
  192. item.title = item.title.substring(0, 10);
  193. });
  194. res.list.forEach(item => {
  195. monthData[item.dateMonth - 1]?.holidays?.push(item.toJSON() as any)
  196. })
  197. daysData.value = monthData[ monthSelected.value - 1].holidays as GetContentListItem[];
  198. return monthData;
  199. })
  200. function monthChange(month: number) {
  201. monthSelected.value = month;
  202. daysData.value = monthData.value?.[month - 1]?.holidays as GetContentListItem[] || [];
  203. }
  204. </script>
  205. <style lang="scss">
  206. @use '@/assets/scss/colors.scss' as *;
  207. .calandar {
  208. background-color: $box-color;
  209. .left-list {
  210. height: 750px;
  211. }
  212. .link-wrapper {
  213. text-decoration: none;
  214. color: $text-color-light;
  215. }
  216. .month-title {
  217. margin: 24px 24px 0 24px;
  218. }
  219. .month-grid {
  220. display: grid;
  221. grid-template-columns: repeat(4, 25%);
  222. > .grid {
  223. display: flex;
  224. flex-direction: column;
  225. justify-content: space-between;
  226. background-color: $text-color-light;
  227. padding: 12px ;
  228. border: 1px solid $border-split-color;
  229. height: 250px;
  230. h3 {
  231. font-size: 18px;
  232. }
  233. .tags {
  234. display: flex;
  235. flex-direction: row;
  236. flex-wrap: wrap;
  237. > span {
  238. font-size: 13px;
  239. margin-right: 8px;
  240. margin-top: 8px;
  241. padding: 0 8px;
  242. border-radius: 12px;
  243. background-color: rgba(#FF961B, 0.1);
  244. display: -webkit-box;
  245. -webkit-line-clamp: 1;
  246. -webkit-box-orient: vertical;
  247. overflow: hidden;
  248. text-overflow: ellipsis;
  249. word-break: break-all;
  250. line-height: 28px;
  251. }
  252. }
  253. &.active {
  254. background-color: $primary-color;
  255. color: $text-color-light;
  256. }
  257. }
  258. }
  259. }
  260. @media (max-width: 500px) {
  261. .calandar .month-grid {
  262. grid-template-columns: repeat(2, 50%);
  263. }
  264. }
  265. </style>