瀏覽代碼

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/miniapp-v3 into dev

xujing 5 年之前
父節點
當前提交
12c967b231
共有 3 個檔案被更改,包括 85 行新增72 行删除
  1. 36
    22
      src/pages/activity/detail/assemble.js
  2. 46
    47
      src/pages/activity/detail/assistance.js
  3. 3
    3
      src/pages/project/detail/index.js

+ 36
- 22
src/pages/activity/detail/assemble.js 查看文件

@@ -526,29 +526,43 @@ export default class Detail extends Component {
526 526
     const { userInfo: { miniApp: { tpls } } } = this.props
527 527
     const tplId = (tpls.filter(x => x.tplType == noticeType.TPL_GROUP && x.isSubscribe == true))[0].tplId
528 528
     const that = this
529
-    wx.requestSubscribeMessage({
530
-      tmplIds: [tplId],
531
-      success(res) {
532
-
533
-      },
534
-      fail(res) {
535
-
536
-      },
537
-      complete() {
538
-        // 必须授权头像
539
-        if (that.toggleGrantAvatar()) {
540
-          const recordDetail = that.state.recordDetail
541
-          if (!recordDetail.recordId) {
542
-            // 如果是未发起的拼团, 先以当前人身份发起
543
-            that.startMine(() => {
544
-              that.toggleActionVisible()
545
-            })
546
-          } else {
547
-            that.toggleActionVisible()
548
-          }
549
-        }
529
+
530
+    // 必须授权头像
531
+    if (that.toggleGrantAvatar()) {
532
+      const recordDetail = that.state.recordDetail
533
+      if (!recordDetail.recordId) {
534
+        // 如果是未发起的拼团, 先以当前人身份发起
535
+        that.startMine(() => {
536
+          that.toggleActionVisible()
537
+        })
538
+      } else {
539
+        that.toggleActionVisible()
550 540
       }
551
-    })
541
+    }
542
+
543
+    // wx.requestSubscribeMessage({
544
+    //   tmplIds: [tplId],
545
+    //   success(res) {
546
+
547
+    //   },
548
+    //   fail(res) {
549
+
550
+    //   },
551
+    //   complete() {
552
+    //     // 必须授权头像
553
+    //     if (that.toggleGrantAvatar()) {
554
+    //       const recordDetail = that.state.recordDetail
555
+    //       if (!recordDetail.recordId) {
556
+    //         // 如果是未发起的拼团, 先以当前人身份发起
557
+    //         that.startMine(() => {
558
+    //           that.toggleActionVisible()
559
+    //         })
560
+    //       } else {
561
+    //         that.toggleActionVisible()
562
+    //       }
563
+    //     }
564
+    //   }
565
+    // })
552 566
 
553 567
   }
554 568
 

+ 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() {

+ 3
- 3
src/pages/project/detail/index.js 查看文件

@@ -1195,15 +1195,15 @@ export default class Index extends Component {
1195 1195
 
1196 1196
   render() {
1197 1197
     const { posterStatus, posterData, loaded, btnstate, grantPhoneVisible, consultData, consultShow } = this.state
1198
-    const { projectDetail, userInfo } = this.props
1198
+    const { projectDetail, userInfo = { person: {} } } = this.props
1199 1199
     const { uvList = {} } = projectDetail
1200 1200
     const { total = 0, records = [] } = uvList
1201 1201
     const openDate = projectDetail.openingDate ? dayjs(projectDetail.openingDate).locale('zh-cn').format('YYYY年M月D日') : '暂无'
1202 1202
     return (
1203 1203
       <Block>
1204 1204
         {
1205
-          (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone) &&
1206
-          <AchievePhone user={person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
1205
+          (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone && !userInfo.person.tel) &&
1206
+          <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
1207 1207
         }
1208 1208
         {
1209 1209
           loaded && (