Browse Source

静态页面

xcx 4 years ago
parent
commit
33530baf69

+ 9
- 0
src/pages.js View File

@@ -132,6 +132,15 @@ const Activity = [
132 132
       eventType: 'activity',
133 133
     }
134 134
   },
135
+  {
136
+    name: '活动-活动签到',
137
+    page: 'pages/HuoDong/HuoDongSign/index',
138
+    auth: ['avatar', 'phone'],
139
+    track: {
140
+      event: 'detail',
141
+      eventType: 'activity',
142
+    }
143
+  },
135 144
   {
136 145
     name: '活动-资讯详情',
137 146
     page: 'pages/HuoDong/ZiXunDetail/index',

+ 28
- 24
src/pages/HuoDong/HuoDongDetail/index.jsx View File

@@ -91,31 +91,35 @@ export default function HuoDongDetail () {
91 91
   const ToJoin = () => { // 去报名
92 92
     if (DataLock || ActivityDetail === null || !JoinBtnStatus) return
93 93
     setDataLock(true)
94
-    const { personId, phone, nickname, orgId } = user
95
-    const { dynamicId } = ActivityDetail
96
-    if (!phone) { // 未授权手机号,唤起授权手机号弹窗
97
-      setShowGetUserPhoneLayer(true)
98
-      setDataLock(false)
99
-      return false
100
-    }
101
-    let Data = {
102
-      phone,
103
-      personId,
104
-      dynamicId,
105
-      name: nickname,
106
-      orgId,
107
-      attendNum: 1,
108
-      sharePerson: null,
109
-      sharePersonName: null,
110
-      sharePersonType: null
94
+    if (JoinBtnText === '去签到') {
95
+      Taro.navigateTo({ url: `/pages/HuoDong/HuoDongSign/index?id=${ActivityDetail.dynamicId}` })
96
+    } else {
97
+      const { personId, phone, nickname, orgId } = user
98
+      const { dynamicId } = ActivityDetail
99
+      if (!phone) { // 未授权手机号,唤起授权手机号弹窗
100
+        setShowGetUserPhoneLayer(true)
101
+        setDataLock(false)
102
+        return false
103
+      }
104
+      let Data = {
105
+        phone,
106
+        personId,
107
+        dynamicId,
108
+        name: nickname,
109
+        orgId,
110
+        attendNum: 1,
111
+        sharePerson: null,
112
+        sharePersonName: null,
113
+        sharePersonType: null
114
+      }
115
+      request({ ...apis.JoinActivity, data: { ...Data } }).then(() => {
116
+        setHasJoin(true)
117
+        setDataLock(false)
118
+      }).catch((res) => {
119
+        Taro.showToast({ title: res, icon: 'none' })
120
+        setDataLock(false)
121
+      })
111 122
     }
112
-    request({ ...apis.JoinActivity, data: { ...Data } }).then(() => {
113
-      setHasJoin(true)
114
-      setDataLock(false)
115
-    }).catch((res) => {
116
-      Taro.showToast({ title: res, icon: 'none' })
117
-      setDataLock(false)
118
-    })
119 123
   }
120 124
 
121 125
   const showError = err => {

+ 3
- 0
src/pages/HuoDong/HuoDongSign/index.config.js View File

@@ -0,0 +1,3 @@
1
+export default {
2
+  navigationBarTitleText: '活动签到'
3
+}

+ 77
- 0
src/pages/HuoDong/HuoDongSign/index.css View File

@@ -0,0 +1,77 @@
1
+.HuoDongSign {
2
+  width: 100%;
3
+  min-height: 100vh;
4
+  position: relative;
5
+}
6
+.HuoDongSign > image {
7
+  width: 100%;
8
+  height: auto;
9
+  display: block;
10
+  position: relative;
11
+  z-index: 1;
12
+}
13
+.HuoDongSign > .SignBtn {
14
+  width: 188px;
15
+  height: 188px;
16
+  position: absolute;
17
+  overflow: visible;
18
+  z-index: 2;
19
+  left: 50%;
20
+  bottom: 300px;
21
+  margin-left: -94px;
22
+}
23
+.HuoDongSign > .SignBtn::after {
24
+  content: '';
25
+  display: block;
26
+  width: 226px;
27
+  height: 226px;
28
+  position: absolute;
29
+  left: 50%;
30
+  top: 50%;
31
+  transform: translate(-50%, -50%);
32
+  -webkit-transform: translate(-50%, -50%);
33
+  background: rgba(255, 255, 255, 0.3);
34
+  border-radius: 100%;
35
+  z-index: 2;
36
+}
37
+.HuoDongSign > .SignBtn::before {
38
+  content: '';
39
+  display: block;
40
+  width: 264px;
41
+  height: 264px;
42
+  position: absolute;
43
+  left: 50%;
44
+  top: 50%;
45
+  transform: translate(-50%, -50%);
46
+  -webkit-transform: translate(-50%, -50%);
47
+  background: rgba(255, 255, 255, 0.3);
48
+  border-radius: 100%;
49
+  z-index: 1;
50
+}
51
+.HuoDongSign > .SignBtn.active::after {
52
+  background: rgba(243, 88, 68, 0.3);
53
+}
54
+.HuoDongSign > .SignBtn.active::before {
55
+  background: rgba(243, 88, 68, 0.3);
56
+}
57
+.HuoDongSign > .SignBtn.active > view {
58
+  background: #f35844;
59
+}
60
+.HuoDongSign > .SignBtn.active > view > text {
61
+  color: #fff;
62
+}
63
+.HuoDongSign > .SignBtn > view {
64
+  width: 100%;
65
+  height: 100%;
66
+  position: relative;
67
+  z-index: 3;
68
+  border-radius: 100%;
69
+  background: #ffffff;
70
+}
71
+.HuoDongSign > .SignBtn > view > text {
72
+  font-size: 44px;
73
+  color: #999;
74
+  width: 100%;
75
+  white-space: nowrap;
76
+  text-align: center;
77
+}

+ 41
- 0
src/pages/HuoDong/HuoDongSign/index.jsx View File

@@ -0,0 +1,41 @@
1
+import React, { useState } from 'react'
2
+import Taro, { Current } from '@tarojs/taro'
3
+import request, { apis } from '@/utils/request'
4
+import Page from '@/layouts'
5
+import '@/assets/css/reset.less'
6
+import '@/assets/css/iconfont.less'
7
+import './index.less'
8
+
9
+export default function HuoDongDetail () {
10
+
11
+  const [DataLock, setDataLock] = useState(false)
12
+  const [HasSign, setHasSign] = useState(false)
13
+  const [CurrnetId] = useState(Current.router.params.id) // 当前活动id
14
+
15
+  const ToSign = () => {
16
+    if (!DataLock) {
17
+      setDataLock(true)
18
+      request({ ...apis.activitySign, args: { id: CurrnetId } }).then(() => {
19
+        Taro.showToast({ title: '签到成功', icon: 'none' })
20
+        setDataLock(false)
21
+        setHasSign(true)
22
+      }).catch((res) => {
23
+        Taro.showToast({ title: res, icon: 'none' })
24
+        setDataLock(false)
25
+      })
26
+    }
27
+  }
28
+
29
+  return (
30
+    <Page>
31
+      <view className='HuoDongSign'>
32
+        <image mode='widthFix' src={null}></image>
33
+        <view className={HasSign ? 'SignBtn' : 'SignBtn active'}>
34
+          <view>
35
+            <text className='centerLabel' onClick={ToSign}>{HasSign ? '已签到' : '签到'}</text>
36
+          </view>
37
+        </view>
38
+      </view>
39
+    </Page>
40
+  )
41
+}

+ 89
- 0
src/pages/HuoDong/HuoDongSign/index.less View File

@@ -0,0 +1,89 @@
1
+.HuoDongSign {
2
+  width: 100%;
3
+  min-height: 100vh;
4
+  position: relative;
5
+
6
+  >image {
7
+    width: 100%;
8
+    height: auto;
9
+    display: block;
10
+    position: relative;
11
+    z-index: 1;
12
+  }
13
+
14
+  >.SignBtn {
15
+    width: 188px;
16
+    height: 188px;
17
+    position: absolute;
18
+    overflow: visible;
19
+    z-index: 2;
20
+    left: 50%;
21
+    bottom: 300px;
22
+    margin-left: -94px;
23
+
24
+    &::after {
25
+      content: '';
26
+      display: block;
27
+      width: 226px;
28
+      height: 226px;
29
+      position: absolute;
30
+      left: 50%;
31
+      top: 50%;
32
+      transform: translate(-50%, -50%);
33
+      -webkit-transform: translate(-50%, -50%);
34
+      background: rgba(255, 255, 255, 0.3);
35
+      border-radius: 100%;
36
+      z-index: 2;
37
+    }
38
+
39
+    &::before {
40
+      content: '';
41
+      display: block;
42
+      width: 264px;
43
+      height: 264px;
44
+      position: absolute;
45
+      left: 50%;
46
+      top: 50%;
47
+      transform: translate(-50%, -50%);
48
+      -webkit-transform: translate(-50%, -50%);
49
+      background: rgba(255, 255, 255, 0.3);
50
+      border-radius: 100%;
51
+      z-index: 1;
52
+    }
53
+
54
+    &.active {
55
+
56
+      &::after {
57
+        background: rgba(243, 88, 68, 0.3);
58
+      }
59
+
60
+      &::before {
61
+        background: rgba(243, 88, 68, 0.3);
62
+      }
63
+
64
+      >view {
65
+        background: rgba(243, 88, 68, 1);
66
+        >text {
67
+          color: #fff;
68
+        }
69
+      }
70
+    }
71
+
72
+    >view {
73
+      width: 100%;
74
+      height: 100%;
75
+      position: relative;
76
+      z-index: 3;
77
+      border-radius: 100%;
78
+      background: rgba(255, 255, 255, 1);
79
+
80
+      >text {
81
+        font-size: 44px;
82
+        color: #999;
83
+        width: 100%;
84
+        white-space: nowrap;
85
+        text-align: center;
86
+      }
87
+    }
88
+  }
89
+}

+ 4
- 0
src/utils/api.js View File

@@ -1,6 +1,10 @@
1 1
 const prefix = `${HOST}/api/wx`
2 2
 
3 3
 const $api = {
4
+  activitySign: { // 活动签到
5
+    method: 'put',
6
+    url: `${prefix}/buildingDynamicCheckin/:id`
7
+  },
4 8
   getIndexAdv: { // 获取首页广告
5 9
     method: 'get',
6 10
     url: `${prefix}/extendContent`