zjxpcyc 6 年之前
父節點
當前提交
8051fdaf02
共有 3 個文件被更改,包括 57 次插入46 次删除
  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 查看文件

17
     update: {
17
     update: {
18
       method: 'PUT',
18
       method: 'PUT',
19
       url: `${BaseAPIURl}wx/user`
19
       url: `${BaseAPIURl}wx/user`
20
+<<<<<<< HEAD
20
     },
21
     },
21
     appointment: {
22
     appointment: {
22
       method: 'GET',
23
       method: 'GET',
29
     building: {
30
     building: {
30
       method: 'GET',
31
       method: 'GET',
31
       url: `${BaseAPIURl}wx/collection/:openid`
32
       url: `${BaseAPIURl}wx/collection/:openid`
33
+=======
34
+>>>>>>> 5c1f000d3d23edddccfbdceb0974cdc69e7bd0ce
32
     }
35
     }
33
   },
36
   },
34
   dict: {
37
   dict: {
35
     list: {
38
     list: {
36
       methods: 'GET',
39
       methods: 'GET',
37
-      url: `${BaseAPIURl}dict`
40
+      url: `${BaseAPIURl}/dict`
38
     }
41
     }
39
   },
42
   },
40
   banner: {
43
   banner: {
50
     },
53
     },
51
     detail: {
54
     detail: {
52
       method: 'GET',
55
       method: 'GET',
53
-      url: `${BaseAPIURl}wx/buildingSelectId/:id`
56
+      url: `${BaseAPIURl}/wx/buildingSelectId/:id`
54
     }
57
     }
55
   },
58
   },
56
   dynamic: { // 项目
59
   dynamic: { // 项目
76
   appointment: {
79
   appointment: {
77
     getByUser: {
80
     getByUser: {
78
       method: 'GET',
81
       method: 'GET',
79
-      url: `${BaseAPIURl}wx/appointment/:openid`
82
+      url: `${BaseAPIURl}/wx/appointment/:openid`
80
     },
83
     },
81
     save: {
84
     save: {
82
       method: 'POST',
85
       method: 'POST',
83
-      url: `${BaseAPIURl}wx/appointment/:openid`
86
+      url: `${BaseAPIURl}/wx/appointment/:openid`
84
     }
87
     }
85
   },
88
   },
86
   collection: {
89
   collection: {
87
     getByUser: {
90
     getByUser: {
88
       method: 'GET',
91
       method: 'GET',
89
-      url: `${BaseAPIURl}wx/collection/:openid`
92
+      url: `${BaseAPIURl}/wx/collection/:openid`
90
     },
93
     },
91
     save: {
94
     save: {
92
       method: 'POST',
95
       method: 'POST',
93
-      url: `${BaseAPIURl}wx/collection/:openid`
96
+      url: `${BaseAPIURl}/wx/collection/:openid`
94
     },
97
     },
95
     deleteById: {
98
     deleteById: {
96
       method: 'DELETE',
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
 module.exports = {
149
 module.exports = {
141
   $api: $api,
150
   $api: $api,
142
   get: get,
151
   get: get,
143
-}
152
+}

+ 38
- 36
pages/ActivityDetail/index.js 查看文件

39
       CreateDate: '2019-02-02',
39
       CreateDate: '2019-02-02',
40
       Content: ''
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
   onReady() {
44
   onReady() {
79
     if (this.data.Type === 1) {
45
     if (this.data.Type === 1) {
80
       this.GetProjectDetail()
46
       this.GetProjectDetail()
81
     } else {
47
     } else {
82
       this.GetActivityDetail()
48
       this.GetActivityDetail()
49
+      this.GetCommentList()
83
     }
50
     }
84
   },
51
   },
85
   AddComment() { // 添加评论
52
   AddComment() { // 添加评论
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
   GetActivityDetail() { // 获取活动详情
124
   GetActivityDetail() { // 获取活动详情
122
     fetch({
125
     fetch({
123
       url: $api.activity.detail.url.replace(':id', this.data.Id),
126
       url: $api.activity.detail.url.replace(':id', this.data.Id),
124
       method: $api.activity.detail.method
127
       method: $api.activity.detail.method
125
     }).then((res) => {
128
     }).then((res) => {
126
       if (res.code === 200) {
129
       if (res.code === 200) {
127
-        console.log(res.data)
128
         this.setData({
130
         this.setData({
129
           ActivityDetail: {
131
           ActivityDetail: {
130
             Title: res.data.title,
132
             Title: res.data.title,

+ 2
- 2
pages/ActivityDetail/index.wxml 查看文件

52
                 <!-- 评论图片列表 -->
52
                 <!-- 评论图片列表 -->
53
                 <view class="imgList">
53
                 <view class="imgList">
54
                   <view wx:for="{{item.ImgList}}" wx:for-item="subItem" wx:for-index="subIdx" wx:key="subKey">
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
                   </view>
56
                   </view>
57
                 </view>
57
                 </view>
58
 
58
 
73
                     <!-- 评论图片列表 -->
73
                     <!-- 评论图片列表 -->
74
                     <view class="imgList">
74
                     <view class="imgList">
75
                       <view wx:for="{{subItem.ImgList}}" wx:for-item="dSubItem" wx:for-index="dSubIdx" wx:key="dSubKey">
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
                       </view>
77
                       </view>
78
                     </view>
78
                     </view>
79
 
79