IntangibleDetailView.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <!-- 非遗详情页 -->
  3. <TabDetailView
  4. :load="loadData"
  5. >
  6. <template #extraInfo="{ content }">
  7. <IntroBlock
  8. :descItems="[
  9. {
  10. label: '地址',
  11. value: content.address,
  12. },
  13. {
  14. label: '项目级别',
  15. value: content.levelText ,
  16. },
  17. {
  18. label: '项目类别',
  19. value: content.ichTypeText,
  20. },
  21. {
  22. label: '批次时间',
  23. value: content.batchText,
  24. },
  25. {
  26. label: '所属区域',
  27. value: content.regionText ,
  28. },
  29. {
  30. label: '保护单位',
  31. value: content.unit
  32. },
  33. ]"
  34. />
  35. </template>
  36. <template #extraTab="{ currentTabId, content }">
  37. <template v-if="currentTabId==4">
  38. <!-- 非遗产品(作品) -->
  39. <CommonListBlock
  40. :showTotal="true"
  41. :showSearch="false"
  42. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'associationMeList')"
  43. detailsPage="/inheritor/intangible-detail"
  44. :detailsParams="{
  45. mainBodyColumnId: ProjectsContent.mainBodyColumnId,
  46. modelId: ProjectsContent.modelId,
  47. }"
  48. />
  49. </template>
  50. <template v-else-if="currentTabId==5">
  51. <!-- 非遗传习中心 -->
  52. <CommonListBlock
  53. :showTotal="true"
  54. :showSearch="false"
  55. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'ichSitesList')"
  56. detailsPage="/inheritor/intangible-detail"
  57. :detailsParams="{
  58. mainBodyColumnId: ProjectsContent.mainBodyColumnId,
  59. modelId: ProjectsContent.modelId,
  60. }"
  61. />
  62. </template>
  63. <template v-else-if="currentTabId==6">
  64. <!-- 非遗传承人 -->
  65. <CommonListBlock
  66. :showTotal="true"
  67. :showSearch="false"
  68. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'inheritorsList')"
  69. detailsPage="/inheritor/intangible-detail"
  70. :detailsParams="{
  71. mainBodyColumnId: ProjectsContent.mainBodyColumnId,
  72. modelId: ProjectsContent.modelId,
  73. }"
  74. />
  75. </template>
  76. </template>
  77. </TabDetailView>
  78. </template>
  79. <script setup lang="ts">
  80. import TabDetailView from './TabDetailView.vue';
  81. import ProjectsContent from '@/api/inheritor/ProjectsContent';
  82. import CommonListBlock from '@/components/content/CommonListBlock.vue';
  83. import IntroBlock from '@/components/parts/IntroBlock.vue';
  84. import { useRoute } from 'vue-router';
  85. const route = useRoute();
  86. async function loadSubList(page: number, pageSize: number, content: any, subList: string) {
  87. const list = content[subList] as any[] || [];
  88. if (subList == 'associationMeList') {
  89. list.forEach((p) => {
  90. p.bottomTags = [
  91. p.levelText,
  92. p.ichTypeText,
  93. p.batchText,
  94. ];
  95. })
  96. } else if (subList == 'ichSitesList') {
  97. list.forEach((p) => {
  98. p.bottomTags = [
  99. content.levelText,
  100. content.ichTypeText,
  101. ];
  102. })
  103. } else if (subList == 'inheritorsList') {
  104. list.forEach((p) => {
  105. p.bottomTags = [
  106. p.levelText,
  107. p.nation,
  108. content.ichTypeText,
  109. ];
  110. })
  111. }
  112. return {
  113. page: page,
  114. total: list.length,
  115. data: list.slice((page - 1) * pageSize, page * pageSize)
  116. };
  117. }
  118. async function loadData(id: number) {
  119. const d = await ProjectsContent.getContentDetail(id,
  120. route.query.modelId ? Number(route.query.modelId) : undefined
  121. );
  122. d.contentProps = {
  123. tabs: [
  124. { id: 0, text: '简介', visible: true },
  125. { id: 1, text: '相册', visible: d.images.length > 0 },
  126. { id: 2, text: '音频', visible: Boolean(d.audio) },
  127. { id: 3, text: '视频', visible: Boolean(d.video) },
  128. { id: 4, text: '非遗作品', visible: Boolean(d.associationMeList && (d.associationMeList as any[]).length > 0) },
  129. { id: 5, text: '非遗传习中心', visible: Boolean(d.ichSitesList && (d.ichSitesList as any[]).length > 0) },
  130. { id: 6, text: '非遗传承人', visible: Boolean(d.inheritorsList && (d.inheritorsList as any[]).length > 0) },
  131. ]
  132. };
  133. return d;
  134. }
  135. </script>