FusionView.vue 6.6 KB

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