|
@@ -37,6 +37,7 @@ export default class Index extends Component {
|
37
|
37
|
actionSheetHide: true, // 控制分享弹窗modal
|
38
|
38
|
recordId: null,
|
39
|
39
|
isSave: false,
|
|
40
|
+ bound: false,
|
40
|
41
|
modalStatus: false,
|
41
|
42
|
grantPhoneVisible: false, // 授权手机弹框
|
42
|
43
|
}
|
|
@@ -81,6 +82,11 @@ export default class Index extends Component {
|
81
|
82
|
addCardUv(id)
|
82
|
83
|
}
|
83
|
84
|
|
|
85
|
+ componentWillReceiveProps(nextProps) {
|
|
86
|
+ const { userInfo: { person: { phone, tel } } } = nextProps
|
|
87
|
+ this.handleModalConfirm(tel || phone)
|
|
88
|
+ }
|
|
89
|
+
|
84
|
90
|
componentWillUnmount() {
|
85
|
91
|
const { recordId } = this.state
|
86
|
92
|
recordId && updatePoint(recordId)
|
|
@@ -346,13 +352,15 @@ export default class Index extends Component {
|
346
|
352
|
handleModalConfirm(phoneNumber) {
|
347
|
353
|
const {
|
348
|
354
|
cardInfo: { id, projects = [] },
|
349
|
|
- userInfo: { person: { phone, tel } }
|
|
355
|
+ userInfo: { person: { phone, tel, avatarurl } }
|
350
|
356
|
} = this.props
|
351
|
357
|
|
352
|
358
|
const buildingId = projects[0]
|
353
|
359
|
const realPhone = phoneNumber || phone || tel
|
354
|
360
|
|
355
|
|
- if (realPhone) {
|
|
361
|
+ // TODO:
|
|
362
|
+ // 此处使用头像控制, 后期需要去掉这个条件
|
|
363
|
+ if (realPhone && id && buildingId && !this.state.bound && (avatarurl || '').indexOf('wx.qlogo.cn') > -1) {
|
356
|
364
|
const payload = {
|
357
|
365
|
realtyConsultant: id, //报备人 置业顾问
|
358
|
366
|
buildingId,
|
|
@@ -361,6 +369,7 @@ export default class Index extends Component {
|
361
|
369
|
|
362
|
370
|
reportClient(payload).then(res => {
|
363
|
371
|
this.hideModal()
|
|
372
|
+ this.setState({ bound: true })
|
364
|
373
|
|
365
|
374
|
if (res !== 'bound') {
|
366
|
375
|
Taro.showToast({
|
|
@@ -369,12 +378,14 @@ export default class Index extends Component {
|
369
|
378
|
}
|
370
|
379
|
}).catch(err => {
|
371
|
380
|
console.error(err)
|
|
381
|
+ this.setState({ bound: true })
|
372
|
382
|
|
373
|
383
|
Taro.showToast({
|
374
|
384
|
title: err.message || err,
|
375
|
385
|
icon: 'none'
|
376
|
386
|
})
|
377
|
387
|
})
|
|
388
|
+
|
378
|
389
|
}
|
379
|
390
|
}
|
380
|
391
|
|
|
@@ -434,7 +445,7 @@ export default class Index extends Component {
|
434
|
445
|
|
435
|
446
|
this.setState({ grantPhoneVisible: false })
|
436
|
447
|
this.initPageData()
|
437
|
|
- this.handleModalConfirm(phone)
|
|
448
|
+ // this.handleModalConfirm(phone)
|
438
|
449
|
}
|
439
|
450
|
|
440
|
451
|
handeAuthPhoneFail = () => {
|