index.vue 7.6 KB

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