Browse Source

merge error

zjxpcyc 6 years ago
parent
commit
fe48def6f1
2 changed files with 29 additions and 14 deletions
  1. 8
    8
      config/api.js
  2. 21
    6
      pages/EstateDetail/index.js

+ 8
- 8
config/api.js View File

26
   dict: {
26
   dict: {
27
     list: {
27
     list: {
28
       methods: 'GET',
28
       methods: 'GET',
29
-      url: `${BaseAPIURl}/dict`
29
+      url: `${BaseAPIURl}dict`
30
     }
30
     }
31
   },
31
   },
32
   banner: {
32
   banner: {
41
       url: `${BaseAPIURl}wx/building/list`
41
       url: `${BaseAPIURl}wx/building/list`
42
     },
42
     },
43
     detail: {
43
     detail: {
44
-      methods: 'GET',
45
-      url: `${BaseAPIURl}/wx/buildingSelectId/:id`
44
+      method: 'GET',
45
+      url: `${BaseAPIURl}wx/buildingSelectId/:id`
46
     }
46
     }
47
   },
47
   },
48
   dynamic: { // 项目
48
   dynamic: { // 项目
67
   },
67
   },
68
   appointment: {
68
   appointment: {
69
     getByUser: {
69
     getByUser: {
70
-      methods: 'GET',
70
+      method: 'GET',
71
       url: `${BaseAPIURl}wx/appointment/:openid`
71
       url: `${BaseAPIURl}wx/appointment/:openid`
72
     },
72
     },
73
     save: {
73
     save: {
74
-      methods: 'POST',
74
+      method: 'POST',
75
       url: `${BaseAPIURl}wx/appointment/:openid`
75
       url: `${BaseAPIURl}wx/appointment/:openid`
76
     }
76
     }
77
   },
77
   },
78
   collection: {
78
   collection: {
79
     getByUser: {
79
     getByUser: {
80
-      methods: 'GET',
80
+      method: 'GET',
81
       url: `${BaseAPIURl}wx/collection/:openid`
81
       url: `${BaseAPIURl}wx/collection/:openid`
82
     },
82
     },
83
     save: {
83
     save: {
84
-      methods: 'POST',
84
+      method: 'POST',
85
       url: `${BaseAPIURl}wx/collection/:openid`
85
       url: `${BaseAPIURl}wx/collection/:openid`
86
     },
86
     },
87
     deleteById: {
87
     deleteById: {
88
-      methods: 'DELETE',
88
+      method: 'DELETE',
89
       url: `${BaseAPIURl}wx/collection/:openid`
89
       url: `${BaseAPIURl}wx/collection/:openid`
90
     }
90
     }
91
   }
91
   }

+ 21
- 6
pages/EstateDetail/index.js View File

17
     const _that = this
17
     const _that = this
18
 
18
 
19
     fetch({
19
     fetch({
20
-      url: $api.collection.getByUser.replace(':openid', app.globalData.UserInfo.openid),
21
-      method: $api.collection.getByUser.method
20
+      url: $api.collection.getByUser.url.replace(':openid', app.globalData.UserInfo.openid),
21
+      method: $api.collection.getByUser.method,
22
+      data: {
23
+        pageNum: 1,
24
+        pageSize: 100
25
+      }
22
     }).then((collects) => {
26
     }).then((collects) => {
23
-      console.log(collects)
27
+      _that.setData({
28
+        Collects: collects.data.records
29
+      })
24
       fetch({
30
       fetch({
25
         url: $api.building.detail.url.replace(':id', id),
31
         url: $api.building.detail.url.replace(':id', id),
26
         method: $api.building.detail.method,
32
         method: $api.building.detail.method,
41
           }
47
           }
42
         })
48
         })
43
         _that.setData({
49
         _that.setData({
44
-          EstateDetail: { ...data.data, propertyType: propertyType, buildingApartment: apart }
50
+          EstateDetail: { 
51
+            ...data.data, 
52
+            propertyType: propertyType, 
53
+            buildingApartment: apart, 
54
+            IsCollect: (_that.data.Collects.filter(x => x.buildingId == data.data.buildingId).length>0? true:false)
55
+            }
45
         })
56
         })
46
       })
57
       })
47
     })
58
     })
49
   data: {
60
   data: {
50
     UserInfo: app.globalData.UserInfo,
61
     UserInfo: app.globalData.UserInfo,
51
     ScreenBottomHeight: app.globalData.ScreenBottomHeight,
62
     ScreenBottomHeight: app.globalData.ScreenBottomHeight,
52
-    EstateDetail: {}
63
+    EstateDetail: {},
64
+    Collects: []
53
   },
65
   },
54
   MakeAnAppointment() { // 预约看房
66
   MakeAnAppointment() { // 预约看房
55
     wx.navigateTo({
67
     wx.navigateTo({
57
     })
69
     })
58
   },
70
   },
59
   MakeCollect() {
71
   MakeCollect() {
60
-    app.globalData.UserInfo.openid
72
+    const _that = this
61
     fetch({
73
     fetch({
62
       url: $api.collection.save.url.replace(':openid', app.globalData.UserInfo.openid) + '?buildingId=' + this.data.EstateDetail.buildingId,
74
       url: $api.collection.save.url.replace(':openid', app.globalData.UserInfo.openid) + '?buildingId=' + this.data.EstateDetail.buildingId,
63
       method: $api.collection.save.method,
75
       method: $api.collection.save.method,
65
       wx.showToast({
77
       wx.showToast({
66
         title: '收藏成功!'
78
         title: '收藏成功!'
67
       })
79
       })
80
+      _that.setData({
81
+        EstateDetail: { ..._that.data.EstateDetail, IsCollect:true}
82
+      })
68
     })
83
     })
69
   },
84
   },
70
   OpenPhone() { // 电话咨询
85
   OpenPhone() { // 电话咨询