许静 преди 5 години
родител
ревизия
a6a35a9ff4
променени са 2 файла, в които са добавени 60 реда и са изтрити 46 реда
  1. 8
    2
      src/components/achieveAvatar/index.js
  2. 52
    44
      src/pages/activity/detail/assemble.js

+ 8
- 2
src/components/achieveAvatar/index.js Целия файл

@@ -34,11 +34,17 @@ export default class Index extends Component {
34 34
         // 用户信息保存至服务器
35 35
         dispatchUpdateUserInfo(payload).then(res => {
36 36
           console.log('更新信息')
37
-          this.toPage(true)
37
+          // this.toPage(true)
38
+          this.props.onSuccess();
38 39
         })
39 40
       },
40 41
       fail: () => {
41
-        this.toPage(false)
42
+        Taro.showToast({
43
+          title: '获取用户信息失败',
44
+          icon: 'none'
45
+        })
46
+        return
47
+        // this.toPage(false)
42 48
       }
43 49
     })
44 50
   }

+ 52
- 44
src/pages/activity/detail/assemble.js Целия файл

@@ -3,6 +3,7 @@ import './index.scss'
3 3
 import Notice from '@components/Notice'
4 4
 import BackHomeBtn from '@components/BackHomeBtn'
5 5
 import AchievePhone from '@components/achievePhone'
6
+import AchieveAvatar from '@components/achieveAvatar'
6 7
 import Poster from '@components/Poster'
7 8
 import FormIdCollector from '@components/formIdCollector'
8 9
 import dayjs from 'dayjs'
@@ -72,7 +73,9 @@ export default class Detail extends Component {
72 73
     ready.queue(() => {
73 74
       // 必须授权电话
74 75
       if (this.toggleGrantPhone()) {
75
-        this.initPageData()
76
+        if (this.toggleGrantAvatar()) {
77
+          this.initPageData()
78
+        }
76 79
       }
77 80
     })
78 81
   }
@@ -394,7 +397,7 @@ export default class Detail extends Component {
394 397
         if (res.confirm) {
395 398
 
396 399
           // 必须授权头像
397
-          if (this.toggleGrantAvatar()) {            
400
+          if (this.toggleGrantAvatar()) {
398 401
             createGroupActivity({
399 402
               groupActivityId: detail.groupActivityId,
400 403
               personId: person.personId,
@@ -402,16 +405,16 @@ export default class Detail extends Component {
402 405
               phone: person.tel || person.phone,
403 406
               avatarurl: person.avatarurl,
404 407
             }).then(res => {
405
-                this.setState({
406
-                  recordDetail: res.taShareRecord,
407
-                  recordId: res.taShareRecord.recordId,
408
-                  memberList: res.shareChildRecordList || [],
409
-                  isStarter: true,
410
-                  groupState: res.taShareRecord.status,
411
-                }, () => cb && cb())
412
-              
408
+              this.setState({
409
+                recordDetail: res.taShareRecord,
410
+                recordId: res.taShareRecord.recordId,
411
+                memberList: res.shareChildRecordList || [],
412
+                isStarter: true,
413
+                groupState: res.taShareRecord.status,
414
+              }, () => cb && cb())
415
+
413 416
             }).catch(err => {
414
-              console.log(err,'11111111111111')
417
+              console.log(err, '11111111111111')
415 418
               Taro.showToast({
416 419
                 title: '发起失败: ' + err.message,
417 420
                 icon: 'none'
@@ -479,6 +482,7 @@ export default class Detail extends Component {
479 482
       groupState,
480 483
       actionSheetVisible,
481 484
       grantPhoneVisible,
485
+      grantAvatarVisible,
482 486
       posterTpls,
483 487
       posters,
484 488
       qrCode,
@@ -522,7 +526,11 @@ export default class Detail extends Component {
522 526
 
523 527
         {
524 528
           grantPhoneVisible &&
525
-          <AchievePhone user={userInfo.person} onSuccess={this.initPageData}></AchievePhone>
529
+          <AchievePhone user={userInfo.person} onSuccess={this.toggleGrantAvatar}></AchievePhone>
530
+        }
531
+        {
532
+          grantAvatarVisible &&
533
+          <AchieveAvatar user={userInfo.person} onSuccess={this.initPageData} ></AchieveAvatar>
526 534
         }
527 535
         <BackHomeBtn></BackHomeBtn>
528 536
         {
@@ -559,7 +567,7 @@ export default class Detail extends Component {
559 567
                       <Block>
560 568
                         <Image className="status__img" style="margin:12rpx auto 24rpx auto" src={getThumbnail(successImg)}></Image>
561 569
                         {
562
-                          verificationCode&&<View className="hexiaoma" style="margin:0 auto 40rpx auto">核销码: {verificationCode}</View>
570
+                          verificationCode && <View className="hexiaoma" style="margin:0 auto 40rpx auto">核销码: {verificationCode}</View>
563 571
                         }
564 572
                       </Block>
565 573
                     )
@@ -617,42 +625,42 @@ export default class Detail extends Component {
617 625
                 <View style="padding:0 40rpx 180rpx 40rpx">
618 626
                   <Image src={getThumbnail(detail.descImg)} mode="widthFix" style="width:100%;"></Image>
619 627
                 </View>
620
-                { (actState === ActBeforeStart||(isStarter && actState === ActInProcess && groupState === GroupInProcess)||(!isStarter && actState === ActInProcess && groupState != GroupInProcess )||(!isStarter && actState === ActInProcess && groupState === GroupInProcess))&&
621
-                <View className="btn-fixed">
622
-                  {
623
-                    actState === ActBeforeStart &&
624
-                    (<View className="nostart-btn"><FormIdCollector><Button className="nostart-btn" style="margin: auto">未开始</Button></FormIdCollector></View>)
625
-                  }
626
-                  {
627
-                    isStarter && actState === ActInProcess && groupState === GroupInProcess &&
628
-                    (<View className="assistance-btn"><FormIdCollector><Button className="assistance-btn" style="margin: auto" onClick={this.groupBuyInvite}>邀请好友拼团</Button></FormIdCollector></View>)
629
-                  }
630
-                  {
631
-                    !isStarter && actState === ActInProcess && groupState != GroupInProcess &&
628
+                {(actState === ActBeforeStart || (isStarter && actState === ActInProcess && groupState === GroupInProcess) || (!isStarter && actState === ActInProcess && groupState != GroupInProcess) || (!isStarter && actState === ActInProcess && groupState === GroupInProcess)) &&
629
+                  <View className="btn-fixed">
630
+                    {
631
+                      actState === ActBeforeStart &&
632
+                      (<View className="nostart-btn"><FormIdCollector><Button className="nostart-btn" style="margin: auto">未开始</Button></FormIdCollector></View>)
633
+                    }
634
+                    {
635
+                      isStarter && actState === ActInProcess && groupState === GroupInProcess &&
636
+                      (<View className="assistance-btn"><FormIdCollector><Button className="assistance-btn" style="margin: auto" onClick={this.groupBuyInvite}>邀请好友拼团</Button></FormIdCollector></View>)
637
+                    }
638
+                    {
639
+                      !isStarter && actState === ActInProcess && groupState != GroupInProcess &&
632 640
 
633
-                    <View className={groupState === GroupInProcess ? "set-btn" : "assistance-btn"} style="border:none">
634
-                      <FormIdCollector>
635
-                        <Button className={groupState === GroupInProcess ? "set-btn" : "assistance-btn"} onClick={this.startMine}>发起我的拼团</Button>
636
-                      </FormIdCollector>
637
-                    </View>
638
-                  }
639
-                  {
640
-                    !isStarter && actState === ActInProcess && groupState === GroupInProcess &&
641
-
642
-                    <View className="btn-box" style="margin: auto; padding: 0;">
643
-                      {
644
-                        (groupState === GroupInProcess && !isJoin) &&
645
-                        (<View className="assistance-btn"><FormIdCollector><Button className="assistance-btn" onClick={this.joinGroup}>立即参团</Button></FormIdCollector></View>)
646
-                      }                      
647
-                      <View className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} style="border:none">
641
+                      <View className={groupState === GroupInProcess ? "set-btn" : "assistance-btn"} style="border:none">
648 642
                         <FormIdCollector>
649
-                          <Button className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} onClick={this.startMine}>发起我的拼团</Button>
643
+                          <Button className={groupState === GroupInProcess ? "set-btn" : "assistance-btn"} onClick={this.startMine}>发起我的拼团</Button>
650 644
                         </FormIdCollector>
651 645
                       </View>
652
-                    </View>
646
+                    }
647
+                    {
648
+                      !isStarter && actState === ActInProcess && groupState === GroupInProcess &&
653 649
 
654
-                  }
655
-                </View>
650
+                      <View className="btn-box" style="margin: auto; padding: 0;">
651
+                        {
652
+                          (groupState === GroupInProcess && !isJoin) &&
653
+                          (<View className="assistance-btn"><FormIdCollector><Button className="assistance-btn" onClick={this.joinGroup}>立即参团</Button></FormIdCollector></View>)
654
+                        }
655
+                        <View className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} style="border:none">
656
+                          <FormIdCollector>
657
+                            <Button className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} onClick={this.startMine}>发起我的拼团</Button>
658
+                          </FormIdCollector>
659
+                        </View>
660
+                      </View>
661
+
662
+                    }
663
+                  </View>
656 664
                 }
657 665
               </ScrollView>
658 666