许成详 6 anni fa
parent
commit
8008f73f23

+ 1
- 1
config/api.js Vedi File

@@ -116,7 +116,7 @@ const $api = {
116 116
     },
117 117
     add: { // 添加评论
118 118
       method: 'POST',
119
-      url: `${BaseAPIURl}/comment/add`
119
+      url: `${BaseAPIURl}comment/add`
120 120
     }
121 121
   },
122 122
   uploadImage: { // 图片上传

+ 1
- 0
pages/ActivityDetail/comment.js Vedi File

@@ -20,6 +20,7 @@ Page({
20 20
         customerId: app.globalData.UserInfo.customerId
21 21
       }
22 22
     })
23
+    console.log(this.data.FormData.customerId)
23 24
   },
24 25
   data: {
25 26
     Id: '',

+ 64
- 12
pages/ActivityDetail/index.js Vedi File

@@ -7,6 +7,7 @@ const $api = require('../../config/api.js').$api
7 7
 
8 8
 Page({
9 9
   onShow() {
10
+    this.PageReset()
10 11
     if (this.data.Type === 1) {
11 12
       this.GetProjectDetail()
12 13
     } else {
@@ -18,7 +19,11 @@ Page({
18 19
   onLoad(e) {
19 20
     this.setData({
20 21
       Id: e.id,
21
-      Type: e.type - 0
22
+      Type: e.type - 0,
23
+      FormData: {
24
+        ...this.data.FormData,
25
+        activityId: e.id
26
+      }
22 27
     })
23 28
     if (e.type - 0 === 1) {
24 29
       wx.setNavigationBarTitle({
@@ -31,6 +36,7 @@ Page({
31 36
     }
32 37
   },
33 38
   data: {
39
+    HasSignUp: false,
34 40
     UserInfo: app.globalData.UserInfo,
35 41
     Id: null,
36 42
     Type: null,
@@ -43,9 +49,9 @@ Page({
43 49
     },
44 50
     SubmitOff: true,
45 51
     ActivityDetail: {
46
-      Title: '示例标题',
47
-      Publisher: '示例发布人',
48
-      CreateDate: '2019-02-02',
52
+      Title: '',
53
+      Publisher: '',
54
+      CreateDate: '',
49 55
       Content: ''
50 56
     },
51 57
     CommentList: []
@@ -53,23 +59,59 @@ Page({
53 59
   onReady() {
54 60
 
55 61
   },
56
-  GetSignUpList() {
62
+  PageReset() {
63
+    this.setData({
64
+      ActivityDetail: {
65
+        Title: '',
66
+        Publisher: '',
67
+        CreateDate: '',
68
+        Content: ''
69
+      },
70
+      CommentList: [],
71
+      SubmitOff: true,
72
+      ShowPopup: false
73
+    })
74
+  },
75
+  GetSignUpList() { // 获取报名情况
57 76
     fetch({
58 77
       url: $api.user.signUpList.url.replace(':openid', app.globalData.UserInfo.openid) + '?pageNum=1&pageSize=10000',
59 78
       method: $api.user.signUpList.method
60 79
     }).then((res) => {
61
-      console.log(res)
80
+      if (res.code === 200) {
81
+        res.data.records.map((item) => {
82
+          if (item.activityId === this.data.FormData.activityId) {
83
+            this.setData({
84
+              HasSignUp: true
85
+            })
86
+            return
87
+          }
88
+        })
89
+      }
62 90
     })
63 91
   },
64 92
   AddComment() { // 添加评论
65
-    wx.navigateTo({
66
-      url: '/pages/ActivityDetail/comment?id=' + this.data.Id
67
-    })
93
+    if (app.globalData.UserInfo.avatar === '' && app.globalData.UserInfo.name === '') {
94
+      wx.navigateTo({
95
+        url: '/pages/index/index?index=3'
96
+      })
97
+    } else {
98
+      wx.navigateTo({
99
+        url: '/pages/ActivityDetail/comment?id=' + this.data.Id
100
+      })
101
+    }
68 102
   },
69 103
   ShowSignUpPopup() { // 打开报名弹窗
70
-    this.setData({
71
-      ShowPopup: true
72
-    })
104
+    if (app.globalData.UserInfo.avatar === '' && app.globalData.UserInfo.name === '') {
105
+      wx.navigateTo({
106
+        url: '/pages/index/index?index=3'
107
+      })
108
+    } else {
109
+      if (!this.data.HasSignUp) {
110
+        this.setData({
111
+          ShowPopup: true
112
+        })
113
+      }
114
+    }
73 115
   },
74 116
   ClosePopup() { // 关闭报名弹窗
75 117
     this.setData({
@@ -160,6 +202,7 @@ Page({
160 202
             Content: item.commentContent,
161 203
             ImgList: item.commentImgList,
162 204
             LikeNum: '0',
205
+            ParentId: item.parentId,
163 206
             Childs: []
164 207
           })
165 208
           let aChild = []
@@ -174,6 +217,15 @@ Page({
174 217
           })
175 218
           CommentList[index].Childs = aChild
176 219
         })
220
+        let aArr = []
221
+        CommentList.map((item, index) => {
222
+          if (item.ParentId !== '') {
223
+            aArr.unshift(index)
224
+          }
225
+        })
226
+        aArr.map((item) => {
227
+          CommentList.splice(item - 0, 1)
228
+        })
177 229
         this.setData({
178 230
           CommentList: CommentList
179 231
         })

+ 1
- 1
pages/ActivityDetail/index.wxml Vedi File

@@ -92,7 +92,7 @@
92 92
   </view>
93 93
   <view class="SignUp" hidden="{{Type !== 2}}">
94 94
     <view>
95
-      <text bindtap="ShowSignUpPopup">我要报名</text>
95
+      <text bindtap="ShowSignUpPopup">{{HasSignUp ? '已报名' : '我要报名'}}</text>
96 96
     </view>
97 97
   </view>
98 98
 

+ 10
- 2
pages/components/Concessions/index.js Vedi File

@@ -21,17 +21,25 @@ Component({
21 21
     ListB: [],
22 22
     PostDataA: {
23 23
       PageNum: 1,
24
-      PageSize: 15
24
+      PageSize: 10000
25 25
     },
26 26
     PostDataB: {
27 27
       PageNum: 1,
28
-      PageSize: 15
28
+      PageSize: 10000
29 29
     }
30 30
   },
31 31
   lifetimes: {},
32 32
   ready: function() {
33 33
     this.GetProjectList()
34 34
     this.GetActivityList()
35
+    let _self = this
36
+    wx.getSystemInfo({
37
+      success(res) {
38
+        _self.setData({
39
+          WindowHeight: res.windowHeight
40
+        })
41
+      }
42
+    })
35 43
   },
36 44
   pageLifetimes: {
37 45
     show: function() {},

+ 8
- 0
pages/components/Concessions/index.wxss Vedi File

@@ -1,6 +1,14 @@
1 1
 /**index.wxss**/
2 2
 @import '../../../app.wxss';
3 3
 
4
+.SubContainer {
5
+  min-height: 100%;
6
+  overflow-y: scroll;
7
+  -webkit-overflow-scrolling: touch;
8
+  transform: translateZ(0);
9
+  -webkit-transform: translateZ(0);
10
+}
11
+
4 12
 .nav {
5 13
   width: 100%;
6 14
   position: relative;

+ 1
- 1
pages/components/ConcessionsListItem/index.wxml Vedi File

@@ -1,7 +1,7 @@
1 1
 <!--index.wxml-->
2 2
 <view class="component flex-h">
3 3
   <view class="img">
4
-    <image mode="widthFix" src="{{Params.Img}}" class="centerLabel cover"></image>
4
+    <image mode="aspectFill" src="{{Params.Img}}" class="centerLabel cover"></image>
5 5
   </view>
6 6
   <view class="flex-item">
7 7
     <text class="title">{{Params.Title}}</text>

+ 5
- 0
pages/index/index.js Vedi File

@@ -3,6 +3,11 @@
3 3
 const app = getApp()
4 4
 
5 5
 Page({
6
+  onLoad(e) {
7
+    this.setData({
8
+      NavActiveIndex: e.index || 0
9
+    })
10
+  },
6 11
   data: {
7 12
     UserInfo: app.globalData.UserInfo,
8 13
     NavList: [{ // navlist数据

+ 4
- 0
pages/index/index.wxss Vedi File

@@ -17,6 +17,10 @@
17 17
   -webkit-transform: translateZ(0);
18 18
 }
19 19
 
20
+.CutContent > view > view {
21
+  min-height: 100%;
22
+}
23
+
20 24
 .foot {
21 25
   background: #fff;
22 26
   position: relative;