DetailsCommon.vue 9.5 KB

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