|
@@ -1,12 +1,8 @@
|
1
|
1
|
import { useState, useEffect } from "react";
|
2
|
2
|
import Taro from "@tarojs/taro";
|
3
|
3
|
import withLayout from "@/layout";
|
4
|
|
-import {
|
5
|
|
- ScrollView,
|
6
|
|
- Image,
|
7
|
|
- RichText,
|
8
|
|
-} from "@tarojs/components";
|
9
|
|
-import Disclaimer from '@/components/Disclaimer'
|
|
4
|
+import { ScrollView, Image, RichText } from "@tarojs/components";
|
|
5
|
+import Disclaimer from "@/components/Disclaimer";
|
10
|
6
|
|
11
|
7
|
import {
|
12
|
8
|
// addActivityShareNum,
|
|
@@ -15,36 +11,40 @@ import {
|
15
|
11
|
} from "@/services/activity";
|
16
|
12
|
import { getImgURL } from "@/utils/image";
|
17
|
13
|
import getDateFormat from "@/utils/chatDate";
|
18
|
|
-import useParams from '@/utils/hooks/useParams'
|
19
|
|
-import useShare from '@/utils/hooks/useShare'
|
20
|
|
-import useFavor from '@/utils/hooks/useFavor'
|
|
14
|
+import useParams from "@/utils/hooks/useParams";
|
|
15
|
+import useShare from "@/utils/hooks/useShare";
|
|
16
|
+import useFavor from "@/utils/hooks/useFavor";
|
21
|
17
|
|
22
|
18
|
import "./index.scss";
|
23
|
19
|
|
24
|
20
|
const activityStatusDict = {
|
25
|
21
|
0: {
|
26
|
22
|
text: "立即参与",
|
|
23
|
+ text1: "立即参团",
|
27
|
24
|
className: "yellow",
|
28
|
25
|
},
|
29
|
26
|
1: {
|
30
|
27
|
text: "未开始",
|
|
28
|
+ text1: "未开始",
|
31
|
29
|
className: "blue",
|
32
|
30
|
},
|
33
|
31
|
2: {
|
34
|
32
|
text: "已结束",
|
|
33
|
+ text1: "已结束",
|
35
|
34
|
className: "grey",
|
36
|
35
|
},
|
37
|
36
|
3: {
|
38
|
37
|
text: "已参与",
|
|
38
|
+ text1: "已结束",
|
39
|
39
|
className: "yellow",
|
40
|
40
|
},
|
41
|
41
|
};
|
42
|
42
|
|
43
|
43
|
export default withLayout((props) => {
|
44
|
|
- const { router, shareContent, trackData, person, page } = props
|
|
44
|
+ const { router, shareContent, trackData, person, page } = props;
|
45
|
45
|
const { id } = router.params;
|
46
|
46
|
const [detail, setDetail] = useState();
|
47
|
|
- const buildingId = detail?.buildingId
|
|
47
|
+ const buildingId = detail?.buildingId;
|
48
|
48
|
|
49
|
49
|
const getDetail = (params) => {
|
50
|
50
|
Taro.showLoading();
|
|
@@ -58,11 +58,20 @@ export default withLayout((props) => {
|
58
|
58
|
};
|
59
|
59
|
|
60
|
60
|
// 本页面分享或者海报参数
|
61
|
|
- const paramsRef = useParams({id, buildingId, person, from: `${page.type}_share`})
|
|
61
|
+ const paramsRef = useParams({
|
|
62
|
+ id,
|
|
63
|
+ buildingId,
|
|
64
|
+ person,
|
|
65
|
+ from: `${page.type}_share`,
|
|
66
|
+ });
|
|
67
|
+
|
|
68
|
+ const fullTrackData = { ...trackData, buildingId };
|
62
|
69
|
|
63
|
|
- const fullTrackData = { ...trackData, buildingId }
|
64
|
|
-
|
65
|
|
- const [isSaved, handleFavor] = useFavor(detail?.isSaved, { id, buildingId, ...trackData })
|
|
70
|
+ const [isSaved, handleFavor] = useFavor(detail?.isSaved, {
|
|
71
|
+ id,
|
|
72
|
+ buildingId,
|
|
73
|
+ ...trackData,
|
|
74
|
+ });
|
66
|
75
|
|
67
|
76
|
useShare(
|
68
|
77
|
{
|
|
@@ -70,8 +79,8 @@ export default withLayout((props) => {
|
70
|
79
|
path: `${router.path}?${paramsRef.current}`,
|
71
|
80
|
image: shareContent.shareContentImg || getImgURL(detail?.imgUrl),
|
72
|
81
|
},
|
73
|
|
- fullTrackData,
|
74
|
|
- )
|
|
82
|
+ fullTrackData
|
|
83
|
+ );
|
75
|
84
|
|
76
|
85
|
useEffect(() => {
|
77
|
86
|
if (id) {
|
|
@@ -102,107 +111,192 @@ export default withLayout((props) => {
|
102
|
111
|
});
|
103
|
112
|
};
|
104
|
113
|
|
105
|
|
- return <>
|
106
|
|
- { detail && (
|
107
|
|
- <view className="Page activityDetail flex-v">
|
108
|
|
- <view className="flex-item">
|
109
|
|
- <view>
|
110
|
|
- <ScrollView scroll-y>
|
111
|
|
- <view className="PageContent">
|
112
|
|
- <view className="Top">
|
113
|
|
- <Image
|
114
|
|
- mode="aspectFill"
|
115
|
|
- src={getImgURL(detail.bannerListImg)}
|
116
|
|
- className="centerLabel"
|
117
|
|
- ></Image>
|
118
|
|
- </view>
|
119
|
|
-
|
120
|
|
- <view className="Info">
|
121
|
|
- <view>
|
122
|
|
- <view className="Title flex-h">
|
123
|
|
- <view className="flex-item">
|
124
|
|
- <text>{detail.title}</text>
|
125
|
|
- </view>
|
126
|
|
- <text className="Tips">
|
127
|
|
- {detail.enlisted || 0}人已报名
|
128
|
|
- </text>
|
129
|
|
- </view>
|
130
|
|
- <text className="Time">
|
131
|
|
- 报名截止时间:
|
132
|
|
- {getDateFormat(
|
133
|
|
- new Date(detail.enlistEnd).valueOf(),
|
134
|
|
- true,
|
135
|
|
- "yyyy/M/d"
|
136
|
|
- )}
|
137
|
|
- </text>
|
138
|
|
- {/* <text className="Name">“香颂 · 蔚澜半岛”</text> */}
|
139
|
|
- <view className="flex-h Address">
|
140
|
|
- <text>地址:</text>
|
141
|
|
- <view className="flex-item">
|
142
|
|
- <text>{detail.address}</text>
|
143
|
|
- </view>
|
144
|
|
- </view>
|
145
|
|
- <view className="flex-h Date">
|
146
|
|
- <text>时间:</text>
|
147
|
|
- <view className="flex-item">
|
148
|
|
- <text>
|
149
|
|
- {getDateFormat(
|
150
|
|
- new Date(detail.startDate).valueOf(),
|
151
|
|
- true,
|
152
|
|
- "yyyy/M/d"
|
153
|
|
- )}{" "}
|
154
|
|
- -{" "}
|
155
|
|
- {getDateFormat(
|
156
|
|
- new Date(detail.endDate).valueOf(),
|
157
|
|
- true,
|
158
|
|
- "yyyy/M/d"
|
159
|
|
- )}
|
160
|
|
- </text>
|
161
|
|
- </view>
|
162
|
|
- </view>
|
163
|
|
- <view className="Btn">
|
164
|
|
- <text>分享好友</text>
|
165
|
|
- </view>
|
166
|
|
- </view>
|
167
|
|
- </view>
|
168
|
|
-
|
169
|
|
- <view className="ActivityIntro">
|
170
|
|
- <view className="Title">
|
171
|
|
- <text>活动介绍</text>
|
172
|
|
- </view>
|
173
|
|
- <Image
|
174
|
|
- mode="aspectFill"
|
175
|
|
- src={getImgURL(detail.imgUrl)}
|
176
|
|
- className="img"
|
177
|
|
- ></Image>
|
178
|
|
- <RichText nodes={detail.desc} />
|
179
|
|
- {/* <richText nodes={detail.desc} ></richText> */}
|
180
|
|
- </view>
|
|
114
|
+ const dymic = () => (
|
|
115
|
+ <view className="Info">
|
|
116
|
+ <view>
|
|
117
|
+ <view className="Title flex-h">
|
|
118
|
+ <view className="flex-item">
|
|
119
|
+ <text>{detail.halfTitle}</text>
|
|
120
|
+ </view>
|
|
121
|
+ <text className="Tips">{detail.enlisted || 0}人已报名</text>
|
|
122
|
+ </view>
|
|
123
|
+ <text className="Time">
|
|
124
|
+ 报名截止时间:
|
|
125
|
+ {getDateFormat(
|
|
126
|
+ new Date(detail.enlistEnd).valueOf(),
|
|
127
|
+ true,
|
|
128
|
+ "yyyy/M/d"
|
|
129
|
+ )}
|
|
130
|
+ </text>
|
|
131
|
+ <text className="Name">{detail.title}</text>
|
|
132
|
+ <view className="flex-h Address">
|
|
133
|
+ <text>地址:</text>
|
|
134
|
+ <view className="flex-item">
|
|
135
|
+ <text>{detail.address}</text>
|
|
136
|
+ </view>
|
|
137
|
+ </view>
|
|
138
|
+ <view className="flex-h Date">
|
|
139
|
+ <text>时间:</text>
|
|
140
|
+ <view className="flex-item">
|
|
141
|
+ <text>
|
|
142
|
+ {getDateFormat(
|
|
143
|
+ new Date(detail.startDate).valueOf(),
|
|
144
|
+ true,
|
|
145
|
+ "yyyy/M/d"
|
|
146
|
+ )}{" "}
|
|
147
|
+ -{" "}
|
|
148
|
+ {getDateFormat(
|
|
149
|
+ new Date(detail.endDate).valueOf(),
|
|
150
|
+ true,
|
|
151
|
+ "yyyy/M/d"
|
|
152
|
+ )}
|
|
153
|
+ </text>
|
|
154
|
+ </view>
|
|
155
|
+ </view>
|
|
156
|
+ <view className="Btn">
|
|
157
|
+ <button open-type="share">
|
|
158
|
+ <text>分享好友</text>
|
|
159
|
+ </button>
|
|
160
|
+ </view>
|
|
161
|
+ </view>
|
|
162
|
+ </view>
|
|
163
|
+ );
|
181
|
164
|
|
182
|
|
- <Disclaimer />
|
|
165
|
+ const house = () => (
|
|
166
|
+ <view className="houseInfo">
|
|
167
|
+ {/* <view> */}
|
|
168
|
+ <view className="flex-h">
|
|
169
|
+ <view className="left">
|
|
170
|
+ <view className="Title">
|
|
171
|
+ <view className="flex-item">
|
|
172
|
+ <text>{detail.title}</text>
|
|
173
|
+ </view>
|
|
174
|
+ </view>
|
|
175
|
+ <view className="flex-h Address">
|
|
176
|
+ <text className="iconfont icon-dingwei"></text>
|
|
177
|
+ <view className="flex-item">
|
|
178
|
+ <text>{detail.address}</text>
|
183
|
179
|
</view>
|
184
|
|
- </ScrollView>
|
|
180
|
+ <text className="price">价格待定</text>
|
|
181
|
+ </view>
|
|
182
|
+ <text className="flex-h Time">
|
|
183
|
+ 时间:
|
|
184
|
+ {getDateFormat(
|
|
185
|
+ new Date(detail.startDate).valueOf(),
|
|
186
|
+ true,
|
|
187
|
+ "yyyy/M/d"
|
|
188
|
+ )}{" "}
|
|
189
|
+ -{" "}
|
|
190
|
+ {getDateFormat(
|
|
191
|
+ new Date(detail.endDate).valueOf(),
|
|
192
|
+ true,
|
|
193
|
+ "yyyy/M/d"
|
|
194
|
+ )}
|
|
195
|
+ </text>
|
|
196
|
+ </view>
|
|
197
|
+ <view className="right">
|
|
198
|
+ <view>
|
|
199
|
+ <button open-type="share">
|
|
200
|
+ <text className="iconfont icon-fenxiang"></text>
|
|
201
|
+ <text>分享</text>
|
|
202
|
+ </button>
|
|
203
|
+ {/* <text className="iconfont icon-dingwei"></text>
|
|
204
|
+ <text>分享</text> */}
|
|
205
|
+ </view>
|
|
206
|
+ <view>
|
|
207
|
+ <text className="iconfont icon-dingwei"></text>
|
|
208
|
+ <text>海报</text>
|
|
209
|
+ </view>
|
185
|
210
|
</view>
|
186
|
211
|
</view>
|
187
|
|
- <view className="PageBottom flex-h">
|
188
|
|
- <button className="Share" open-type="share">
|
189
|
|
- <text className="iconfont icon-fenxiang"></text>
|
190
|
|
- <text>分享</text>
|
191
|
|
- </button>
|
|
212
|
+
|
|
213
|
+ <view className="lastdate">
|
|
214
|
+ <text className="text">距离结束还有</text>
|
|
215
|
+ <text className="text day">7</text>
|
|
216
|
+ <text className="text">天</text>
|
|
217
|
+ <text className="text time">2</text>
|
|
218
|
+ <text className="text">时</text>
|
|
219
|
+ <text className="text time">4</text>
|
|
220
|
+ <text className="text">分</text>
|
|
221
|
+ <text className="text time">5</text>
|
|
222
|
+ <text className="text">秒</text>
|
|
223
|
+ {/* <view>距离结束还有</view> */}
|
|
224
|
+ </view>
|
|
225
|
+
|
|
226
|
+ <view className="flex-h join">
|
192
|
227
|
<view className="Collect" onClick={handleFavor}>
|
193
|
228
|
<text
|
194
|
229
|
className="iconfont icon-shoucang"
|
195
|
230
|
style={isSaved ? { color: "red" } : undefined}
|
196
|
231
|
></text>
|
197
|
|
- <text>{isSaved ? '已收藏' : '收藏'}</text>
|
|
232
|
+ <text>{isSaved ? "已收藏" : "收藏"}</text>
|
|
233
|
+ </view>
|
|
234
|
+ <view className="enlisted">
|
|
235
|
+ <view>
|
|
236
|
+ <text className="iconfont icon-shoucang"></text>
|
|
237
|
+ <text>{detail.enlisted || 0}人已报名</text>
|
|
238
|
+ </view>
|
|
239
|
+ </view>
|
|
240
|
+ <view className="btn" onClick={handleSignup}>
|
|
241
|
+ <text>{activityStatusDict[detail.activityStatus]?.text1}</text>
|
198
|
242
|
</view>
|
199
|
|
- <view className="flex-item"></view>
|
200
|
|
-
|
201
|
|
- <text className="Post" onClick={handleSignup}>
|
202
|
|
- {activityStatusDict[detail.activityStatus]?.text}
|
203
|
|
- </text>
|
204
|
243
|
</view>
|
|
244
|
+ {/* </view> */}
|
205
|
245
|
</view>
|
206
|
|
- )}
|
207
|
|
- </>
|
|
246
|
+ );
|
|
247
|
+
|
|
248
|
+ return (
|
|
249
|
+ <>
|
|
250
|
+ {detail && (
|
|
251
|
+ <view className="Page activityDetail flex-v">
|
|
252
|
+ <view className="flex-item">
|
|
253
|
+ <view>
|
|
254
|
+ <ScrollView scroll-y>
|
|
255
|
+ <view className="PageContent">
|
|
256
|
+ <view className="Top">
|
|
257
|
+ <Image
|
|
258
|
+ mode="aspectFill"
|
|
259
|
+ src={getImgURL(detail.bannerListImg)}
|
|
260
|
+ className="centerLabel"
|
|
261
|
+ ></Image>
|
|
262
|
+ </view>
|
|
263
|
+
|
|
264
|
+ {detail.type == "dymic" && dymic()}
|
|
265
|
+ {detail.type == "house" && house()}
|
|
266
|
+ <view className="ActivityIntro">
|
|
267
|
+ <view className="Title">
|
|
268
|
+ <text>活动介绍</text>
|
|
269
|
+ </view>
|
|
270
|
+ <RichText nodes={detail.desc} />
|
|
271
|
+ </view>
|
|
272
|
+
|
|
273
|
+ <Disclaimer />
|
|
274
|
+ </view>
|
|
275
|
+ </ScrollView>
|
|
276
|
+ </view>
|
|
277
|
+ </view>
|
|
278
|
+ {detail.type == "dymic" && (
|
|
279
|
+ <view className="PageBottom flex-h">
|
|
280
|
+ <button className="Share" open-type="share">
|
|
281
|
+ <text className="iconfont icon-fenxiang"></text>
|
|
282
|
+ <text>分享</text>
|
|
283
|
+ </button>
|
|
284
|
+ <view className="Collect" onClick={handleFavor}>
|
|
285
|
+ <text
|
|
286
|
+ className="iconfont icon-shoucang"
|
|
287
|
+ style={isSaved ? { color: "red" } : undefined}
|
|
288
|
+ ></text>
|
|
289
|
+ <text>{isSaved ? "已收藏" : "收藏"}</text>
|
|
290
|
+ </view>
|
|
291
|
+ <view className="flex-item"></view>
|
|
292
|
+
|
|
293
|
+ <text className="Post" onClick={handleSignup}>
|
|
294
|
+ {activityStatusDict[detail.activityStatus]?.text}
|
|
295
|
+ </text>
|
|
296
|
+ </view>
|
|
297
|
+ )}
|
|
298
|
+ </view>
|
|
299
|
+ )}
|
|
300
|
+ </>
|
|
301
|
+ );
|
208
|
302
|
});
|