AboutView.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <!-- 关于页 -->
  3. <div class="about 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/about/Banner.jpg" />
  8. </Slide>
  9. <template #addons>
  10. <Navigation />
  11. <Pagination />
  12. </template>
  13. </Carousel>
  14. <!-- 头部搜索 -->
  15. <section class="main-section absolute light fit-small-header">
  16. <div class="content row">
  17. <div class="col-md-12 col-lg-8 col-xl-6">
  18. <div class="main-header-title d-flex flex-column">
  19. </div>
  20. </div>
  21. <div class="col-md-12 col-lg-4 col-xl-6">
  22. </div>
  23. </div>
  24. <!-- 头部TAB -->
  25. <div class="main-header-tab">
  26. <div class="list">
  27. <div
  28. v-for="(tab, k) in mainTabs"
  29. :key="k"
  30. :class="[ mainTabActive === tab.value ? 'active' : '' ]"
  31. @click="mainTabActive = tab.value"
  32. >
  33. {{ tab.title }}
  34. </div>
  35. </div>
  36. </div>
  37. </section>
  38. <!-- 新闻 -->
  39. <section v-if="mainTabActive <= 2" class="main-section main-background main-background-type0">
  40. <div class="content news-list">
  41. <!-- 新闻列表 -->
  42. <SimplePageContentLoader :loader="newsLoader">
  43. <div
  44. v-for="(item, k) in newsLoader.list.value"
  45. :key="item.id"
  46. class="item"
  47. @click="router.push({ name: 'news-detail', query: { id: item.id }})"
  48. >
  49. <img :src="item.image" alt="新闻图片" />
  50. <TitleDescBlock
  51. :title="item.title"
  52. :desc="item.desc || item.title"
  53. :date="DateUtils.formatDate(item.publishAt, DateUtils.FormatStrings.YearCommon)"
  54. />
  55. </div>
  56. </SimplePageContentLoader>
  57. <!-- 分页 -->
  58. <Pagination2
  59. v-model:currentPage="newsLoader.page.value"
  60. :totalPages="newsLoader.totalPages.value"
  61. />
  62. </div>
  63. </section>
  64. <!-- 法律法规 -->
  65. <section v-if="mainTabActive == 3" class="main-section">
  66. <div class="content">
  67. <div class="title left-right">
  68. <h2>法律法规</h2>
  69. <div class="small-more" @click="navTo('/introduction/policy')">
  70. <span>更多信息</span>
  71. <img src="@/assets/images/index/ButtonMore.png" alt="更多" />
  72. </div>
  73. </div>
  74. <SimplePageContentLoader :loader="lawsData">
  75. <ImageTextSmallBlock
  76. v-for="(item, index) in lawsData.content.value"
  77. :key="index"
  78. :title="item.title"
  79. :image="item.image"
  80. :date="item.date"
  81. @click="navTo('/news/detail', { id: item.id })"
  82. />
  83. </SimplePageContentLoader>
  84. </div>
  85. </section>
  86. </div>
  87. </template>
  88. <script setup lang="ts">
  89. import { Carousel, Slide, Pagination, Navigation } from 'vue3-carousel'
  90. import { onMounted, ref, watch } from 'vue';
  91. import { useSimplePagerDataLoader } from '@/composeable/SimplePagerDataLoader';
  92. import Pagination2 from '@/components/controls/Pagination.vue';
  93. import TitleDescBlock from '@/components/parts/TitleDescBlock.vue';
  94. import ImageTextSmallBlock from '@/components/parts/ImageTextSmallBlock.vue';
  95. import SimplePageContentLoader from '@/components/content/SimplePageContentLoader.vue';
  96. import CommonContent, { GetContentListParams } from '@/api/CommonContent';
  97. import DateUtils from '@/common/utils/DateUtils';
  98. import PolicyContent from '@/api/introduction/PolicyContent';
  99. import LawsTest from '@/assets/images/inheritor/LawsTest.jpg'
  100. import { useRouter } from 'vue-router';
  101. import { useSimpleDataLoader } from '@/composeable/SimpleDataLoader';
  102. import { usePageAction } from '@/composeable/PageAction';
  103. const { navTo } = usePageAction();
  104. const carouselConfig = {
  105. itemsToShow: 1,
  106. wrapAround: true,
  107. autoPlay: 5000,
  108. }
  109. const mainTabs = [
  110. { title: '闽南文化概况', value: 0 },
  111. { title: '闽南文化生态保护区概况', value: 1 },
  112. { title: '世界闽南文化交流中心', value: 2 },
  113. { title: '法律法规', value: 3 },
  114. ]
  115. const mainTabActive = ref(0);
  116. const router = useRouter();
  117. const newsLoader = useSimplePagerDataLoader(10, async (page, pageSize) => {
  118. let res;
  119. switch (mainTabActive.value) {
  120. default:
  121. case 0:
  122. res = await CommonContent.getContentList(new GetContentListParams()
  123. .setModelId(17)
  124. .setMainBodyColumnId([ ])
  125. , page, pageSize);
  126. break;
  127. case 1:
  128. res = await CommonContent.getContentList(new GetContentListParams()
  129. .setModelId(17)
  130. .setMainBodyColumnId([ 255, 256, 283, 284, ])
  131. , page, pageSize);
  132. break;
  133. case 2:
  134. res = await CommonContent.getContentList(new GetContentListParams()
  135. .setModelId(17)
  136. .setMainBodyColumnId([ 232 ])
  137. , page, pageSize);
  138. break;
  139. }
  140. return {
  141. data: res.list,
  142. total: res.total,
  143. };
  144. });
  145. const lawsData = useSimpleDataLoader(async () =>
  146. (await PolicyContent.getContentList(new GetContentListParams(), 1, 8))
  147. .list?.map(item => ({
  148. id: item.id,
  149. title: item.title,
  150. image: item.image || LawsTest,
  151. date: DateUtils.formatDate(item.publishAt, DateUtils.FormatStrings.YearCommon),
  152. }))
  153. )
  154. watch(mainTabActive, () => newsLoader.loadData(undefined, true))
  155. onMounted(async () => {
  156. newsLoader.loadData(undefined, true);
  157. })
  158. </script>
  159. <style lang="scss">
  160. @media (max-width: 425px) {
  161. }
  162. </style>