Browse Source

change index

zjxpcyc 6 years ago
parent
commit
3c51c44926

+ 21
- 0
pages/components/RoomCard/index.js View File

@@ -0,0 +1,21 @@
1
+
2
+// const app = getApp()
3
+
4
+Component({
5
+  properties: {
6
+    room: {
7
+      type: Object,
8
+      value: {},
9
+    },
10
+  },
11
+  attached() {
12
+    console.log(this.properties.room)
13
+  },
14
+  methods: {
15
+    handleTap() {
16
+      wx.navigateTo({
17
+        url: `/pages/EstateDetail/index?id=${this.properties.room.buildingId}`
18
+      })
19
+    }
20
+  }
21
+})

+ 3
- 0
pages/components/RoomCard/index.json View File

@@ -0,0 +1,3 @@
1
+{
2
+  "component": true
3
+}

+ 82
- 0
pages/components/RoomCard/index.less View File

@@ -0,0 +1,82 @@
1
+.room-card {
2
+  padding: 60rpx 0;
3
+  border-bottom: 2rpx solid rgba(234,234,234,1);
4
+
5
+  .head {
6
+    margin-bottom: 20rpx;
7
+
8
+    .title {
9
+      font-size: 36rpx;
10
+      line-height: 52rpx;
11
+      color: #333;
12
+    }
13
+
14
+    .subtitle {
15
+      float: right;
16
+    }
17
+  }
18
+
19
+  .body {
20
+    display: flex;
21
+
22
+    .thumb {
23
+      width: 73.5%;
24
+      height: 280rpx;
25
+      flex: none;
26
+      overflow: hidden;
27
+      position: relative;
28
+      border-radius: 8rpx;
29
+
30
+      image {
31
+        width: 100%;
32
+        height: 100%;
33
+        border-radius: 8rpx;
34
+      }
35
+    }
36
+
37
+    .content {
38
+      margin-left: 20rpx;
39
+      flex: auto;
40
+    }
41
+
42
+    .price {
43
+      font-size: 46rpx;
44
+      color: #FF2B00;
45
+    }
46
+
47
+    .persons {
48
+      font-weight: 500;
49
+      font-size: 28rpx;
50
+      color: #666;
51
+      line-height: 36rpx;
52
+    }
53
+
54
+    .tags {
55
+      margin-top: 8rpx;
56
+    }
57
+
58
+    .tag {
59
+      color: #9D876D;
60
+      font-size: 20rpx;
61
+      line-height: 32rpx;
62
+      text-align: center;
63
+      border: 1rpx solid rgba(187,156,121,1);
64
+      border-radius: 4rpx;
65
+      width: fit-content;
66
+      padding: 0 10rpx;
67
+
68
+      & + .tag {
69
+        margin-top: 10rpx;
70
+      }
71
+    }
72
+  }
73
+
74
+
75
+  .gray-text {
76
+    font-size: 24rpx;
77
+    color: #666;
78
+    line-height: 34rpx;
79
+  }
80
+
81
+
82
+}

+ 27
- 0
pages/components/RoomCard/index.wxml View File

@@ -0,0 +1,27 @@
1
+<view class="room-card" wx:if="{{room}}" bindtap="handleTap">
2
+  <view class="head">
3
+    <view class="subtitle gray-text">{{room.buildingArea}}</view>
4
+    <view class="title">{{room.buildingName}}</view>
5
+    <view class="gray-text">{{room.address}} 距您{{room.distance}}km</view>
6
+  </view>
7
+  <view class="body">
8
+    <view class="thumb">
9
+      <image mode="scaleToFill" src="{{room.buildingImg[0].url}}"></image>
10
+    </view>
11
+    <view class="content">
12
+      <view class="price">{{room.custPrice}}</view>
13
+      <view class="gray-text">均价约(元/平)</view>
14
+      <view class="persons" style="margin-top: 14rpx;">{{room.visits.length}}人围观</view>
15
+      <view class="tags" wx:if="{{room.buildingTag && room.buildingTag.length}}">
16
+        <view
17
+          class="tag"
18
+          wx:for="{{[0, 1, 2]}}"
19
+          wx:for-index="inx"
20
+          wx:if="{{inx < room.buildingTag.length}}"
21
+          wx:key="inx">
22
+          {{room.buildingTag[inx].tagName}}
23
+        </view>
24
+      </view>
25
+    </view>
26
+  </view>
27
+</view>

+ 66
- 0
pages/components/RoomCard/index.wxss View File

@@ -0,0 +1,66 @@
1
+.room-card {
2
+  padding: 60rpx 0;
3
+  border-bottom: 2rpx solid #eaeaea;
4
+}
5
+.room-card .head {
6
+  margin-bottom: 20rpx;
7
+}
8
+.room-card .head .title {
9
+  font-size: 36rpx;
10
+  line-height: 52rpx;
11
+  color: #333;
12
+}
13
+.room-card .head .subtitle {
14
+  float: right;
15
+}
16
+.room-card .body {
17
+  display: flex;
18
+}
19
+.room-card .body .thumb {
20
+  width: 73.5%;
21
+  height: 280rpx;
22
+  flex: none;
23
+  overflow: hidden;
24
+  position: relative;
25
+  border-radius: 8rpx;
26
+}
27
+.room-card .body .thumb image {
28
+  width: 100%;
29
+  height: 100%;
30
+  border-radius: 8rpx;
31
+}
32
+.room-card .body .content {
33
+  margin-left: 20rpx;
34
+  flex: auto;
35
+}
36
+.room-card .body .price {
37
+  font-size: 46rpx;
38
+  color: #FF2B00;
39
+}
40
+.room-card .body .persons {
41
+  font-weight: 500;
42
+  font-size: 28rpx;
43
+  color: #666;
44
+  line-height: 36rpx;
45
+}
46
+.room-card .body .tags {
47
+  margin-top: 8rpx;
48
+}
49
+.room-card .body .tag {
50
+  color: #9D876D;
51
+  font-size: 20rpx;
52
+  line-height: 32rpx;
53
+  text-align: center;
54
+  border: 1rpx solid #bb9c79;
55
+  border-radius: 4rpx;
56
+  width: fit-content;
57
+  padding: 0 10rpx;
58
+}
59
+.room-card .body .tag + .tag {
60
+  margin-top: 10rpx;
61
+}
62
+.room-card .gray-text {
63
+  font-size: 24rpx;
64
+  color: #666;
65
+  line-height: 34rpx;
66
+}

+ 6
- 1
pages/components/SubIndex/index.js View File

@@ -81,9 +81,14 @@ create({
81 81
       }).then((buildings) => {
82 82
         const records = buildings.data.map(x => {
83 83
           const distance = parseInt(this.GetGreatCircleDistance(latitude, longitude, x.coordinate.split(',')[0], x.coordinate.split(',')[1] || longitude))
84
+          
85
+          const m = /\d+/.exec(x.price)
86
+          const p = m ? `${m[0]}起`: x.price
87
+          
84 88
           return {
85 89
             ...x,
86
-            distance: distance / 10
90
+            distance: distance / 10,
91
+            custPrice: p,
87 92
           }
88 93
         })
89 94
         this.setData({

+ 1
- 0
pages/components/SubIndex/index.json View File

@@ -1,5 +1,6 @@
1 1
 {
2 2
   "component": true,
3 3
   "usingComponents": {
4
+    "roomcard": "/pages/components/RoomCard/index"
4 5
   }
5 6
 }

+ 1
- 23
pages/components/SubIndex/index.wxml View File

@@ -110,29 +110,7 @@
110 110
   <text class="title">精选房源</text>
111 111
 
112 112
   <view class="roomList">
113
-    <view wx:for="{{EstateList}}" wx:for-item="item" wx:for-index="index" wx:key="key" data-id="{{item.buildingId}}" bindtap='ItemTap'>
114
-      <view class="img">
115
-        <image mode="aspectFill" data-id="{{item.buildingId}}" src="{{item.buildingImg[0].url}}" class="centerLabel cover"></image>
116
-        <view class="flex-h" data-id="{{item.buildingId}}" >
117
-          <view class="flex-item" data-id="{{item.buildingId}}" >
118
-            <text data-id="{{item.buildingId}}" wx:for="{{item.buildingTag}}" wx:for-item="tag" wx:for-index="index" wx:key="key">{{tag.tagName}}</text>
119
-          </view>
120
-          <image data-id="{{item.buildingId}}" mode="widthFix" src="/assets/images/dingwei.png"></image>
121
-          <text data-id="{{item.buildingId}}">{{item.buildingArea}}</text>
122
-        </view>
123
-      </view>
124
-      <text data-id="{{item.buildingId}}" class="icon">{{item.marketStatus || ''}}</text>
125
-      <view data-id="{{item.buildingId}}" class="info">
126
-        <view data-id="{{item.buildingId}}" class="flex-h">
127
-          <text class="flex-item" data-id="{{item.buildingId}}">{{item.buildingName}}</text>
128
-          <text data-id="{{item.buildingId}}">均价:<text>{{item.price}}</text></text>
129
-        </view>
130
-        <view data-id="{{item.buildingId}}" class="flex-h">
131
-          <text class="flex-item" data-id="{{item.buildingId}}">{{item.address}} 距您{{item.distance}}km</text>
132
-          <text data-id="{{item.buildingId}}">{{item.visits.length}}人围观</text>
133
-        </view>
134
-      </view>
135
-    </view>
113
+    <roomcard wx:for="{{EstateList}}" wx:for-item="item" wx:key="key" room="{{item}}"></roomcard>
136 114
   </view>
137 115
 
138 116
 </view>

+ 0
- 1
pages/index/index.wxml View File

@@ -49,7 +49,6 @@
49 49
   <!-- 授权 -->
50 50
   <view class="layer" hidden="{{userInfo.hasReg == 1}}">
51 51
     <view class="auth">
52
-    {{userInfo.hasReg == 1}}
53 52
       <view class="centerLabel">
54 53
         <view class="logo">
55 54
           <image mode="widthFix" src="https://whole-estate.oss-cn-beijing.aliyuncs.com/x-logo.png"></image>

+ 1
- 1
pages/map/testmap.wxml View File

@@ -11,7 +11,7 @@
11 11
         </cover-view>
12 12
       </cover-view>
13 13
       <cover-view class="navItem" >
14
-        <button class="centerLabel" open-type="share">
14
+        <button class="centerLabel noborder" open-type="share" style="line-height: 1">
15 15
           <cover-image class="navImg" mode="widthFix" src="/assets/images/share.png"></cover-image>
16 16
           <cover-view class="navText">分享</cover-view>
17 17
         </button>

+ 4
- 0
pages/map/testmap.wxss View File

@@ -208,3 +208,7 @@
208 208
   transform: translateY(-50%);
209 209
   -webkit-transform: translateY(-50%);
210 210
 }
211
+
212
+.noborder::after{
213
+  border: none;
214
+}