details.vue 6.3 KB

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