map.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <CommonRoot>
  3. <FlexCol :padding="30" :gap="15" innerClass="bg-base">
  4. <!-- 分类 -->
  5. <template v-for="category in categoryDatas" :key="category.title">
  6. <HomeTitle
  7. :title="category.title"
  8. showMore
  9. moreText="更多"
  10. @clickMore="category.morePage"
  11. />
  12. <SimplePageContentLoader :loader="category.data" >
  13. <FlexCol>
  14. <Box2LineImageRightShadow
  15. v-for="(item, i) in category.data.content.value"
  16. titleColor="title-text"
  17. fixSize
  18. :key="i"
  19. :title="item.title"
  20. :desc="item.desc"
  21. :image="item.image"
  22. :tags="item.bottomTags"
  23. @click="category.detailPage(item.id)"
  24. />
  25. </FlexCol>
  26. </SimplePageContentLoader>
  27. </template>
  28. <!-- 闽南文化概况 -->
  29. <HomeTitle title="闽南文化概况(厦门市)" />
  30. <SimplePageContentLoader :loader="introdData" >
  31. <FlexCol>
  32. <FlexRow
  33. v-for="(item, i) in introdData .content.value"
  34. :key="i"
  35. position="relative"
  36. align-items="stretch"
  37. >
  38. <Divider
  39. centerDot
  40. type="vertical"
  41. color="primary"
  42. />
  43. <Width :width="15" />
  44. <Box2LineImageRightShadow
  45. titleColor="title-text"
  46. fixSize
  47. :title="item.title"
  48. :desc="item.desc"
  49. :showImage="false"
  50. >
  51. <template #desc>
  52. <TextEllipsis customContent maskColor="background.page">
  53. <Parse :content="item.desc" />
  54. </TextEllipsis>
  55. </template>
  56. </Box2LineImageRightShadow>
  57. </FlexRow>
  58. </FlexCol>
  59. </SimplePageContentLoader>
  60. </FlexCol>
  61. </CommonRoot>
  62. </template>
  63. <script setup lang="ts">
  64. import CommonRoot from '@/components/dialog/CommonRoot.vue';
  65. import FlexCol from '@/components/layout/FlexCol.vue';
  66. import FlexRow from '@/components/layout/FlexRow.vue';
  67. import HomeTitle from '../parts/HomeTitle.vue';
  68. import SimplePageContentLoader from '@/common/components/SimplePageContentLoader.vue';
  69. import { navTo } from '@/components/utils/PageAction';
  70. import { useSimpleDataLoader } from '@/common/composeabe/SimpleDataLoader';
  71. import { GetColumListParams, GetContentListParams } from '@/api/CommonContent';
  72. import { navHomePageMiniCommonDetailGo, navHomePageMiniCommonListGo } from '../article/common/CommonContent';
  73. import CharacterContent from '@/api/introduction/CharacterContent';
  74. import Box2LineImageRightShadow from '../parts/Box2LineImageRightShadow.vue';
  75. import LanguageContent from '@/api/introduction/LanguageContent';
  76. import CustomContent from '@/api/introduction/CustomContent';
  77. import FeatureContent from '@/api/introduction/FeatureContent';
  78. import BulidingContent from '@/api/introduction/BulidingContent';
  79. import VictualsContent from '@/api/introduction/VictualsContent';
  80. import SeaContent from '@/api/introduction/SeaContent';
  81. import PolicyContent from '@/api/introduction/PolicyContent';
  82. import HistoryContent from '@/api/introduction/HistoryContent';
  83. import IndexContent from '@/api/introduction/IndexContent';
  84. import Divider from '@/components/display/Divider.vue';
  85. import Width from '@/components/layout/space/Width.vue';
  86. import Parse from '@/components/display/parse/Parse.vue';
  87. import TextEllipsis from '@/components/display/TextEllipsis.vue';
  88. const categoryDefine = [
  89. {
  90. title: '文化常识和闽南历史地理背景',
  91. content: HistoryContent,
  92. },
  93. {
  94. title: '历史人物',
  95. content: CharacterContent,
  96. detailPage: '/pages/introduction/character/details',
  97. morePage: '/pages/introduction/character/list',
  98. },
  99. {
  100. title: '语言文化',
  101. content: LanguageContent,
  102. },
  103. {
  104. title: '民间习俗',
  105. content: CustomContent,
  106. morePage: '/pages/introduction/custom/list',
  107. },
  108. {
  109. title: '艺术特色',
  110. content: FeatureContent,
  111. },
  112. {
  113. title: '建筑文化',
  114. content: BulidingContent,
  115. },
  116. {
  117. title: '饮食文化',
  118. content: VictualsContent,
  119. },
  120. {
  121. title: '海洋文化',
  122. content: SeaContent,
  123. },
  124. {
  125. title: '政策法规',
  126. content: PolicyContent,
  127. },
  128. ]
  129. const categoryDatas = categoryDefine.map(item => ({
  130. ...item,
  131. detailPage: (id: number) => {
  132. if (item.detailPage) {
  133. navTo(item.detailPage, { id });
  134. } else {
  135. navHomePageMiniCommonDetailGo({
  136. id,
  137. mainBodyColumnId: item.content.mainBodyColumnId,
  138. modelId: item.content.modelId,
  139. })
  140. }
  141. },
  142. morePage: () => {
  143. if (item.morePage) {
  144. navTo(item.morePage, {});
  145. } else {
  146. navHomePageMiniCommonListGo({
  147. title: item.title,
  148. mainBodyColumnId: item.content.mainBodyColumnId,
  149. modelId: item.content.modelId,
  150. detailsPage: item.detailPage,
  151. })
  152. }
  153. },
  154. data: useSimpleDataLoader(async () =>
  155. (await item.content.getContentList(new GetContentListParams(), 1, 3)).list.map(p => ({
  156. id: p.id,
  157. title: p.title,
  158. desc: p.desc,
  159. image: p.thumbnail || p.image,
  160. bottomTags: p.keywords as string[],
  161. }))
  162. ),
  163. }));
  164. const introdData = useSimpleDataLoader(async () => {
  165. let i = 0;
  166. const promises = [];
  167. for (const item of categoryDefine) {
  168. promises.push(IndexContent.getColumList(new GetColumListParams().setSelfValues({
  169. modelId: item.content.modelId,
  170. mainBodyColumnId: item.content.mainBodyColumnId,
  171. })))
  172. }
  173. const result = await Promise.all(promises);
  174. return result.map((data, i) => {
  175. const res = data.list[0];
  176. const item = categoryDefine[i];
  177. return {
  178. title: item.title,
  179. subtitle: '',
  180. date: '',
  181. desc: res.overview as string,
  182. index: i,
  183. }
  184. });
  185. });
  186. </script>