zjxpcyc il y a 6 ans
Parent
révision
8051fdaf02
3 fichiers modifiés avec 57 ajouts et 46 suppressions
  1. 17
    8
      config/api.js
  2. 38
    36
      pages/ActivityDetail/index.js
  3. 2
    2
      pages/ActivityDetail/index.wxml

+ 17
- 8
config/api.js Voir le fichier

@@ -17,6 +17,7 @@ const $api = {
17 17
     update: {
18 18
       method: 'PUT',
19 19
       url: `${BaseAPIURl}wx/user`
20
+<<<<<<< HEAD
20 21
     },
21 22
     appointment: {
22 23
       method: 'GET',
@@ -29,12 +30,14 @@ const $api = {
29 30
     building: {
30 31
       method: 'GET',
31 32
       url: `${BaseAPIURl}wx/collection/:openid`
33
+=======
34
+>>>>>>> 5c1f000d3d23edddccfbdceb0974cdc69e7bd0ce
32 35
     }
33 36
   },
34 37
   dict: {
35 38
     list: {
36 39
       methods: 'GET',
37
-      url: `${BaseAPIURl}dict`
40
+      url: `${BaseAPIURl}/dict`
38 41
     }
39 42
   },
40 43
   banner: {
@@ -50,7 +53,7 @@ const $api = {
50 53
     },
51 54
     detail: {
52 55
       method: 'GET',
53
-      url: `${BaseAPIURl}wx/buildingSelectId/:id`
56
+      url: `${BaseAPIURl}/wx/buildingSelectId/:id`
54 57
     }
55 58
   },
56 59
   dynamic: { // 项目
@@ -76,25 +79,31 @@ const $api = {
76 79
   appointment: {
77 80
     getByUser: {
78 81
       method: 'GET',
79
-      url: `${BaseAPIURl}wx/appointment/:openid`
82
+      url: `${BaseAPIURl}/wx/appointment/:openid`
80 83
     },
81 84
     save: {
82 85
       method: 'POST',
83
-      url: `${BaseAPIURl}wx/appointment/:openid`
86
+      url: `${BaseAPIURl}/wx/appointment/:openid`
84 87
     }
85 88
   },
86 89
   collection: {
87 90
     getByUser: {
88 91
       method: 'GET',
89
-      url: `${BaseAPIURl}wx/collection/:openid`
92
+      url: `${BaseAPIURl}/wx/collection/:openid`
90 93
     },
91 94
     save: {
92 95
       method: 'POST',
93
-      url: `${BaseAPIURl}wx/collection/:openid`
96
+      url: `${BaseAPIURl}/wx/collection/:openid`
94 97
     },
95 98
     deleteById: {
96 99
       method: 'DELETE',
97
-      url: `${BaseAPIURl}wx/collection/:openid`
100
+      url: `${BaseAPIURl}/wx/collection/:openid`
101
+    }
102
+  },
103
+  comment: {
104
+    list: { // 评论列表
105
+      methods: 'GET',
106
+      url: `${BaseAPIURl}/wx/comment/list`
98 107
     }
99 108
   }
100 109
 }
@@ -140,4 +149,4 @@ function get(k = '', urlParams = {}) {
140 149
 module.exports = {
141 150
   $api: $api,
142 151
   get: get,
143
-}
152
+}

+ 38
- 36
pages/ActivityDetail/index.js Voir le fichier

@@ -39,47 +39,14 @@ Page({
39 39
       CreateDate: '2019-02-02',
40 40
       Content: ''
41 41
     },
42
-    CommentList: [{
43
-      FloorUserIcon: '/assets/images/img1.jpg',
44
-      FloorUserName: '楼主姓名',
45
-      CreateDate: '2019-02-02 22:05',
46
-      Content: '就看到杰卡斯大姐大就看到杰卡斯大姐大就看到杰卡斯大姐大就看到杰卡斯大姐大',
47
-      ImgList: ['/assets/images/img1.jpg', '/assets/images/img2.jpg', '/assets/images/img5.jpg'],
48
-      LikeNum: '0',
49
-      Childs: [{
50
-        Name: '回复人姓名',
51
-        CreateDate: '2019-02-02 22:07',
52
-        Content: 'us很大很大声',
53
-        LikeNum: '15',
54
-        ImgList: ['/assets/images/img1.jpg']
55
-      }, {
56
-        Name: '回复人姓名',
57
-        CreateDate: '2019-02-02 22:07',
58
-        Content: 'us很大很大声',
59
-        LikeNum: '15',
60
-        ImgList: []
61
-      }]
62
-    }, {
63
-      FloorUserIcon: '/assets/images/img1.jpg',
64
-      FloorUserName: '楼主姓名',
65
-      CreateDate: '2019-02-02 22:05',
66
-      Content: '就看到杰卡斯大姐大',
67
-      ImgList: [],
68
-      LikeNum: '0',
69
-      Childs: [{
70
-        Name: '回复人姓名',
71
-        CreateDate: '2019-02-02 22:07',
72
-        Content: 'us很大很大声',
73
-        LikeNum: '15',
74
-        ImgList: []
75
-      }]
76
-    }]
42
+    CommentList: []
77 43
   },
78 44
   onReady() {
79 45
     if (this.data.Type === 1) {
80 46
       this.GetProjectDetail()
81 47
     } else {
82 48
       this.GetActivityDetail()
49
+      this.GetCommentList()
83 50
     }
84 51
   },
85 52
   AddComment() { // 添加评论
@@ -118,13 +85,48 @@ Page({
118 85
 
119 86
     }
120 87
   },
88
+  GetCommentList() { // 获取评论列表
89
+    fetch({
90
+      url: $api.comment.list.url + '?pageNum=1&pageSize=10000&commentType=activity&mainId=' + this.data.Id,
91
+      method: $api.comment.list.method
92
+    }).then((res) => {
93
+      if (res.code === 200) {
94
+        console.log(res.data.records)
95
+        let CommentList = []
96
+        res.data.records.map((item, index) => {
97
+          CommentList.push({
98
+            FloorUserIcon: item.avatar,
99
+            FloorUserName: item.customerName,
100
+            CreateDate: item.createDate,
101
+            Content: item.commentContent,
102
+            ImgList: item.commentImgList,
103
+            LikeNum: '0',
104
+            Childs: []
105
+          })
106
+          let aChild = []
107
+          item.childComment.map((subItem) => {
108
+            aChild.push({
109
+              Name: subItem.customerName,
110
+              CreateDate: subItem.createDate,
111
+              Content: subItem.commentContent,
112
+              LikeNum: '0',
113
+              ImgList: subItem.commentImgList
114
+            })
115
+          })
116
+          CommentList[index].Childs = aChild
117
+        })
118
+        this.setData({
119
+          CommentList: CommentList
120
+        })
121
+      }
122
+    })
123
+  },
121 124
   GetActivityDetail() { // 获取活动详情
122 125
     fetch({
123 126
       url: $api.activity.detail.url.replace(':id', this.data.Id),
124 127
       method: $api.activity.detail.method
125 128
     }).then((res) => {
126 129
       if (res.code === 200) {
127
-        console.log(res.data)
128 130
         this.setData({
129 131
           ActivityDetail: {
130 132
             Title: res.data.title,

+ 2
- 2
pages/ActivityDetail/index.wxml Voir le fichier

@@ -52,7 +52,7 @@
52 52
                 <!-- 评论图片列表 -->
53 53
                 <view class="imgList">
54 54
                   <view wx:for="{{item.ImgList}}" wx:for-item="subItem" wx:for-index="subIdx" wx:key="subKey">
55
-                    <image mode="aspectFit" src="{{subItem}}" class="centerLabel contain"></image>
55
+                    <image mode="aspectFit" src="{{subItem.imgUrl}}" class="centerLabel contain"></image>
56 56
                   </view>
57 57
                 </view>
58 58
 
@@ -73,7 +73,7 @@
73 73
                     <!-- 评论图片列表 -->
74 74
                     <view class="imgList">
75 75
                       <view wx:for="{{subItem.ImgList}}" wx:for-item="dSubItem" wx:for-index="dSubIdx" wx:key="dSubKey">
76
-                        <image mode="aspectFit" src="{{dSubItem}}" class="centerLabel contain"></image>
76
+                        <image mode="aspectFit" src="{{dSubItem.imgUrl}}" class="centerLabel contain"></image>
77 77
                       </view>
78 78
                     </view>
79 79