张延森 vor 5 Jahren
Ursprung
Commit
e242be453b
2 geänderte Dateien mit 7 neuen und 18 gelöschten Zeilen
  1. 6
    14
      src/pages/card/index.js
  2. 1
    4
      src/pages/person/index.js

+ 6
- 14
src/pages/card/index.js Datei anzeigen

@@ -61,6 +61,7 @@ export default class Index extends Component {
61 61
       this.initPageData()
62 62
     })
63 63
   }
64
+
64 65
   initPageData() {
65 66
     const router = Taro.getStorageSync('router')
66 67
     const id = this.$router.params.id || router.query.id
@@ -83,16 +84,6 @@ export default class Index extends Component {
83 84
     const { recordId } = this.state
84 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 88
   loadCardDetail() {
98 89
     const { cardId } = this.state
@@ -104,7 +95,7 @@ export default class Index extends Component {
104 95
         loaded: true,
105 96
         isSave: res.isSave
106 97
       })
107
-      let buildingId = res.projects[0]
98
+      let buildingId = (res.projects || [])[0]
108 99
       if (buildingId) {
109 100
         dispatchProjectDetail(buildingId)
110 101
       }
@@ -353,7 +344,7 @@ export default class Index extends Component {
353 344
 
354 345
   handleModalConfirm() {
355 346
     const {
356
-      cardInfo: { id, projects },
347
+      cardInfo: { id, projects = [] },
357 348
       userInfo: { person: { phone, tel } }
358 349
     } = this.props
359 350
 
@@ -445,17 +436,18 @@ export default class Index extends Component {
445 436
     const visibleChatBtn = !isConsultant && !isSelf
446 437
     // const visibleConfirmModal = modalStatus && !isReport && !isSelf && (personType === ROLE_CODE['DRIFT'] || personType === ROLE_CODE['CUSTOMER'])
447 438
     const visibleConfirmModal = modalStatus && !isReport && !isSelf
439
+    const showAuthPhone = grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone
448 440
 
449 441
     return (
450 442
       <Block>
451 443
         {/* 生成海报 */}
452 444
         {makePosterStatus && (<Poster data={posterData} toggle={this.toggleVisiblePoster}></Poster>)}
453 445
         {
454
-          (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone) &&
446
+          showAuthPhone &&
455 447
           <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
456 448
         }
457 449
         {
458
-          !grantPhoneVisible && visibleConfirmModal && (
450
+          !showAuthPhone && visibleConfirmModal && (
459 451
             <View className="modal">
460 452
               <View className="modal-mask" onClick={this.hideModal}></View>
461 453
               <View className="modal-body">

+ 1
- 4
src/pages/person/index.js Datei anzeigen

@@ -92,10 +92,7 @@ export default class Person extends Component {
92 92
       }
93 93
     }
94 94
     else {
95
-
96
-
97
-      putRegisterConsultant().then(res => {
98
-    
95
+      putRegisterConsultant().then(res => {    
99 96
 
100 97
         // if (res) {
101 98
           Taro.showToast({