FusionView.vue 6.1 KB

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