浏览代码

merge error

zjxpcyc 6 年前
父节点
当前提交
fe48def6f1
共有 2 个文件被更改,包括 29 次插入14 次删除
  1. 8
    8
      config/api.js
  2. 21
    6
      pages/EstateDetail/index.js

+ 8
- 8
config/api.js 查看文件

@@ -26,7 +26,7 @@ const $api = {
26 26
   dict: {
27 27
     list: {
28 28
       methods: 'GET',
29
-      url: `${BaseAPIURl}/dict`
29
+      url: `${BaseAPIURl}dict`
30 30
     }
31 31
   },
32 32
   banner: {
@@ -41,8 +41,8 @@ const $api = {
41 41
       url: `${BaseAPIURl}wx/building/list`
42 42
     },
43 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 48
   dynamic: { // 项目
@@ -67,25 +67,25 @@ const $api = {
67 67
   },
68 68
   appointment: {
69 69
     getByUser: {
70
-      methods: 'GET',
70
+      method: 'GET',
71 71
       url: `${BaseAPIURl}wx/appointment/:openid`
72 72
     },
73 73
     save: {
74
-      methods: 'POST',
74
+      method: 'POST',
75 75
       url: `${BaseAPIURl}wx/appointment/:openid`
76 76
     }
77 77
   },
78 78
   collection: {
79 79
     getByUser: {
80
-      methods: 'GET',
80
+      method: 'GET',
81 81
       url: `${BaseAPIURl}wx/collection/:openid`
82 82
     },
83 83
     save: {
84
-      methods: 'POST',
84
+      method: 'POST',
85 85
       url: `${BaseAPIURl}wx/collection/:openid`
86 86
     },
87 87
     deleteById: {
88
-      methods: 'DELETE',
88
+      method: 'DELETE',
89 89
       url: `${BaseAPIURl}wx/collection/:openid`
90 90
     }
91 91
   }

+ 21
- 6
pages/EstateDetail/index.js 查看文件

@@ -17,10 +17,16 @@ Page({
17 17
     const _that = this
18 18
 
19 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 26
     }).then((collects) => {
23
-      console.log(collects)
27
+      _that.setData({
28
+        Collects: collects.data.records
29
+      })
24 30
       fetch({
25 31
         url: $api.building.detail.url.replace(':id', id),
26 32
         method: $api.building.detail.method,
@@ -41,7 +47,12 @@ Page({
41 47
           }
42 48
         })
43 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,7 +60,8 @@ Page({
49 60
   data: {
50 61
     UserInfo: app.globalData.UserInfo,
51 62
     ScreenBottomHeight: app.globalData.ScreenBottomHeight,
52
-    EstateDetail: {}
63
+    EstateDetail: {},
64
+    Collects: []
53 65
   },
54 66
   MakeAnAppointment() { // 预约看房
55 67
     wx.navigateTo({
@@ -57,7 +69,7 @@ Page({
57 69
     })
58 70
   },
59 71
   MakeCollect() {
60
-    app.globalData.UserInfo.openid
72
+    const _that = this
61 73
     fetch({
62 74
       url: $api.collection.save.url.replace(':openid', app.globalData.UserInfo.openid) + '?buildingId=' + this.data.EstateDetail.buildingId,
63 75
       method: $api.collection.save.method,
@@ -65,6 +77,9 @@ Page({
65 77
       wx.showToast({
66 78
         title: '收藏成功!'
67 79
       })
80
+      _that.setData({
81
+        EstateDetail: { ..._that.data.EstateDetail, IsCollect:true}
82
+      })
68 83
     })
69 84
   },
70 85
   OpenPhone() { // 电话咨询