details.vue 7.3 KB

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