Browse Source

helpgrouplist

许静 5 years ago
parent
commit
b7c1e85a23

BIN
dist.rar View File


+ 70
- 219
src/components/Poster/index.js View File

1
 import Taro, { Component } from '@tarojs/taro';
1
 import Taro, { Component } from '@tarojs/taro';
2
+import { ScrollView, View } from '@tarojs/components';
2
 import { TaroCanvasDrawer } from '@components/taro-plugin-canvas';
3
 import { TaroCanvasDrawer } from '@components/taro-plugin-canvas';
3
-import dayjs from 'dayjs'
4
-import './index.scss'
5
-import {getCanvasConfig} from './util'
6
-/**
7
- * 文档参考
8
- * http://taro-ext.jd.com/plugin/view/5d23051670a0f46a87c9785b
9
- */
10
-export default class Index extends Component {
11
-  static options = {
12
-    addGlobalClass: true
13
-  }
14
-  static defaultProps = {
15
-    data: {}
16
-  }
4
+import {} from './util';
5
+import './style.scss';
6
+
7
+export default class Poster extends Component {
17
   state = {
8
   state = {
18
-    // 绘制的图片
19
-    shareImage: null,
20
-    canvasStatus: false,
21
-    config: null,
22
-    visible: false,
23
-    basicConfig: {
24
-      width: 640,
25
-      height: 1136,
26
-      backgroundColor: '#ffffff',
27
-      debug: false
28
-    }
9
+    images: [],
10
+    current: undefined,
29
   }
11
   }
30
-  componentWillMount() {
31
-    // this.initConfig()
32
-    getCanvasConfig()
33
-    Taro.showLoading({
34
-      title: '生成中...',
35
-      icon: 'none'
12
+
13
+  onScroll = (e) => {
14
+    console.log('---onScroll-->', e)
15
+  }
16
+  
17
+  onPreview = (e) => {
18
+    e.stopPropagation()
19
+    e.preventDefault()
20
+    Taro.previewImage({
21
+      current: this.state.current,
22
+      urls: this.state.images
36
     })
23
     })
37
   }
24
   }
38
-  initConfig() {
39
-    const { data } = this.props
40
-    const { basicConfig } = this.state
41
-    const texts = [
42
-      {
43
-        x: 30,
44
-        y: 820,
45
-        text: data.buildingName,
46
-        fontSize: 36,
47
-        color: 'black',
48
-        baseLine: 'middle',
49
-        lineNum: 2,
50
-        lineHeight: 48,
51
-        // textAlign: 'center',
52
-        width: 560,
53
-        zIndex: 999
54
-      }, {
55
-        x: 30,
56
-        y: 890,
57
-        text: data.price,
58
-        fontSize: 36,
59
-        color: 'red',
60
-        baseLine: 'middle',
61
-        lineNum: 2,
62
-        lineHeight: 48,
63
-        // textAlign: 'center',
64
-        width: 560,
65
-        zIndex: 999
66
-      },
67
-      {
68
-        x: 30,
69
-        y: 1010,
70
-        text: '长按识别小程序码',
71
-        fontSize: 26,
72
-        color: '#999',
73
-        baseLine: 'middle',
74
-        lineHeight: 48,
75
-        width: 200,
76
-        zIndex: 11
77
-      },
78
-      {
79
-        x: 30,
80
-        y: 1065,
81
-        text: '进入',
82
-        fontSize: 26,
83
-        color: '#999',
84
-        baseLine: 'middle',
85
-        lineHeight: 48,
86
-        width: 50,
87
-        zIndex: 11
88
-      },
89
-      {
90
-        x: 100,
91
-        y: 1065,
92
-        text: '橙蕉',
93
-        fontSize: 28,
94
-        color: 'black',
95
-        baseLine: 'middle',
96
-        lineHeight: 48,
97
-        width: 120,
98
-        zIndex: 11
99
-      },
100
-      {
101
-        x: 240,
102
-        y: 1065,
103
-        text: '报名活动',
104
-        fontSize: 26,
105
-        color: '#999',
106
-        baseLine: 'middle',
107
-        lineHeight: 48,
108
-        width: 150,
109
-        zIndex: 11
110
-      },
111
-    ]
112
-    const images = [
113
-      {
114
-        url: data.poster,
115
-        width: 640,
116
-        height: 670,
117
-        y: 0,
118
-        x: 0
119
-      },
120
-      {
121
-        url: data.qrcode,
122
-        width: 160,
123
-        height: 160,
124
-        y: 950,
125
-        x: 450,
126
-        zIndex: 999
127
-      },
128
-      {
129
-        url: data.avatarurl || require('@assets/default-avatar.png'),
130
-        width: 130,
131
-        height: 130,
132
-        y: 630,
133
-        x: 20,
134
-        borderRadius: 130,
135
-        zIndex: 999
136
-      }
137
-    ]
138
 
25
 
139
-    const blocks = [
140
-      {
141
-        x: 0,
142
-        y: 936,
143
-        width: 640,
144
-        height: 200,
145
-        backgroundColor: 'rgba(248,248,248,1)',
146
-        zIndex: 1
147
-      }
148
-    ]
149
-    const config = Object.assign(basicConfig, { images, blocks, texts })
150
-    this.setState({
151
-      config,
152
-      canvasStatus: true
153
-    })
26
+  onCancel = () => {
27
+    if (typeof this.props.onCancel === 'function') {
28
+      this.props.onCancel()
29
+    }
30
+  }
31
+
32
+  saveToAlbum = () => {
33
+
154
   }
34
   }
155
 
35
 
156
-  onCreateSuccess = (result) => {
36
+  onCreateSuccess = (inx) => (result) => {
37
+    if (inx + 1 === this.props.tpls.length) {
38
+      Taro.hideLoading();
39
+    }
40
+
157
     const { tempFilePath, errMsg } = result;
41
     const { tempFilePath, errMsg } = result;
158
-    Taro.hideLoading();
159
     if (errMsg === 'canvasToTempFilePath:ok') {
42
     if (errMsg === 'canvasToTempFilePath:ok') {
160
       this.setState({
43
       this.setState({
161
         shareImage: tempFilePath,
44
         shareImage: tempFilePath,
164
         visible: true
47
         visible: true
165
       });
48
       });
166
     } else {
49
     } else {
167
-      this.setState({
168
-        canvasStatus: false,
169
-        config: null
170
-      });
171
-      Taro.showToast({ icon: 'none', title: errMsg || '出现错误' });
172
       console.log(errMsg);
50
       console.log(errMsg);
173
-      this.hidePoster()
174
     }
51
     }
175
-  }
176
-
177
-  onPreview(e) {
178
-    e.stopPropagation()
179
-    e.preventDefault()
180
-    Taro.previewImage({
181
-      current: this.state.shareImage,
182
-      urls: [this.state.shareImage]
183
-    })
184
-  }
185
-
186
-  onCreateFail = (error) => {
187
-    console.log(error);
188
-  }
189
 
52
 
190
-  hidePoster(e) {
191
-    Taro.hideLoading();
192
-    this.props.toggle(false)
193
   }
53
   }
194
 
54
 
195
-  // 保存图片至本地
196
-  saveToAlbum = (e) => {
197
-    e.stopPropagation()
198
-    e.preventDefault()
55
+  onCreateFail = (inx) => (err) => {
56
+    if (inx + 1 === this.props.tpls.length) {
57
+      Taro.hideLoading();
58
+    }
199
 
59
 
200
-    Taro.authorize({ scope: "scope.writePhotosAlbum" }).then(res => {
201
-      console.log('auth:', res)
202
-      Taro.saveImageToPhotosAlbum({
203
-        filePath: this.state.shareImage,
204
-      }).then(res => {
205
-        Taro.showToast({
206
-          title: '保存图片成功',
207
-          icon: 'success',
208
-          duration: 2000,
209
-        });
210
-      })
211
-    }).catch(err => {
212
-      console.log('err:', err)
213
-      Taro.showToast({
214
-        title: '未开启相册权限',
215
-        icon: 'none'
216
-      })
217
-    })
60
+    console.err(err);
218
   }
61
   }
219
 
62
 
220
   render() {
63
   render() {
64
+    const {
65
+      images,
66
+      configs
67
+    } = this.state
68
+
221
     return (
69
     return (
222
-      <Block>
223
-        {
224
-          this.state.canvasStatus && (
225
-            <TaroCanvasDrawer
226
-              config={this.state.config}
227
-              onCreateSuccess={this.onCreateSuccess}
228
-              onCreateFail={this.onCreateFail}
229
-            />
230
-          )
231
-        }
70
+      <View className="poster">
71
+        <View className="con">
72
+          <View className="con-head">
73
+            <Text>保存后分享图片</Text>
74
+            <Text className="iconfont icon-buoumaotubiao20" onClick={this.onCancel}></Text>
75
+          </View>
76
+          <View className="con-body">
77
+            {
78
+              images.map((img, inx) => {
79
+                <ScrollView scrollX scrollWithAnimation onScroll={this.onScroll} style="width: 100%" key={`img-${inx}`}>
80
+                  <Image className="result-img" mode="aspectFit" lazy-load src={img} onClick={this.onPreview}></Image>
81
+                </ScrollView>
82
+              })
83
+            }
84
+          </View>
85
+          <Button className="save-btn" onClick={this.saveToAlbum}>保存海报</Button>
86
+        </View>
232
         {
87
         {
233
-          this.state.visible && (
234
-            <View className="poster">
235
-              <View className="con">
236
-                <View className="con-head">
237
-                  <Text>保存后分享图片</Text>
238
-                  <Text className="iconfont icon-buoumaotubiao20" onClick={this.hidePoster}></Text>
239
-                </View>
240
-                <View className="con-body">
241
-                  <Image className="result-img" mode="aspectFit" lazy-load src={this.state.shareImage} onClick={this.onPreview}></Image>
242
-                </View>
243
-                <Button className="save-btn" onClick={this.saveToAlbum}>保存海报</Button>
244
-              </View>
245
-            </View>
88
+          configs && configs.length &&
89
+          (
90
+            configs.map((conf, inx) => {
91
+              <TaroCanvasDrawer
92
+                config={conf}
93
+                onCreateSuccess={this.onCreateSuccess(inx)}
94
+                onCreateFail={this.onCreateFail(inx)}
95
+              />
96
+            })
246
           )
97
           )
247
         }
98
         }
248
-      </Block>
249
-    )
99
+      </View>
100
+    );
250
   }
101
   }
251
-}
102
+}

+ 62
- 0
src/components/Poster/style.scss View File

1
+.poster {
2
+  position: fixed;
3
+  width: 100vw;
4
+  height: 100vh;
5
+  background: rgba(0, 0, 0, 0.6);
6
+  z-index: 999;
7
+  justify-content: space-around;
8
+  display: flex;
9
+  align-items: center;
10
+  flex-direction: column;
11
+  animation: fadeBottomIn 1s ease both;
12
+
13
+  .con {
14
+    position: absolute;
15
+    bottom: 0;
16
+    width: 100%;
17
+    padding: 0 60px;
18
+    background: white;
19
+    margin: 0 auto;
20
+    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
21
+    border-top-left-radius: 20px;
22
+    border-top-right-radius: 20px;
23
+
24
+    &-head {
25
+      display: flex;
26
+      justify-content: space-between;
27
+      align-items: center;
28
+      padding: 20px 0;
29
+      font-size: 32px;
30
+      font-weight: bold;
31
+
32
+      .iconfont {
33
+        font-size: 40px;
34
+        color: #545454;
35
+        font-weight: normal;
36
+      }
37
+    }
38
+
39
+    &-body {
40
+      width: 100%;
41
+      // background: #EAEAEA;
42
+      border-radius: 10px;
43
+      padding: 40px 0;
44
+
45
+      .result-img {
46
+        height: 60vh;
47
+        display: block;
48
+        margin: 0 auto;
49
+      }
50
+    }
51
+  }
52
+
53
+  .save-btn {
54
+    margin: 0 auto;
55
+    color: white;
56
+    border: none;
57
+    font-size: 36px;
58
+    background: linear-gradient(90deg, rgba(255, 199, 12, 1) 0%, rgba(255, 65, 65, 1) 100%);
59
+    border-radius: 12px;
60
+    margin: 20px 0;
61
+  }
62
+}

+ 24
- 24
src/components/achievePhone/index.js View File

2
 import getUserPhone from '@utils/getUserPhone'
2
 import getUserPhone from '@utils/getUserPhone'
3
 import './index.scss'
3
 import './index.scss'
4
 
4
 
5
+const grantIcon = require('@assets/helpgroup/shouquan.png')
6
+const logoImg = require('@assets/index/logo.png')
7
+const bgImg = require('@assets/helpgroup/bg.png')
8
+
5
 export default class Index extends Component {
9
 export default class Index extends Component {
6
 
10
 
7
-  state = {
8
-    // maskVisible: false,
9
-  }
11
+  state = {}
10
 
12
 
11
   componentDidMount() {
13
   componentDidMount() {
12
-    // this.setState({
13
-    //   maskVisible: true
14
-    // })
15
-    if (this.props.user.phone) {
14
+    const { user = {}} = this.props
15
+    if (user.phone && typeof this.props.onSuccess === 'function') {
16
       this.props.onSuccess();
16
       this.props.onSuccess();
17
     }
17
     }
18
 
18
 
19
   }
19
   }
20
   getPhoneNumber(e) {
20
   getPhoneNumber(e) {
21
-    console.log(e, "eeeeeeeeeeeee")
22
     getUserPhone(e, (phoneNumber) => {
21
     getUserPhone(e, (phoneNumber) => {
23
       if (!phoneNumber) {
22
       if (!phoneNumber) {
24
         Taro.showToast({
23
         Taro.showToast({
26
           icon: 'none'
25
           icon: 'none'
27
         })
26
         })
28
         return
27
         return
29
-      } else {
30
-        this.props.onSuccess();
31
-
28
+      } else {        
29
+        if (typeof this.props.onSuccess === 'function') {
30
+          this.props.onSuccess();
31
+        }
32
       }
32
       }
33
     })
33
     })
34
   }
34
   }
35
+
35
   renderMaskBanner() {
36
   renderMaskBanner() {
36
-    const { maskBanner } = this.state
37
     return (
37
     return (
38
       <View>
38
       <View>
39
-        <Image src={require('@assets/helpgroup/bg.png')} className='bg_img'></Image>
39
+        <Image src={bgImg} className='bg_img'></Image>
40
         <View className="phone-page">
40
         <View className="phone-page">
41
-
42
           <View className="content">
41
           <View className="content">
43
-            <Image src={require('@assets/index/logo.png')} className='logo_img'></Image>
42
+            <Image src={logoImg} className='logo_img'></Image>
44
             <View className="text">
43
             <View className="text">
45
               授权手机后,可享受以下功能
44
               授权手机后,可享受以下功能
46
           </View>
45
           </View>
47
             <View className="flex">
46
             <View className="flex">
48
               <View className="item">
47
               <View className="item">
49
-                <Image className="shouquan" src={require('@assets/helpgroup/shouquan.png')} ></Image>在线咨询
48
+                <Image className="shouquan" src={grantIcon} ></Image>在线咨询
50
             </View>
49
             </View>
51
               <View className="item">
50
               <View className="item">
52
-                <Image className="shouquan" src={require('@assets/helpgroup/shouquan.png')} ></Image>收藏分享楼盘
51
+                <Image className="shouquan" src={grantIcon} ></Image>收藏分享楼盘
53
             </View>
52
             </View>
54
             </View>
53
             </View>
55
             <View className="flex">
54
             <View className="flex">
56
               <View className="item">
55
               <View className="item">
57
-                <Image className="shouquan" src={require('@assets/helpgroup/shouquan.png')} ></Image>专属顾问
56
+                <Image className="shouquan" src={grantIcon} ></Image>专属顾问
58
             </View>
57
             </View>
59
               <View className="item">
58
               <View className="item">
60
-                <Image className="shouquan" src={require('@assets/helpgroup/shouquan.png')} ></Image>参与助力活动            </View>
59
+                <Image className="shouquan" src={grantIcon} ></Image>参与助力活动            </View>
61
             </View>
60
             </View>
62
             <View className="flex">
61
             <View className="flex">
63
               <View className="item">
62
               <View className="item">
64
-                <Image className="shouquan" src={require('@assets/helpgroup/shouquan.png')} ></Image>推荐客户
63
+                <Image className="shouquan" src={grantIcon} ></Image>推荐客户
65
             </View>
64
             </View>
66
               <View className="item">
65
               <View className="item">
67
-                <Image className="shouquan" src={require('@assets/helpgroup/shouquan.png')} ></Image>参与拼团活动
66
+                <Image className="shouquan" src={grantIcon} ></Image>参与拼团活动
68
             </View>
67
             </View>
69
             </View>
68
             </View>
70
             <View className="flex">
69
             <View className="flex">
71
               <View className="item">
70
               <View className="item">
72
-                <Image className="shouquan" src={require('@assets/helpgroup/shouquan.png')} ></Image>获取积分好礼
71
+                <Image className="shouquan" src={grantIcon} ></Image>获取积分好礼
73
             </View>
72
             </View>
74
               <View className="item">
73
               <View className="item">
75
-                <Image className="shouquan" src={require('@assets/helpgroup/shouquan.png')} ></Image>更多精彩权益
74
+                <Image className="shouquan" src={grantIcon} ></Image>更多精彩权益
76
             </View>
75
             </View>
77
             </View>
76
             </View>
78
             <Button className="btn" open-type="getPhoneNumber" lang="zh_CN" onGetphonenumber={this.getPhoneNumber}>授权手机</Button>
77
             <Button className="btn" open-type="getPhoneNumber" lang="zh_CN" onGetphonenumber={this.getPhoneNumber}>授权手机</Button>
82
     )
81
     )
83
   }
82
   }
84
   render() {
83
   render() {
84
+    const { user = {}} = this.props
85
 
85
 
86
     return (
86
     return (
87
       <Block>
87
       <Block>
88
-        {!this.props.user.phone && this.renderMaskBanner()}
88
+        {!user.phone && this.renderMaskBanner()}
89
       </Block>
89
       </Block>
90
     )
90
     )
91
   }
91
   }

+ 59
- 41
src/pages/activity/detail/assistance.js View File

2
 import './index.scss'
2
 import './index.scss'
3
 import Notice from '@components/Notice'
3
 import Notice from '@components/Notice'
4
 import BackHomeBtn from '@components/BackHomeBtn'
4
 import BackHomeBtn from '@components/BackHomeBtn'
5
+import AchievePhone from '@components/achievePhone'
5
 import Poster from './poster'
6
 import Poster from './poster'
6
 import dayjs from 'dayjs'
7
 import dayjs from 'dayjs'
7
 // import WxParse from '@components/wxParse/wxParse'
8
 // import WxParse from '@components/wxParse/wxParse'
71
   }
72
   }
72
 
73
 
73
   componentWillUnmount() {
74
   componentWillUnmount() {
74
-    // const { recordId } = this.state
75
-    // recordId && updatePoint(recordId)
76
-
77
     this.clearTicker()
75
     this.clearTicker()
78
   }
76
   }
79
 
77
 
80
-  initPageData() {
78
+  initPageData = () => {
81
     if (!this.state.detail.helpActivityId) {
79
     if (!this.state.detail.helpActivityId) {
82
       const router = Taro.getStorageSync('router')
80
       const router = Taro.getStorageSync('router')
83
       const id = this.$router.params.id || router.query.id
81
       const id = this.$router.params.id || router.query.id
97
   }
95
   }
98
 
96
 
99
   // 调起授权电话
97
   // 调起授权电话
100
-  toggleGrantPhone() {
98
+  toggleGrantPhone = () => {
101
     const { userInfo: { person: { phone } } } = this.props
99
     const { userInfo: { person: { phone } } } = this.props
102
     if (!phone) {
100
     if (!phone) {
103
       this.setState({ grantPhoneVisible: true })
101
       this.setState({ grantPhoneVisible: true })
108
   }
106
   }
109
 
107
 
110
   // 调起授权头像
108
   // 调起授权头像
111
-  toggleGrantAvatar() {
109
+  toggleGrantAvatar = () => {
112
     const { userInfo: { person: { avatarurl } } } = this.props
110
     const { userInfo: { person: { avatarurl } } } = this.props
113
     if (!avatarurl) {
111
     if (!avatarurl) {
114
       this.setState({ grantAvatarVisible: true })
112
       this.setState({ grantAvatarVisible: true })
118
     return true
116
     return true
119
   }
117
   }
120
 
118
 
121
-  toggleActionVisible() {
119
+  toggleActionVisible = () => {
122
     this.setState({
120
     this.setState({
123
       actionSheetVisible: !this.state.actionSheetVisible
121
       actionSheetVisible: !this.state.actionSheetVisible
124
     })
122
     })
125
   }
123
   }
126
 
124
 
127
-  togglePosterVisible() {
125
+  togglePosterVisible = () => {
128
     this.setState({
126
     this.setState({
129
-      posterVisible: !this.state.posterVisible
127
+      posterVisible: !this.state.posterVisible,
128
+      actionSheetVisible: false
130
     })
129
     })
131
   }
130
   }
132
 
131
 
162
     })
161
     })
163
   }
162
   }
164
 
163
 
165
-  formateLeftTime() {
164
+  formateLeftTime = () => {
166
     const nd = 1000 * 24 * 60 * 60;
165
     const nd = 1000 * 24 * 60 * 60;
167
     const nh = 1000 * 60 * 60;
166
     const nh = 1000 * 60 * 60;
168
     const nm = 1000 * 60;
167
     const nm = 1000 * 60;
177
   }
176
   }
178
 
177
 
179
   loadDetail() {
178
   loadDetail() {
180
-    const { id } = this.state
179
+    const { id, initiateId } = this.state
181
     const { userInfo } = this.props
180
     const { userInfo } = this.props
182
 
181
 
183
     Taro.showLoading()
182
     Taro.showLoading()
184
-    getHelpDetail(id).then(res => {
183
+    getHelpDetail(id, initiateId).then(res => {
185
       this.clearTicker()
184
       this.clearTicker()
186
 
185
 
187
       const initiateDetail = res.helpInitiateRecord || {}
186
       const initiateDetail = res.helpInitiateRecord || {}
195
         posters: res.postList || [],
194
         posters: res.postList || [],
196
         helpList: res.helpRecordList || [],
195
         helpList: res.helpRecordList || [],
197
         loaded: true,
196
         loaded: true,
198
-        isStarter: !initiateDetail.person_id || userInfo.person.personId === initiateDetail.personId,
197
+        isStarter: !initiateDetail.personId || userInfo.person.personId === initiateDetail.personId,
199
       })
198
       })
200
       
199
       
201
       this.updateLeftTime(res.helpActivity.startDate, res.helpActivity.endDate)
200
       this.updateLeftTime(res.helpActivity.startDate, res.helpActivity.endDate)
226
       `recommender=${personId}`
225
       `recommender=${personId}`
227
     ]
226
     ]
228
     if (initiateDetail.helpRecordInitiateId) {
227
     if (initiateDetail.helpRecordInitiateId) {
229
-      queryParams.push(`initiateId=${helpRecordInitiateId}`)
228
+      queryParams.push(`initiateId=${initiateDetail.helpRecordInitiateId}`)
230
     }
229
     }
231
 
230
 
232
-    return [
231
+    const res = [
233
       'pages/activity/detail/assistance',
232
       'pages/activity/detail/assistance',
234
       queryParams.join('&'),
233
       queryParams.join('&'),
235
     ]
234
     ]
235
+
236
+    console.log('--page-params->', res)
237
+
238
+    return res
236
   }
239
   }
237
 
240
 
238
   onShareAppMessage = () => {
241
   onShareAppMessage = () => {
259
   }
262
   }
260
 
263
 
261
   // 助力好友
264
   // 助力好友
262
-  handleHelp() {
265
+  handleHelp = () => {
263
     if (this.state.submitting) return
266
     if (this.state.submitting) return
264
 
267
 
265
     Taro.showLoading()
268
     Taro.showLoading()
275
         phone: person.tel || person.phone,
278
         phone: person.tel || person.phone,
276
         avatarurl: person.avatarurl,
279
         avatarurl: person.avatarurl,
277
         helpRecordInitiateId: initiateDetail.helpRecordInitiateId,
280
         helpRecordInitiateId: initiateDetail.helpRecordInitiateId,
278
-      }).then(() => {
281
+      }).then((res) => {
279
         Taro.hideLoading()
282
         Taro.hideLoading()
280
-        this.setState({ submitting: false })
283
+        const helpList = this.state.helpList || []
284
+        helpList.push(res.helpRecord)
285
+
286
+        this.setState({
287
+          submitting: false,
288
+          helpList,
289
+          initiateDetail: res.helpInitiateRecord,
290
+          helpState: res.helpInitiateRecord.status === undefined ? HelpInProcess : res.helpInitiateRecord.status,
291
+        })
292
+
293
+        Taro.showToast({
294
+          title: '助力成功',
295
+          icon: 'success'
296
+        })
281
       }).catch(err => {
297
       }).catch(err => {
282
         console.log('err:', err)
298
         console.log('err:', err)
283
         Taro.hideLoading()
299
         Taro.hideLoading()
284
         this.setState({ submitting: false })
300
         this.setState({ submitting: false })
285
-        Taro.showToast({
286
-          title: '助力失败',
287
-          icon: 'none'
288
-        })
289
       })
301
       })
290
     })
302
     })
291
   }
303
   }
292
 
304
 
293
   // 发起我的助力
305
   // 发起我的助力
294
-  startMine() {
306
+  startMine = () => {
295
     // 必须授权头像
307
     // 必须授权头像
296
     if (this.toggleGrantAvatar()) {
308
     if (this.toggleGrantAvatar()) {
297
       const detail = this.state.detail
309
       const detail = this.state.detail
306
           phone: person.tel || person.phone,
318
           phone: person.tel || person.phone,
307
           avatarurl: person.avatarurl,
319
           avatarurl: person.avatarurl,
308
         }).then(res => {
320
         }).then(res => {
309
-          this.setState({ initiateDetail: res }, resolve)
321
+          this.setState({
322
+            initiateDetail: res,
323
+            helpList: [],
324
+            isStarter: true,
325
+            helpState: HelpInProcess,
326
+          }, resolve)
310
         }).catch(err => {
327
         }).catch(err => {
311
           console.log('err:', err)
328
           console.log('err:', err)
312
           Taro.showToast({
329
           Taro.showToast({
322
   }
339
   }
323
 
340
 
324
   // 请求好友助力
341
   // 请求好友助力
325
-  askForHelp() {
342
+  askForHelp = () => {
326
     // 必须授权头像
343
     // 必须授权头像
327
     if (this.toggleGrantAvatar()) {
344
     if (this.toggleGrantAvatar()) {
328
       const initiateDetail = this.state.initiateDetail
345
       const initiateDetail = this.state.initiateDetail
402
 
419
 
403
   render() {
420
   render() {
404
     const {
421
     const {
422
+      initiateId,
423
+      initiateDetail,
405
       detail,
424
       detail,
406
       loaded,
425
       loaded,
407
       actState,
426
       actState,
411
       helpList,
430
       helpList,
412
       helpState,
431
       helpState,
413
       actionSheetVisible,
432
       actionSheetVisible,
414
-      grantAvatarVisible,
415
       grantPhoneVisible,
433
       grantPhoneVisible,
416
     } = this.state
434
     } = this.state
417
 
435
 
418
     const { userInfo } = this.props
436
     const { userInfo } = this.props
419
-    const avatar = this.state.initiateId ? this.state.initiateDetail.avatarurl : userInfo.person.avatarurl
437
+    const avatar = initiateId ? initiateDetail.avatarurl : userInfo.person.avatarurl
420
 
438
 
421
     return (
439
     return (
422
       <Block>
440
       <Block>
423
         {/* 生成海报 */}
441
         {/* 生成海报 */}
424
         {posterVisible && (<Poster data={posterData} toggle={this.togglePosterStatus}></Poster>)}
442
         {posterVisible && (<Poster data={posterData} toggle={this.togglePosterStatus}></Poster>)}
443
+        
444
+        {
445
+          grantPhoneVisible &&
446
+          <AchievePhone user={this.props.userInfo.person} onSuccess={this.initPageData}></AchievePhone>
447
+        }
425
 
448
 
426
         {
449
         {
427
           loaded && (
450
           loaded && (
447
                   {
470
                   {
448
                     helpState === HelpSuccess &&
471
                     helpState === HelpSuccess &&
449
                     (
472
                     (
450
-                      <Text>TODO: 助力成功</Text>
473
+                      <Block>
474
+                        <Text>TODO: 助力成功</Text>
475
+                        {
476
+                          isStarter && (<Text>核销码 {initiateDetail.verification}</Text>)
477
+                        }                        
478
+                      </Block>
451
                     )
479
                     )
452
                   }
480
                   }
453
                   {
481
                   {
461
                   <View className="assistance-text">{`${detail.enlistNum || 0}/${detail.personNum}`}</View>
489
                   <View className="assistance-text">{`${detail.enlistNum || 0}/${detail.personNum}`}</View>
462
                   <View className='tools-main'>
490
                   <View className='tools-main'>
463
                     {
491
                     {
464
-                      times(helpList.length).map((it, inx) => {
492
+                      helpList.map((it, inx) => {
465
                         return (
493
                         return (
466
                           <View className='tools-item' key={`help-${inx}`}>
494
                           <View className='tools-item' key={`help-${inx}`}>
467
                             <Image src={it.avatarurl} className='tools-item-img'></Image>
495
                             <Image src={it.avatarurl} className='tools-item-img'></Image>
508
                 <Image src={detail.activityInstructions}style="width:100%"></Image>
536
                 <Image src={detail.activityInstructions}style="width:100%"></Image>
509
               </ScrollView>
537
               </ScrollView>
510
 
538
 
511
-              {
512
-                grantPhoneVisible &&
513
-                <View onSuccess={this.initPageData}>TODO: 授权电话</View>
514
-              }
515
-
516
-              {
517
-                grantAvatarVisible &&
518
-                <View onSuccess={() => {}}>TODO: 授权头像</View>
519
-              }
520
-
521
               <action-sheet hidden={!actionSheetVisible} bindchange={this.toggleActionVisible}>
539
               <action-sheet hidden={!actionSheetVisible} bindchange={this.toggleActionVisible}>
522
                 <action-sheet-item open-type="share">
540
                 <action-sheet-item open-type="share">
523
-                  <Button open-type="share" className='share__friend'>分享给好友</Button>
541
+                  <Button open-type="share" className='share__friend' onClick={this.toggleActionVisible}>分享给好友</Button>
524
                 </action-sheet-item>
542
                 </action-sheet-item>
525
                 <action-sheet-item>
543
                 <action-sheet-item>
526
                   <Button className='creat__img' onClick={this.togglePosterVisible}>发送朋友圈</Button>
544
                   <Button className='creat__img' onClick={this.togglePosterVisible}>发送朋友圈</Button>
527
                 </action-sheet-item>
545
                 </action-sheet-item>
528
-                <action-sheet-cancel>取消</action-sheet-cancel>
546
+                <action-sheet-cancel onClick={this.toggleActionVisible}>取消</action-sheet-cancel>
529
               </action-sheet>
547
               </action-sheet>
530
             
548
             
531
               <BackHomeBtn></BackHomeBtn>              
549
               <BackHomeBtn></BackHomeBtn>              

+ 1
- 1
src/pages/activity/item/index.js View File

30
 
30
 
31
           <View className="left">
31
           <View className="left">
32
             <View className="time">参与截止时间:{`${dayjs(data.endDate).format('YYYY年MM月DD日 hh:mm:ss')}`}</View>
32
             <View className="time">参与截止时间:{`${dayjs(data.endDate).format('YYYY年MM月DD日 hh:mm:ss')}`}</View>
33
-            <View className={data.activityStatus == 0 ? "btn jionin " : data.activityStatus == 1 ? "btn nostart" : data.activityStatus == 2 ? "btn jioned" : "btn"}>{data.activityStatus == 0 ? "立即参与" : data.activityStatus == 1 ? "未开始" : data.activityStatus == 2 ? "已参与" : "已结束"}</View>
33
+            <View className={data.activityStatus == 0 ? "btn jionin " : data.activityStatus == 1 ? "btn nostart" : data.activityStatus == 2 ? "btn jioned" : "btn"}>{data.activityStatus == 0 ? "立即参与" : data.activityStatus == 1 ? "未开始" : data.activityStatus == 2 ? "已结束" : "已参与"}</View>
34
           </View>
34
           </View>
35
         </View>
35
         </View>
36
       </View >
36
       </View >

+ 1
- 1
src/services/activity.js View File

82
  */
82
  */
83
 export const getActNewList = payload => fetch({ url: API_ACTNEW_LIST, payload })
83
 export const getActNewList = payload => fetch({ url: API_ACTNEW_LIST, payload })
84
 
84
 
85
-export const getHelpDetail = id => fetch({ url: `${API_HELP_DETAIL}/${id}`, method:'GET' })
85
+export const getHelpDetail = (id, initiateId) => fetch({ url: `${API_HELP_DETAIL}/${id}${ initiateId ? '?initiateId=' + initiateId : ''}`, method:'GET' })
86
 export const createHelpActivity = payload => fetch({ url: API_HELP_CREATE, method:'POST', payload })
86
 export const createHelpActivity = payload => fetch({ url: API_HELP_CREATE, method:'POST', payload })
87
 export const giveFriendHelp = payload => fetch({ url: API_HELP_FRIEND, method:'POST', payload })
87
 export const giveFriendHelp = payload => fetch({ url: API_HELP_FRIEND, method:'POST', payload })