introduction.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="home-container page-home-introduction d-flex flex-col bg-base" style="min-height:100vh">
  3. <u-navbar :autoBack="true" bgColor="transparent" />
  4. <image
  5. class="w-100 position-absolute"
  6. src="https://mncdn.wenlvti.net/app_static/minnan/images/home/BackgroundBanner2.jpg"
  7. mode="widthFix"
  8. />
  9. <view class="content d-flex flex-col wing-l">
  10. <!-- 标题 -->
  11. <view class="font-songti color-title-text d-flex flex-col align-center justify-center p-3">
  12. <text class="size-lll">闽南文化生态保护区<text class="size-ll">(厦门市)</text></text>
  13. <text class="size-base mt-2">世界闽南文化交流中心</text>
  14. </view>
  15. <!-- 分栏 -->
  16. <view class="shadow-l radius-l bg-base p-3">
  17. <SimplePageContentLoader :loader="introdData">
  18. <u-parse :content="introdData.content.value" :tag-style="commonParserStyle"></u-parse>
  19. </SimplePageContentLoader>
  20. <!--保护区建设历程-->
  21. <view
  22. class="mt-4 d-flex flex-row justify-center align-center p-25 radius-base border-all-primary color-primary"
  23. @click="navTo('./history')"
  24. >
  25. <text class="iconfont icon-task-history-4 size-lll mr-2"></text>
  26. <text>保护区建设历程</text>
  27. </view>
  28. </view>
  29. <view class="d-flex flex-col mt-3">
  30. <view
  31. v-for="item in listLoader.list.value"
  32. :key="item.id"
  33. >
  34. <Box2LineImageRightShadow
  35. classNames="ml-2 mb-3"
  36. titleColor="title-text"
  37. :image="item.image"
  38. :title="item.title"
  39. :desc="item.desc"
  40. @click="goDetail(item.id)"
  41. />
  42. </view>
  43. </view>
  44. <SimplePageListLoader :loader="listLoader" />
  45. </view>
  46. </view>
  47. <tabbar :current="0"></tabbar>
  48. </template>
  49. <script setup lang="ts">
  50. import { useSimpleDataLoader } from '@/common/composeabe/SimpleDataLoader';
  51. import CommonContent, { GetColumListParams, GetContentListParams } from '@/api/CommonContent';
  52. import SimplePageListLoader from '@/common/components/SimplePageListLoader.vue';
  53. import Box2LineImageRightShadow from '@/pages/parts/Box2LineImageRightShadow.vue';
  54. import NewsIndexContent from '@/api/news/NewsIndexContent';
  55. import Tabbar from '@/common/components/tabs/tabbar.vue';
  56. import commonParserStyle from '@/common/style/commonParserStyle';
  57. import SimplePageContentLoader from '@/common/components/SimplePageContentLoader.vue';
  58. import { useSimplePageListLoader } from '@/common/composeabe/SimplePageListLoader';
  59. import { DataDateUtils } from '@imengyu/js-request-transform';
  60. import { navTo } from '@/common/utils/PageAction';
  61. import { onMounted } from 'vue';
  62. const introdData = useSimpleDataLoader(async () => {
  63. return (await NewsIndexContent.getColumList(new GetColumListParams()
  64. .setModelId(17)
  65. .setMainBodyColumnId(234)
  66. )).list[0]?.overview || '无内容!请添加内容!!';
  67. }, true);
  68. const listLoader = useSimplePageListLoader<{
  69. id: number,
  70. image: string,
  71. title: string,
  72. desc: string,
  73. date: string,
  74. }, {
  75. modelId: number|undefined,
  76. mainBodyColumnId: number|undefined,
  77. }>(8, async (page, pageSize, params) => {
  78. const res = await CommonContent.getContentList(new GetContentListParams().setSelfValues({
  79. modelId: 17,
  80. mainBodyColumnId: '255,256,283,284',
  81. }), page, pageSize);
  82. return { list: res.list.map((item) => {
  83. return {
  84. id: item.id,
  85. image: item.thumbnail || item.image,
  86. title: item.title,
  87. desc: item.desc,
  88. date: DataDateUtils.formatDate(item.publishAt, 'YYYY-MM-dd'),
  89. }
  90. }), total: res.total }
  91. });
  92. function goDetail(id: number) {
  93. navTo('/pages/article/details', { id });
  94. }
  95. onMounted(() => {
  96. listLoader.loadData();
  97. })
  98. </script>
  99. <style lang="scss">
  100. .page-home-introduction {
  101. .content {
  102. margin-top: 15vh;
  103. }
  104. }
  105. </style>