张延森 5 年之前
父節點
當前提交
04bb94e086
共有 1 個文件被更改,包括 46 次插入47 次删除
  1. 46
    47
      src/pages/activity/detail/assistance.js

+ 46
- 47
src/pages/activity/detail/assistance.js 查看文件

@@ -470,45 +470,6 @@ export default class Detail extends Component {
470 470
 
471 471
   // 发起我的助力
472 472
   startMine = () => {
473
-    // 必须授权头像
474
-    if (this.toggleGrantAvatar()) {
475
-      const detail = this.state.detail
476
-      const person = this.props.userInfo.person
477
-
478
-      return new Promise((resolve, reject) => {
479
-        createHelpActivity({
480
-          buildingId: detail.buildingId,
481
-          helpActivityId: detail.helpActivityId,
482
-          personId: person.personId,
483
-          name: person.name || person.nickname,
484
-          phone: person.tel || person.phone,
485
-          avatarurl: person.avatarurl,
486
-        }).then(res => {
487
-          this.setState({
488
-            initiateDetail: res.helpInitiateRecord,
489
-            initiateId: res.helpInitiateRecord.helpRecordInitiateId,
490
-            helpList: res.helpRecordList,
491
-            isStarter: true,
492
-            helpState: res.helpInitiateRecord.status === undefined ? HelpInProcess : res.helpInitiateRecord.status,
493
-          }, resolve)
494
-        }).catch(err => {
495
-          console.log('err:', err)
496
-          Taro.showToast({
497
-            title: '发起助力失败',
498
-            icon: 'none'
499
-          })
500
-          reject()
501
-        })
502
-      })
503
-    }
504
-
505
-    return Promise.reject()
506
-  }
507
-
508
-
509
-
510
-  // 请求好友助力
511
-  askForHelp = () => {
512 473
     const { userInfo: { miniApp: { tpls } } } = this.props
513 474
     const tplId = (tpls.filter(x => x.tplType == noticeType.TPL_HELP && x.isSubscribe == true))[0].tplId
514 475
     const that = this
@@ -521,21 +482,59 @@ export default class Detail extends Component {
521 482
 
522 483
       },
523 484
       complete() {
485
+        
524 486
         // 必须授权头像
525 487
         if (that.toggleGrantAvatar()) {
526
-          const initiateDetail = that.state.initiateDetail
527
-          if (!initiateDetail.helpRecordInitiateId) {
528
-            // 如果是未发起的助力, 先以当前人身份发起
529
-            that.startMine().then(() => {
530
-              that.toggleActionVisible()
488
+          const detail = that.state.detail
489
+          const person = that.props.userInfo.person
490
+
491
+          return new Promise((resolve, reject) => {
492
+            createHelpActivity({
493
+              buildingId: detail.buildingId,
494
+              helpActivityId: detail.helpActivityId,
495
+              personId: person.personId,
496
+              name: person.name || person.nickname,
497
+              phone: person.tel || person.phone,
498
+              avatarurl: person.avatarurl,
499
+            }).then(res => {
500
+              that.setState({
501
+                initiateDetail: res.helpInitiateRecord,
502
+                initiateId: res.helpInitiateRecord.helpRecordInitiateId,
503
+                helpList: res.helpRecordList,
504
+                isStarter: true,
505
+                helpState: res.helpInitiateRecord.status === undefined ? HelpInProcess : res.helpInitiateRecord.status,
506
+              }, resolve)
507
+            }).catch(err => {
508
+              console.log('err:', err)
509
+              Taro.showToast({
510
+                title: '发起助力失败',
511
+                icon: 'none'
512
+              })
513
+              reject()
531 514
             })
532
-          } else {
533
-            that.toggleActionVisible()
534
-          }
515
+          })
535 516
         }
517
+
536 518
       }
537 519
     })
538 520
 
521
+    return Promise.reject()
522
+  }
523
+
524
+  // 请求好友助力
525
+  askForHelp = () => {    
526
+    // 必须授权头像
527
+    if (this.toggleGrantAvatar()) {
528
+      const initiateDetail = this.state.initiateDetail
529
+      if (!initiateDetail.helpRecordInitiateId) {
530
+        // 如果是未发起的助力, 先以当前人身份发起
531
+        this.startMine().then(() => {
532
+          this.toggleActionVisible()
533
+        })
534
+      } else {
535
+        this.toggleActionVisible()
536
+      }
537
+    }
539 538
   }
540 539
 
541 540
   getQRCode() {