preview.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <FlexCol :padding="30" :gap="20">
  3. <ImageSwiper
  4. :images="imageList"
  5. :radius="20"
  6. round
  7. mode="widthFix"
  8. :width="690"
  9. />
  10. <FlexCol v-if="overviewLoader.content.value">
  11. <SubTitle :title="overviewLoader.content.value.villageName || querys.villageName" />
  12. <IntroBlock
  13. small
  14. :descItems="[
  15. {
  16. label: '村落类型',
  17. value: overviewLoader.content.value.villageTypeText ,
  18. },
  19. {
  20. label: '地址',
  21. value: overviewLoader.content.value.cityAddress?.join(' '),
  22. },
  23. ]"
  24. />
  25. <FlexCol :margin="[20, 0, 0, 0]">
  26. <Parse :content="overviewLoader.content.value.overview" :tagStyle="commonParserStyle" />
  27. <Text v-if="!overviewLoader.content.value.overview" fontConfig="subText">暂无采编简内容</Text>
  28. </FlexCol>
  29. </FlexCol>
  30. <FlexCol :gap="20">
  31. <CollectModuleList
  32. :villageId="querys.villageId"
  33. :villageVolunteerId="querys.villageVolunteerId"
  34. :taskName="''"
  35. :taskTitle="''"
  36. :taskPid="0"
  37. isView
  38. />
  39. </FlexCol>
  40. <FlexCol :margin="[20, 0, 30, 0]">
  41. <SubTitle title="地理位置" />
  42. <FlexCol :radius="20" backgroundColor="white" :margin="[20, 0, 0, 0]">
  43. <map
  44. id="map"
  45. :latitude="center[1]"
  46. :longitude="center[0]"
  47. :markers="markers"
  48. :scale="15"
  49. :style="{
  50. width: '100%',
  51. height: '350rpx',
  52. }"
  53. />
  54. </FlexCol>
  55. </FlexCol>
  56. <XBarSpace />
  57. </FlexCol>
  58. </template>
  59. <script setup lang="ts">
  60. import { computed, ref } from 'vue';
  61. import { useLoadQuerys } from '@/common/composeabe/LoadQuerys';
  62. import { useSimpleDataLoader } from '@/common/composeabe/SimpleDataLoader';
  63. import { useCollectStore } from '@/store/collect';
  64. import FlexCol from '@/components/layout/FlexCol.vue';
  65. import CollectModuleList from '../components/CollectModuleList.vue';
  66. import XBarSpace from '@/components/layout/space/XBarSpace.vue';
  67. import ImageSwiper from '@/common/components/parts/ImageSwiper.vue';
  68. import VillageInfoApi, { CommonInfoModel } from '@/api/inhert/VillageInfoApi';
  69. import SubTitle from '@/components/display/title/SubTitle.vue';
  70. import IntroBlock from '@/pages/article/common/IntroBlock.vue';
  71. import Parse from '@/components/display/parse/Parse.vue';
  72. import Text from '@/components/basic/Text.vue';
  73. import commonParserStyle from '@/common/style/commonParserStyle';
  74. import ImagesUrls from '@/common/config/ImagesUrls';
  75. const { querys } = useLoadQuerys({
  76. villageId: 0,
  77. villageName: '',
  78. villageVolunteerId: 0,
  79. });
  80. const { getCollectModuleId } = useCollectStore();
  81. const center = ref([118.15723, 24.48147]);
  82. const markers = ref<any>([]);
  83. const imageList = computed(() => {
  84. const content = overviewLoader.content.value;
  85. if (!content) return [];
  86. if (content.images && content.images.length > 0)
  87. return content.images;
  88. if (content.image)
  89. return [content.image];
  90. return ["https://mn.wenlvti.net/app_static/xiangan/banner_dig_1.jpg" ];
  91. });
  92. const overviewLoader = useSimpleDataLoader<CommonInfoModel>(async () => {
  93. const subType = 'overview';
  94. const collectModuleId = getCollectModuleId('overview');
  95. const list = await VillageInfoApi.getList(
  96. collectModuleId, subType, undefined, undefined,
  97. querys.value.villageId, querys.value.villageVolunteerId
  98. );
  99. if (list.length > 0) {
  100. const info = (await VillageInfoApi.getInfo(
  101. collectModuleId,
  102. subType,
  103. undefined,
  104. undefined,
  105. querys.value.villageId,
  106. querys.value.villageVolunteerId,
  107. undefined,
  108. list[0].id,
  109. )) as CommonInfoModel
  110. if (info.longitude && info.latitude) {
  111. center.value = [Number(info.longitude), Number(info.latitude)];
  112. } else {
  113. center.value = [118.11593, 24.467580];
  114. }
  115. markers.value = [
  116. {
  117. id: 1,
  118. latitude: center.value[1],
  119. longitude: center.value[0],
  120. iconPath: ImagesUrls.IconMarker,
  121. width: 40,
  122. height: 40,
  123. }
  124. ];
  125. return info;
  126. }
  127. return new CommonInfoModel();
  128. });
  129. </script>