project.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="project-detail">
  3. <swiper class="swiper" circular :indicator-dots="true">
  4. <swiper-item>
  5. <image class="image"
  6. src="https://assets.api.uizard.io/api/cdn/stream/0ba939e8-082b-42f9-a314-be3e195b3b25.png"
  7. mode="aspectFill">
  8. </image>
  9. </swiper-item>
  10. <swiper-item>
  11. <image class="image"
  12. src="https://assets.api.uizard.io/api/cdn/stream/0ba939e8-082b-42f9-a314-be3e195b3b25.png"
  13. mode="aspectFill">
  14. </image>
  15. </swiper-item>
  16. <swiper-item>
  17. <image class="image"
  18. src="https://assets.api.uizard.io/api/cdn/stream/0ba939e8-082b-42f9-a314-be3e195b3b25.png"
  19. mode="aspectFill">
  20. </image>
  21. </swiper-item>
  22. </swiper>
  23. <view class="project-title">
  24. <view class="project-name">维绿大厦项目</view>
  25. <view class="project-label">距离您2km</view>
  26. <uni-icons class="wx-icon" type="weixin" size="38" color="#43b156"></uni-icons>
  27. </view>
  28. <view class="project-label project-article">
  29. 维绿大厦位于武进区,交通便利,环境优美,周围公园便于锻炼。
  30. </view>
  31. <view class="project-content">
  32. <view class="content-title">地理位置</view>
  33. <view class="content-map">
  34. <map id="map" class="map" :show-location="true" :latitude="latitude" :longitude="longitude"></map>
  35. </view>
  36. <view class="content-title">配套设施</view>
  37. <view class="content-device">
  38. <view class="device-item">
  39. <uni-icons class="device-icon" custom-prefix="iconfont" type="icon-gongyuan" size="16"></uni-icons>
  40. <text class="device-label">公园环境</text>
  41. </view>
  42. <view class="device-item">
  43. <uni-icons class="device-icon" custom-prefix="iconfont" type="icon-jiaotong" size="18"></uni-icons>
  44. <text class="device-label">交通便利</text>
  45. </view>
  46. <view class="device-item">
  47. <uni-icons class="device-icon" custom-prefix="iconfont" type="icon-tubiao_-" size="18"></uni-icons>
  48. <text class="device-label">医疗完善</text>
  49. </view>
  50. <view class="device-item">
  51. <uni-icons class="device-icon" custom-prefix="iconfont" type="icon-wifi" size="16"></uni-icons>
  52. <text class="device-label">免费wifi</text>
  53. </view>
  54. <view class="device-item">
  55. <uni-icons class="device-icon" custom-prefix="iconfont" type="icon-zhishiku" size="16"></uni-icons>
  56. <text class="device-label">幼儿教育</text>
  57. </view>
  58. <view class="device-item">
  59. <uni-icons class="device-icon" custom-prefix="iconfont" type="icon-gouwu" size="18"></uni-icons>
  60. <text class="device-label">便捷购物</text>
  61. </view>
  62. </view>
  63. <view class="content-title">房源列表</view>
  64. <view class="house-list">
  65. <house-items v-for="(item,index) in list" :house="item" :key="item.id"></house-items>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. getOpenHouseListByPage
  73. } from '@/request/api/house.js'
  74. import houseItems from "@/components/house/houseItems.vue";
  75. export default {
  76. data() {
  77. return {
  78. latitude: 27.973361,
  79. longitude: 120.658992,
  80. list: []
  81. }
  82. },
  83. onLoad(body) {
  84. console.log(body);
  85. this.init();
  86. },
  87. onReady() {
  88. this._mapContext = uni.createMapContext("map", this);
  89. this.addMarkers();
  90. },
  91. components: {
  92. houseItems
  93. },
  94. methods: {
  95. init() {
  96. getOpenHouseListByPage({
  97. currPage: 1,
  98. pageSize: 10
  99. }).then(res => {
  100. if (res.code === 200) {
  101. this.list = this.list.concat(res.data.dataList); //追加新数据
  102. }
  103. })
  104. },
  105. addMarkers() {
  106. const positions = [{
  107. latitude: 23.099994,
  108. longitude: 113.324520,
  109. }]
  110. const markers = []
  111. positions.forEach((p, i) => {
  112. console.log(i)
  113. markers.push(
  114. Object.assign({}, {
  115. id: i + 1,
  116. width: 50,
  117. height: 50,
  118. joinCluster: true, // 指定了该参数才会参与聚合
  119. }, p)
  120. )
  121. })
  122. this._mapContext.addMarkers({
  123. markers,
  124. clear: false,
  125. complete(res) {
  126. console.log('addMarkers', res)
  127. }
  128. })
  129. }
  130. },
  131. }
  132. </script>
  133. <style lang="scss">
  134. .project-detail {
  135. background: #fff;
  136. padding-bottom: 60rpx;
  137. .swiper {
  138. height: 400rpx;
  139. .image {
  140. width: 100%;
  141. height: 100%;
  142. }
  143. }
  144. .project-label {
  145. font-size: 24rpx;
  146. color: $uni-secondary-color;
  147. font-weight: 300;
  148. }
  149. .project-article {
  150. font-size: 28rpx;
  151. padding: 0 30rpx;
  152. }
  153. .project-title {
  154. padding: 40rpx 130rpx 30rpx 30rpx;
  155. position: relative;
  156. .project-name {
  157. font-size: 36rpx;
  158. font-weight: 500;
  159. }
  160. .project-label {
  161. margin-top: 6rpx;
  162. }
  163. .wx-icon {
  164. position: absolute;
  165. top: 0;
  166. right: 30rpx;
  167. transform: translateY(50%);
  168. }
  169. }
  170. .content-map {
  171. width: 100%;
  172. height: 360rpx;
  173. border-radius: 16rpx;
  174. overflow: hidden;
  175. display: flex;
  176. .map {
  177. flex: 1;
  178. height: 100%;
  179. border-radius: 16rpx;
  180. }
  181. }
  182. .project-content {
  183. padding: 0 30rpx;
  184. box-sizing: border-box;
  185. .content-title {
  186. font-size: 32rpx;
  187. font-weight: 500;
  188. margin: 30rpx 0;
  189. }
  190. .content-device {
  191. display: flex;
  192. flex-wrap: wrap;
  193. .device-item {
  194. width: 50%;
  195. display: flex;
  196. align-items: center;
  197. margin-bottom: 20rpx;
  198. .device-label {
  199. flex: 1;
  200. width: 0;
  201. color: $uni-secondary-color;
  202. font-weight: 200;
  203. margin-left: 10rpx;
  204. }
  205. .device-icon {
  206. color: $uni-base-color;
  207. }
  208. }
  209. }
  210. }
  211. }
  212. </style>