|
@@ -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
|
})
|