张延森 5 年前
父节点
当前提交
e242be453b
共有 2 个文件被更改,包括 7 次插入18 次删除
  1. 6
    14
      src/pages/card/index.js
  2. 1
    4
      src/pages/person/index.js

+ 6
- 14
src/pages/card/index.js 查看文件

61
       this.initPageData()
61
       this.initPageData()
62
     })
62
     })
63
   }
63
   }
64
+
64
   initPageData() {
65
   initPageData() {
65
     const router = Taro.getStorageSync('router')
66
     const router = Taro.getStorageSync('router')
66
     const id = this.$router.params.id || router.query.id
67
     const id = this.$router.params.id || router.query.id
83
     const { recordId } = this.state
84
     const { recordId } = this.state
84
     recordId && updatePoint(recordId)
85
     recordId && updatePoint(recordId)
85
   }
86
   }
86
-  componentDidMount() {
87
-    const options = wx.getLaunchOptionsSync()
88
-    const sceneList = [ 1011, 1012, 1013, 1031, 1032, 1036, 1047, 1048]
89
-
90
-    if (sceneList.indexOf(options.scene) != -1) {
91
-      this.setState({
92
-        grantPhoneVisible: true,
93
-      })
94
-    }
95
-  }
96
 
87
 
97
   loadCardDetail() {
88
   loadCardDetail() {
98
     const { cardId } = this.state
89
     const { cardId } = this.state
104
         loaded: true,
95
         loaded: true,
105
         isSave: res.isSave
96
         isSave: res.isSave
106
       })
97
       })
107
-      let buildingId = res.projects[0]
98
+      let buildingId = (res.projects || [])[0]
108
       if (buildingId) {
99
       if (buildingId) {
109
         dispatchProjectDetail(buildingId)
100
         dispatchProjectDetail(buildingId)
110
       }
101
       }
353
 
344
 
354
   handleModalConfirm() {
345
   handleModalConfirm() {
355
     const {
346
     const {
356
-      cardInfo: { id, projects },
347
+      cardInfo: { id, projects = [] },
357
       userInfo: { person: { phone, tel } }
348
       userInfo: { person: { phone, tel } }
358
     } = this.props
349
     } = this.props
359
 
350
 
445
     const visibleChatBtn = !isConsultant && !isSelf
436
     const visibleChatBtn = !isConsultant && !isSelf
446
     // const visibleConfirmModal = modalStatus && !isReport && !isSelf && (personType === ROLE_CODE['DRIFT'] || personType === ROLE_CODE['CUSTOMER'])
437
     // const visibleConfirmModal = modalStatus && !isReport && !isSelf && (personType === ROLE_CODE['DRIFT'] || personType === ROLE_CODE['CUSTOMER'])
447
     const visibleConfirmModal = modalStatus && !isReport && !isSelf
438
     const visibleConfirmModal = modalStatus && !isReport && !isSelf
439
+    const showAuthPhone = grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone
448
 
440
 
449
     return (
441
     return (
450
       <Block>
442
       <Block>
451
         {/* 生成海报 */}
443
         {/* 生成海报 */}
452
         {makePosterStatus && (<Poster data={posterData} toggle={this.toggleVisiblePoster}></Poster>)}
444
         {makePosterStatus && (<Poster data={posterData} toggle={this.toggleVisiblePoster}></Poster>)}
453
         {
445
         {
454
-          (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone) &&
446
+          showAuthPhone &&
455
           <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
447
           <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
456
         }
448
         }
457
         {
449
         {
458
-          !grantPhoneVisible && visibleConfirmModal && (
450
+          !showAuthPhone && visibleConfirmModal && (
459
             <View className="modal">
451
             <View className="modal">
460
               <View className="modal-mask" onClick={this.hideModal}></View>
452
               <View className="modal-mask" onClick={this.hideModal}></View>
461
               <View className="modal-body">
453
               <View className="modal-body">

+ 1
- 4
src/pages/person/index.js 查看文件

92
       }
92
       }
93
     }
93
     }
94
     else {
94
     else {
95
-
96
-
97
-      putRegisterConsultant().then(res => {
98
-    
95
+      putRegisterConsultant().then(res => {    
99
 
96
 
100
         // if (res) {
97
         // if (res) {
101
           Taro.showToast({
98
           Taro.showToast({