AboutView.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 <= 1" 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. />
  54. </div>
  55. </SimplePageContentLoader>
  56. <!-- 分页 -->
  57. <Pagination2
  58. v-model:currentPage="newsLoader.page.value"
  59. :totalPages="newsLoader.totalPages.value"
  60. />
  61. </div>
  62. </section>
  63. <!-- 法律法规 -->
  64. <section v-if="mainTabActive == 2" class="main-section">
  65. <div class="content">
  66. <div class="title left-right">
  67. <h2>政策法规</h2>
  68. <div class="small-more" @click="navTo('/introduction/policy')">
  69. <span>更多信息</span>
  70. <img src="@/assets/images/index/ButtonMore.png" alt="更多" />
  71. </div>
  72. </div>
  73. <SimplePageContentLoader :loader="lawsData">
  74. <ImageTextSmallBlock
  75. v-for="(item, index) in lawsData.content.value"
  76. :key="index"
  77. :title="item.title"
  78. :image="item.image"
  79. :data="item.date"
  80. @click="navTo('/news/detail', { id: item.id })"
  81. />
  82. </SimplePageContentLoader>
  83. </div>
  84. </section>
  85. </div>
  86. </template>
  87. <script setup lang="ts">
  88. import { Carousel, Slide, Pagination, Navigation } from 'vue3-carousel'
  89. import { onMounted, ref, watch } from 'vue';
  90. import { useSimplePagerDataLoader } from '@/composeable/SimplePagerDataLoader';
  91. import Pagination2 from '@/components/controls/Pagination.vue';
  92. import TitleDescBlock from '@/components/parts/TitleDescBlock.vue';
  93. import ImageTextSmallBlock from '@/components/parts/ImageTextSmallBlock.vue';
  94. import SimplePageContentLoader from '@/components/content/SimplePageContentLoader.vue';
  95. import CommonContent, { GetContentListParams } from '@/api/CommonContent';
  96. import DateUtils from '@/common/utils/DateUtils';
  97. import PolicyContent from '@/api/introduction/PolicyContent';
  98. import LawsTest from '@/assets/images/inheritor/LawsTest.jpg'
  99. import { useRouter } from 'vue-router';
  100. import { useSimpleDataLoader } from '@/composeable/SimpleDataLoader';
  101. import { usePageAction } from '@/composeable/PageAction';
  102. const { navTo } = usePageAction();
  103. const carouselConfig = {
  104. itemsToShow: 1,
  105. wrapAround: true,
  106. autoPlay: 5000,
  107. }
  108. const mainTabs = [
  109. { title: '闽南文化生态保护区概况', value: 0 },
  110. { title: '世界闽南文化交流中心', value: 1 },
  111. { title: '政策法规', value: 2 },
  112. ]
  113. const mainTabActive = ref(0);
  114. const router = useRouter();
  115. const newsLoader = useSimplePagerDataLoader(10, async (page, pageSize) => {
  116. let res;
  117. switch (mainTabActive.value) {
  118. default:
  119. case 0:
  120. res = await CommonContent.getContentList(new GetContentListParams()
  121. .setModelId(17)
  122. .setMainBodyColumnId([ 255, 256, 283, 284, ])
  123. , page, pageSize);
  124. break;
  125. case 1:
  126. res = await CommonContent.getContentList(new GetContentListParams()
  127. .setModelId(17)
  128. .setMainBodyColumnId([ 232 ])
  129. , page, pageSize);
  130. break;
  131. }
  132. return {
  133. data: res.list,
  134. total: res.total,
  135. };
  136. });
  137. const lawsData = useSimpleDataLoader(async () =>
  138. (await PolicyContent.getContentList(new GetContentListParams(), 1, 8))
  139. .list?.map(item => ({
  140. id: item.id,
  141. title: item.title,
  142. image: item.image || LawsTest,
  143. date: DateUtils.formatDate(item.publishAt, DateUtils.FormatStrings.YearCommonShort),
  144. }))
  145. )
  146. watch(mainTabActive, () => newsLoader.loadData(undefined, true))
  147. onMounted(async () => {
  148. newsLoader.loadData(undefined, true);
  149. })
  150. </script>
  151. <style lang="scss">
  152. @media (max-width: 425px) {
  153. }
  154. </style>