intangible.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. label: '其他级别项目',
  35. value: content.otherLevel && content.otherLevel.length > 0 ? `${content.otherLevel.length}个` : ''
  36. },
  37. ]"
  38. />
  39. <!-- 同级别非遗项目显示 -->
  40. <div v-if=" content.otherLevel && content.otherLevel.length > 0" class="mt-2 mb-3 d-flex flex-column">
  41. <span class="mb-2">其他级别项目</span>
  42. <NuxtLink
  43. v-for="(item, k) in content.otherLevel"
  44. :key="k"
  45. class="simple-link-item"
  46. :to="{ path: '/details/intangible', query: { id: item.id } }"
  47. >
  48. <div class="text">
  49. <div class="tag-button active">
  50. {{ item.levelText }}
  51. </div>
  52. <span class="ms-2">{{ item.title }}</span>
  53. <span v-if="item.regionText" class="ms-2">({{ item.regionText }})</span>
  54. </div>
  55. >
  56. </NuxtLink>
  57. </div>
  58. </template>
  59. <template #extraTab="{ currentTabId, content }">
  60. <!-- 非遗产品(作品) -->
  61. <CommonListBlock
  62. subName="worksMeList"
  63. :show="currentTabId==4"
  64. :showTotal="true"
  65. :showSearch="false"
  66. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'worksMeList')"
  67. detailsPage="/details/intangible"
  68. :detailsParams="{
  69. mainBodyColumnId: ProjectsContent.mainBodyColumnId,
  70. modelId: ProjectsContent.modelId,
  71. }"
  72. />
  73. <!-- 非遗传习中心 -->
  74. <CommonListBlock
  75. subName="ichSitesList"
  76. :show="currentTabId==5"
  77. :showTotal="true"
  78. :showSearch="false"
  79. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'ichSitesList')"
  80. detailsPage="/details/intangible"
  81. :detailsParams="{
  82. mainBodyColumnId: ProjectsContent.mainBodyColumnId,
  83. modelId: ProjectsContent.modelId,
  84. }"
  85. />
  86. <!-- 非遗传承人 -->
  87. <CommonListBlock
  88. subName="inheritorsList"
  89. :show="currentTabId==6"
  90. :showTotal="true"
  91. :showSearch="false"
  92. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'inheritorsList')"
  93. detailsPage="/details/intangible"
  94. :detailsParams="{
  95. mainBodyColumnId: ProjectsContent.mainBodyColumnId,
  96. modelId: ProjectsContent.modelId,
  97. }"
  98. />
  99. <!-- 相关资讯 -->
  100. <CommonListBlock
  101. subName="associationMeList"
  102. :show="currentTabId==7"
  103. :showTotal="true"
  104. :showSearch="false"
  105. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'associationMeList')"
  106. detailsPage="/details/intangible"
  107. :detailsParams="{
  108. mainBodyColumnId: ProjectsContent.mainBodyColumnId,
  109. modelId: ProjectsContent.modelId,
  110. }"
  111. />
  112. </template>
  113. </TabDetailView>
  114. </template>
  115. <script setup lang="ts">
  116. import TabDetailView from './TabDetailView.vue';
  117. import ProjectsContent from '@/api/inheritor/ProjectsContent';
  118. import CommonListBlock from '@/components/content/CommonListBlock.vue';
  119. import IntroBlock from '@/components/parts/IntroBlock.vue';
  120. import { useRoute } from 'vue-router';
  121. const route = useRoute();
  122. async function loadSubList(page: number, pageSize: number, content: any, subList: string) {
  123. const list = content[subList] as any[] || [];
  124. if (subList == 'associationMeList') {
  125. list.forEach((p) => {
  126. p.bottomTags = [
  127. p.levelText,
  128. p.ichTypeText,
  129. p.batchText,
  130. ];
  131. })
  132. } else if (subList == 'ichSitesList') {
  133. list.forEach((p) => {
  134. p.bottomTags = [
  135. content.ichTypeText,
  136. ];
  137. })
  138. } else if (subList == 'inheritorsList') {
  139. list.forEach((p) => {
  140. p.bottomTags = [
  141. p.levelText,
  142. p.nation,
  143. content.ichTypeText,
  144. ];
  145. })
  146. }
  147. return {
  148. page: page,
  149. total: list.length,
  150. data: list.slice((page - 1) * pageSize, page * pageSize)
  151. };
  152. }
  153. async function loadData(id: number) {
  154. const d = await ProjectsContent.getContentDetail(id,
  155. route.query.modelId ? Number(route.query.modelId) : undefined
  156. );
  157. d.contentProps = {
  158. tabs: [
  159. { id: 0, text: '简介', visible: true },
  160. { id: 1, text: '相册', visible: d.images.length > 0 },
  161. { id: 2, text: '音频', visible: Boolean(d.audio) },
  162. { id: 3, text: '视频', visible: Boolean(d.video) },
  163. { id: 4, text: '非遗作品', visible: Boolean(d.worksList && (d.worksList as any[]).length > 0) },
  164. { id: 5, text: '非遗传习中心', visible: Boolean(d.ichSitesList && (d.ichSitesList as any[]).length > 0) },
  165. { id: 6, text: '非遗传承人', visible: Boolean(d.inheritorsList && (d.inheritorsList as any[]).length > 0) },
  166. { id: 7, text: '相关资讯', visible: Boolean(d.associationMeList && (d.associationMeList as any[]).length > 0) },
  167. ]
  168. };
  169. return d;
  170. }
  171. </script>
  172. <style lang="scss">
  173. .simple-link-item {
  174. background-color: #fff;
  175. border-radius: 10px;
  176. display: flex;
  177. flex-direction: row;
  178. align-items: center;
  179. justify-content: space-between;
  180. text-decoration: none;
  181. color: #000;
  182. padding: 10px 20px;
  183. cursor: pointer;
  184. .text {
  185. display: flex;
  186. flex-direction: row;
  187. align-items: center;
  188. }
  189. .tag-button {
  190. border-radius: 15px;
  191. padding: 6px 10px;
  192. }
  193. }
  194. </style>