DetailsCommon.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <DetailTabPage
  3. ref="page"
  4. :load="load"
  5. :extraTabs="[
  6. {
  7. id: 5,
  8. name: '传习所',
  9. visible: true,
  10. },
  11. {
  12. id: 6,
  13. name: '传承人',
  14. visible: true,
  15. },
  16. {
  17. id: 7,
  18. name: '非遗作品',
  19. visible: true,
  20. },
  21. {
  22. id: 8,
  23. name: '相关非遗',
  24. visible: true,
  25. },
  26. {
  27. id: 9,
  28. name: '地理位置',
  29. visible: true,
  30. }
  31. ]"
  32. >
  33. <template #extraTabs="{ content, tabCurrentId }">
  34. <template v-if="tabCurrentId==5">
  35. <!-- 非遗传习中心 -->
  36. <CommonListPage
  37. :showSearch="false"
  38. :hasBg="false"
  39. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'ichSitesList')"
  40. detailsPage="/pages/inhert/seminar/details"
  41. :detailsParams="{
  42. mainBodyColumnId: SeminarContent.mainBodyColumnId,
  43. modelId: SeminarContent.modelId,
  44. }"
  45. />
  46. </template>
  47. <template v-else-if="tabCurrentId==6">
  48. <!-- 非遗传承人 -->
  49. <CommonListPage
  50. :showSearch="false"
  51. :hasBg="false"
  52. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'inheritorsList')"
  53. detailsPage="/pages/inhert/inheritor/details"
  54. :detailsParams="{
  55. mainBodyColumnId: InheritorContent.mainBodyColumnId,
  56. modelId: InheritorContent.modelId,
  57. }"
  58. />
  59. </template>
  60. <template v-else-if="tabCurrentId==7">
  61. <!-- 非遗作品 -->
  62. <CommonListPage
  63. :showSearch="false"
  64. :hasBg="false"
  65. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'worksList')"
  66. :detailsPage="`/pages/inhert/product/details`"
  67. :detailsParams="{
  68. mainBodyColumnId: ProductsContent.mainBodyColumnId,
  69. modelId: ProductsContent.modelId,
  70. }"
  71. />
  72. </template>
  73. <template v-else-if="tabCurrentId==8">
  74. <!-- 相关非遗 -->
  75. <CommonListPage
  76. :showSearch="false"
  77. :hasBg="false"
  78. :load="(page: number, pageSize: number) => loadSubList(page, pageSize, content, 'associationMeList')"
  79. :detailsPage="`/pages/inhert/${commonRefTarget}/details`"
  80. :detailsParams="{
  81. mainBodyColumnId: ProductsContent.mainBodyColumnId,
  82. modelId: ProductsContent.modelId,
  83. }"
  84. />
  85. </template>
  86. <template v-else-if="tabCurrentId==9">
  87. <!-- 地理位置 -->
  88. <view class="d-flex flex-col mt-3 mb-2">
  89. <HomeTitle title="地理位置" />
  90. <map id="map"
  91. class="w-100 height-350 mt-3"
  92. :latitude="content.latitude"
  93. :longitude="content.longitude"
  94. :markers="[
  95. {
  96. id: 1,
  97. latitude: content.latitude,
  98. longitude: content.longitude,
  99. iconPath: ImagesUrls.IconMarker,
  100. width: 40,
  101. height: 40,
  102. }
  103. ]"
  104. :scale="15"
  105. />
  106. <view class="d-flex flex-row justify-between bg-light radius-base p-2 mt-2">
  107. <view>
  108. <text class="iconfont icon-navigation"></text>
  109. <text class="address">{{ content.address }}</text>
  110. </view>
  111. <view class="d-flex flex-row align-center" @click="navTo('/pages/travel/nav/navto', {
  112. latitude: content.latitude,
  113. longitude: content.longitude,
  114. })">
  115. <text class="color-orange">去这里</text>
  116. <text class="iconfont icon-arrow-right"></text>
  117. </view>
  118. </view>
  119. </view>
  120. </template>
  121. </template>
  122. <template #titleEnd="{ content }">
  123. <u-tag
  124. v-if="content.levelText && content.title.length <= 10"
  125. :text="StringUtils.cutString(content.levelText as string, 4)"
  126. size="mini" plain color="#d9492e"
  127. class="flex-shrink-0"
  128. />
  129. </template>
  130. <template #titleExtra="{ content }">
  131. <view class="d-flex flex-col">
  132. <IntroBlock
  133. small
  134. :descItems="[
  135. {
  136. label: '地址',
  137. value: content.address,
  138. },
  139. {
  140. label: '项目级别',
  141. value: content.levelText ,
  142. },
  143. {
  144. label: '项目类别',
  145. value: content.ichTypeText,
  146. },
  147. {
  148. label: '批次时间',
  149. value: content.batchText,
  150. },
  151. {
  152. label: '所属区域',
  153. value: content.regionText ,
  154. },
  155. {
  156. label: '保护单位',
  157. value: content.unit
  158. },
  159. ]"
  160. />
  161. </view>
  162. </template>
  163. </DetailTabPage>
  164. </template>
  165. <script setup lang="ts">
  166. import DetailTabPage from "@/pages/article/common/DetailTabPage.vue";
  167. import ProjectsContent from "@/api/inheritor/ProjectsContent";
  168. import CommonListPage from "@/pages/article/common/CommonListPage.vue";
  169. import IntroBlock from "@/pages/article/common/IntroBlock.vue";
  170. import { useLoadQuerys } from "@/common/composeabe/LoadQuerys";
  171. import type { TabControlItem } from "@/common/composeabe/TabControl";
  172. import { ref, type Ref } from "vue";
  173. import { navTo } from "@/common/utils/PageAction";
  174. import InheritorContent from "@/api/inheritor/InheritorContent";
  175. import ProductsContent from "@/api/inheritor/ProductsContent";
  176. import SeminarContent from "@/api/inheritor/SeminarContent";
  177. import ImagesUrls from "@/common/config/ImagesUrls";
  178. import StringUtils from "@/common/utils/StringUtils";
  179. defineProps({
  180. commonRefName : {
  181. type: String,
  182. default: '',
  183. },
  184. commonRefTarget : {
  185. type: String,
  186. default: '',
  187. },
  188. })
  189. async function load(id: number, tabsArray: Ref<TabControlItem[]>) {
  190. const d = await ProjectsContent.getContentDetail(
  191. id,
  192. undefined,
  193. querys.value.modelId > 0 ? querys.value.modelId : undefined
  194. );
  195. tabsArray.value[4].visible = Boolean(d.ichSitesList && (d.ichSitesList as any[]).length > 0);
  196. tabsArray.value[5].visible = Boolean(d.inheritorsList && (d.inheritorsList as any[]).length > 0);
  197. tabsArray.value[6].visible = Boolean(d.worksList && (d.worksList as any[]).length > 0);
  198. tabsArray.value[7].visible = Boolean(d.associationMeList && (d.associationMeList as any[]).length > 0);
  199. tabsArray.value[8].visible = Boolean(d.longitude && d.latitude);
  200. return d;
  201. }
  202. async function loadSubList(page: number, pageSize: number, content: any, subList: string) {
  203. let list = (content[subList] as any[] || [])
  204. .slice((page - 1) * pageSize, page * pageSize);
  205. if (subList == 'associationMeList') {
  206. list.filter((p) => p.modelId == ProjectsContent.modelId).forEach((p) => {
  207. p.bottomTags = [
  208. p.levelText,
  209. p.ichTypeText,
  210. p.batchText,
  211. ];
  212. })
  213. } else if (subList == 'ichSitesList') {
  214. list.forEach((p) => {
  215. p.bottomTags = [
  216. content.ichTypeText,
  217. ];
  218. })
  219. } else if (subList == 'inheritorsList') {
  220. list.forEach((p) => {
  221. p.bottomTags = [
  222. p.levelText,
  223. p.nation,
  224. content.ichTypeText,
  225. ];
  226. })
  227. }
  228. return {
  229. list,
  230. total: list.length,
  231. }
  232. }
  233. const page = ref();
  234. const { querys } = useLoadQuerys({ modelId: 0 })
  235. defineExpose({
  236. getPageShareData() {
  237. return page.value.getPageShareData();
  238. }
  239. })
  240. </script>
  241. <style lang="scss">
  242. </style>