details.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <SimplePageContentLoader :loader="contentLoader">
  3. <view
  4. v-if="contentLoader.loadStatus.value == 'finished'"
  5. class="d-flex flex-column bg-base"
  6. >
  7. <swiper
  8. circular
  9. class="height-500"
  10. :indicator-dots="false"
  11. :autoplay="true"
  12. :interval="2000"
  13. :duration="1000"
  14. >
  15. <swiper-item v-for="(item, k) in data.images" :key="k">
  16. <image
  17. class="w-100 height-500 radius-l-top"
  18. :src="item"
  19. mode="aspectFill"
  20. @click="onPreviewImage(k)"
  21. />
  22. </swiper-item>
  23. </swiper>
  24. <view class="d-flex flex-col p-3 radius-l-top p-3 bg-light">
  25. <view class="d-flex flex-col">
  26. <HomeTitle :title="data.villageName" />
  27. <IntroBlock
  28. small
  29. :descItems="[
  30. {
  31. label: '保护级别',
  32. value: data.historyLevelText ,
  33. },
  34. {
  35. label: '年份时间',
  36. value: data.ageText,
  37. },
  38. {
  39. label: '所属区域',
  40. value: data.regionText ,
  41. },
  42. {
  43. label: '保护编号',
  44. value: data.code
  45. },
  46. ]"
  47. />
  48. <view class="mt-3 color-text-content">
  49. <u-parse :content="data.overview" :tagStyle="commonParserStyle"></u-parse>
  50. <text v-if="!data.overview" >无内容,请添加内容! {{ data.overview }}</text>
  51. </view>
  52. </view>
  53. <view class="d-flex flex-row flex-wrap mt-3">
  54. <view
  55. v-for="(tag, key) in tagsData"
  56. :key="key"
  57. class="w-20 d-flex flex-column align-center"
  58. @click="goList(tag)"
  59. >
  60. <image :src="tag.image" class="width-100 mt-2" mode="widthFix"></image>
  61. <view class="text-align-center color-text-content size-ss">{{ tag.title }}</view>
  62. </view>
  63. </view>
  64. <view class="d-flex flex-col mt-3 mb-2">
  65. <HomeTitle title="地理位置" />
  66. <map id="map"
  67. class="w-100 height-350 mt-3"
  68. :latitude="center[1]"
  69. :longitude="center[0]"
  70. :markers="markers"
  71. :scale="15"
  72. />
  73. <view class="d-flex flex-row justify-between bg-light radius-base p-2 mt-2">
  74. <view>
  75. <text class="iconfont icon-navigation"></text>
  76. <text class="address">{{ data.address }}</text>
  77. </view>
  78. <view class="d-flex flex-row align-center" @click="goAddress">
  79. <text class="color-orange">去这里</text>
  80. <text class="iconfont icon-arrow-right"></text>
  81. </view>
  82. </view>
  83. </view>
  84. <template
  85. v-for="(tag, index) in tagsDataRecommend"
  86. :key="index"
  87. >
  88. <HomeTitle :title="tag.title" showMore @clickMore="tag.goList()" />
  89. <SimplePageContentLoader :loader="tag.loader" >
  90. <view class="d-flex flex-col">
  91. <Box2LineLargeImageUserShadow
  92. v-for="(item, i) in tag.loader.content.value"
  93. :key="i"
  94. :title="item.title"
  95. :desc="item.desc"
  96. :image="item.image"
  97. :likes="item.likes"
  98. :comment="item.comments"
  99. @click="tag.goDetail(item.id)"
  100. />
  101. </view>
  102. </SimplePageContentLoader>
  103. </template>
  104. <ContentNote />
  105. </view>
  106. </view>
  107. </SimplePageContentLoader>
  108. </template>
  109. <script setup lang="ts">
  110. import VillageApi from '@/api/inhert/VillageApi';
  111. import commonParserStyle from '@/common/style/commonParserStyle';
  112. import uParse from '@/uni_modules/uview-plus/components/u-parse/u-parse.vue';
  113. import SimplePageContentLoader from '@/common/components/SimplePageContentLoader.vue';
  114. import HomeTitle from '@/pages/parts/HomeTitle.vue';
  115. import Box2LineLargeImageUserShadow from '@/pages/parts/Box2LineLargeImageUserShadow.vue';
  116. import { ref, toRefs, type Ref } from 'vue';
  117. import { useLoadQuerys } from '@/common/composeabe/LoadQuerys';
  118. import { useSwiperImagePreview } from '@/common/composeabe/SwiperImagePreview';
  119. import { navTo } from '@/common/utils/PageAction';
  120. import { useSimpleDataLoader } from '@/common/composeabe/SimpleDataLoader';
  121. import { useHomePageMiniCommonListGoMoreAndGoDetail, type IHomePageMiniCommonListGoMoreAndGoDetail } from '@/pages/article/common/CommonContent';
  122. import ContentNote from '@/pages/parts/ContentNote.vue';
  123. import IntroBlock from '@/pages/article/common/IntroBlock.vue';
  124. import ImagesUrls from '@/common/config/ImagesUrls';
  125. const EmptyImage = 'https://mn.wenlvti.net/app_static/minnan/EmptyImage.png';
  126. interface TagDataItem {
  127. image: string,
  128. title: string,
  129. modelId?: number,
  130. mainBodyColumnId?: number,
  131. }
  132. interface TagDataRecommendItem extends TagDataItem, IHomePageMiniCommonListGoMoreAndGoDetail {
  133. }
  134. const center = ref([118.15723, 24.48147]);
  135. const markers = ref<any>([]);
  136. const tagsData = ref<TagDataItem[]>([]);
  137. const tagsDataRecommend = ref<TagDataRecommendItem[]>([]) as unknown as Ref<TagDataRecommendItem[]>;
  138. const { querys } = useLoadQuerys({
  139. id: 0,
  140. }, () => contentLoader.loadData());
  141. const data = ref<Record<string, any>>({
  142. images: [],
  143. overview: '',
  144. longitude: 0,
  145. latitude: 0,
  146. region: 0,
  147. address: '',
  148. villageName: '',
  149. })
  150. function goAddress() {
  151. navTo('/pages/travel/nav/navto', {
  152. latitude: data.value.latitude,
  153. longitude: data.value.longitude,
  154. })
  155. }
  156. const { onPreviewImage } = useSwiperImagePreview(() => data.value.images || [])
  157. function goList(tag: TagDataItem) {
  158. navTo('/pages/article/common/list', {
  159. title: tag.title,
  160. modelId: tag.modelId,
  161. mainBodyColumnId: tag.mainBodyColumnId,
  162. region: data.value.region,
  163. });
  164. }
  165. const contentLoader = useSimpleDataLoader(async () => {
  166. data.value = {
  167. ...data.value,
  168. ...JSON.parse(uni.getStorageSync('VillageTemp') || '{}'),
  169. };
  170. if (data.value.longitude && data.value.latitude) {
  171. center.value = [Number(data.value.longitude), Number(data.value.latitude)];
  172. } else {
  173. center.value = [118.11593, 24.467580];
  174. }
  175. markers.value = [
  176. {
  177. id: 1,
  178. latitude: center.value[1],
  179. longitude: center.value[0],
  180. iconPath: ImagesUrls.IconMarker,
  181. width: 40,
  182. height: 40,
  183. }
  184. ];
  185. const menu = await VillageApi.getVillageMenuList(querys.value.id);
  186. tagsData.value = menu.map((item, index) => {
  187. return {
  188. title: item.name,
  189. image: item.logo || EmptyImage,
  190. modelId: item.modelId as number,
  191. mainBodyColumnId: item.mainBodyColumnId as number,
  192. };
  193. });
  194. tagsDataRecommend.value = tagsData.value.slice(0, 2).map((t) => {
  195. return {
  196. ...t,
  197. ...(toRefs(useHomePageMiniCommonListGoMoreAndGoDetail({
  198. title: t.title,
  199. mainBodyColumnId: t.mainBodyColumnId,
  200. modelId: t.modelId,
  201. itemType: 'article-common',
  202. detailsPage: '/pages/article/details',
  203. })))
  204. }
  205. }) as any;
  206. tagsDataRecommend.value.forEach(e => {
  207. e.loader.loadData();
  208. });
  209. }, false);
  210. </script>