|
@@ -1,7 +1,7 @@
|
1
|
1
|
import { useState, useEffect } from "react";
|
2
|
2
|
import Taro from "@tarojs/taro";
|
3
|
3
|
import withLayout from "@/layout";
|
4
|
|
-import { ScrollView, Image, RichText } from "@tarojs/components";
|
|
4
|
+import { ScrollView, Image, RichText, Button } from "@tarojs/components";
|
5
|
5
|
import Disclaimer from "@/components/Disclaimer";
|
6
|
6
|
|
7
|
7
|
import {
|
|
@@ -14,38 +14,18 @@ import getDateFormat from "@/utils/chatDate";
|
14
|
14
|
import useParams from "@/utils/hooks/useParams";
|
15
|
15
|
import useShare from "@/utils/hooks/useShare";
|
16
|
16
|
import useFavor from "@/utils/hooks/useFavor";
|
|
17
|
+import useStatus from './useStatus'
|
17
|
18
|
|
18
|
19
|
import "./index.scss";
|
19
|
20
|
|
20
|
|
-const activityStatusDict = {
|
21
|
|
- 0: {
|
22
|
|
- text: "立即参与",
|
23
|
|
- text1: "立即参团",
|
24
|
|
- className: "yellow",
|
25
|
|
- },
|
26
|
|
- 1: {
|
27
|
|
- text: "未开始",
|
28
|
|
- text1: "未开始",
|
29
|
|
- className: "blue",
|
30
|
|
- },
|
31
|
|
- 2: {
|
32
|
|
- text: "已结束",
|
33
|
|
- text1: "已结束",
|
34
|
|
- className: "grey",
|
35
|
|
- },
|
36
|
|
- 3: {
|
37
|
|
- text: "已参与",
|
38
|
|
- text1: "已结束",
|
39
|
|
- className: "yellow",
|
40
|
|
- },
|
41
|
|
-};
|
42
|
|
-
|
43
|
21
|
export default withLayout((props) => {
|
44
|
22
|
const { router, shareContent, trackData, person, page } = props;
|
45
|
23
|
const { id } = router.params;
|
46
|
24
|
const [detail, setDetail] = useState();
|
47
|
25
|
const buildingId = detail?.buildingId;
|
48
|
26
|
|
|
27
|
+ const [btnText, btnDisabled] = useStatus(detail)
|
|
28
|
+
|
49
|
29
|
const getDetail = (params) => {
|
50
|
30
|
Taro.showLoading();
|
51
|
31
|
|
|
@@ -237,9 +217,9 @@ export default withLayout((props) => {
|
237
|
217
|
<text>{detail.enlisted || 0}人已报名</text>
|
238
|
218
|
</view>
|
239
|
219
|
</view>
|
240
|
|
- <view className="btn" onClick={handleSignup}>
|
241
|
|
- <text>{activityStatusDict[detail.activityStatus]?.text1}</text>
|
242
|
|
- </view>
|
|
220
|
+ <button className="btn" disabled={btnDisabled} onClick={handleSignup}>
|
|
221
|
+ <text>{btnText}</text>
|
|
222
|
+ </button>
|
243
|
223
|
</view>
|
244
|
224
|
{/* </view> */}
|
245
|
225
|
</view>
|
|
@@ -290,9 +270,9 @@ export default withLayout((props) => {
|
290
|
270
|
</view>
|
291
|
271
|
<view className="flex-item"></view>
|
292
|
272
|
|
293
|
|
- <text className="Post" onClick={handleSignup}>
|
294
|
|
- {activityStatusDict[detail.activityStatus]?.text}
|
295
|
|
- </text>
|
|
273
|
+ <button disabled={btnDisabled} className="Post" onClick={handleSignup}>
|
|
274
|
+ {btnText}
|
|
275
|
+ </button>
|
296
|
276
|
</view>
|
297
|
277
|
)}
|
298
|
278
|
</view>
|