index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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/introduction/Banner.jpg" />
  8. </Slide>
  9. <template #addons>
  10. <Navigation />
  11. <Pagination />
  12. </template>
  13. </Carousel>
  14. <!-- 历史和地理背景 -->
  15. <section class="main-section main-background pb-0">
  16. <div class="content">
  17. <div class="title">
  18. <h2>历史和地理背景</h2>
  19. </div>
  20. <LeftRightBox
  21. title="闽南历史和地理背景"
  22. :desc="overviewsLoader.content.value?.[0]"
  23. :image="Image1"
  24. :rightItems="historyData.content.value"
  25. :moreLink="router.resolve({ path: '/introduction/history' }).href"
  26. />
  27. </div>
  28. </section>
  29. <!-- 闽南方言 -->
  30. <section class="main-section main-background pb-0">
  31. <div class="content">
  32. <div class="title">
  33. <h2>闽南方言</h2>
  34. </div>
  35. <LeftRightBox
  36. title="闽南方言"
  37. :desc="overviewsLoader.content.value?.[1]"
  38. :image="Image2"
  39. left
  40. :rightItems="languageData.content.value"
  41. :moreLink="router.resolve({ path: '/introduction/language' }).href"
  42. />
  43. </div>
  44. </section>
  45. <!-- 文化专题 -->
  46. <section class="main-section main-background">
  47. <div class="content">
  48. <div class="title">
  49. <h2>文化专题</h2>
  50. </div>
  51. <ThreeImageList :list="list" />
  52. </div>
  53. </section>
  54. </div>
  55. </template>
  56. <script setup lang="ts">
  57. import { Carousel, Slide, Pagination, Navigation } from 'vue3-carousel'
  58. import IndexContent from '@/api/introduction/IndexContent';
  59. import Image1 from '@/assets/images/introduction/Image1.jpg';
  60. import Image2 from '@/assets/images/introduction/Image2.jpg';
  61. import CategoryImage1 from '@/assets/images/introduction/CategoryImage1.jpg';
  62. import CategoryImage2 from '@/assets/images/introduction/CategoryImage2.jpg';
  63. import CategoryImage3 from '@/assets/images/introduction/CategoryImage3.jpg';
  64. import CategoryImage4 from '@/assets/images/introduction/CategoryImage4.jpg';
  65. import CategoryImage5 from '@/assets/images/introduction/CategoryImage5.jpg';
  66. import CategoryImage6 from '@/assets/images/introduction/CategoryImage6.jpg';
  67. import CategoryImage7 from '@/assets/images/introduction/CategoryImage7.jpg';
  68. import LeftRightBox from '@/components/parts/LeftRightBox.vue';
  69. import ThreeImageList from '@/components/parts/ThreeImageList.vue';
  70. import { useSSrSimpleDataLoader } from '@/composeable/SimpleDataLoader';
  71. import { GetColumListParams, GetContentListParams } from '@/api/CommonContent';
  72. import { NO_CONTENT_STRING } from '@/common/ConstStrings';
  73. import HistoryContent from '@/api/introduction/HistoryContent';
  74. import LanguageContent from '@/api/introduction/LanguageContent';
  75. const router = useRouter();
  76. const carouselConfig = {
  77. itemsToShow: 1,
  78. wrapAround: true,
  79. autoPlay: 5000,
  80. }
  81. const list = [
  82. {
  83. title: '历史人物',
  84. desc: '让文化因传承而永存',
  85. image: CategoryImage1,
  86. link: '/introduction/character',
  87. },
  88. {
  89. title: '民间习俗',
  90. desc: '让文化因传承而永存',
  91. image: CategoryImage2,
  92. link: '/introduction/custom',
  93. },
  94. {
  95. title: '艺术特色',
  96. desc: '让文化因传承而永存',
  97. image: CategoryImage3,
  98. link: '/introduction/feature',
  99. },
  100. {
  101. title: '建筑文化',
  102. desc: '让文化因传承而永存',
  103. image: CategoryImage4,
  104. link: '/introduction/building',
  105. },
  106. {
  107. title: '饮食文化',
  108. desc: '让文化因传承而永存',
  109. image: CategoryImage5,
  110. link: '/introduction/victuals',
  111. },
  112. {
  113. title: '海洋文化',
  114. desc: '让文化因传承而永存',
  115. image: CategoryImage6,
  116. link: '/introduction/sea',
  117. },
  118. {
  119. title: '闽南文化百科',
  120. desc: '让文化因传承而永存',
  121. image: CategoryImage7,
  122. link: '/introduction/book',
  123. }
  124. ]
  125. const historyData = await useSSrSimpleDataLoader('history', async () =>
  126. (await HistoryContent.getContentList(new GetContentListParams().setMainBodyColumnId([ 233, 250, 251 ]), 1, 6)).list.map(p => ({
  127. id: p.id,
  128. title: p.title,
  129. desc: p.desc,
  130. image: p.image,
  131. link: router.resolve({ path: '/news/detail', query: { id: p.id } }).href,
  132. }))
  133. )
  134. const languageData = await useSSrSimpleDataLoader('language', async () =>
  135. (await LanguageContent.getContentList(new GetContentListParams(), 1, 6)).list.map(p => ({
  136. id: p.id,
  137. title: p.title,
  138. desc: p.desc,
  139. image: p.image,
  140. link: router.resolve({ path: '/news/detail', query: { id: p.id } }).href,
  141. }))
  142. )
  143. const overviewsLoader = await useSSrSimpleDataLoader('overviews', async () => {
  144. return [
  145. (await IndexContent.getColumList(
  146. new GetColumListParams()
  147. .setModelId(14)
  148. .setMainBodyColumnId(233)
  149. )).list[0]?.overview || NO_CONTENT_STRING,
  150. (await IndexContent.getColumList(
  151. new GetColumListParams()
  152. .setModelId(5)
  153. .setMainBodyColumnId(235)
  154. )).list[0]?.overview || NO_CONTENT_STRING,
  155. ]
  156. });
  157. </script>