|
@@ -36,14 +36,11 @@ export default class Index extends Component {
|
36
|
36
|
recordId: null,
|
37
|
37
|
isSave: false,
|
38
|
38
|
bound: false,
|
39
|
|
- modalStatus: false,
|
40
|
39
|
grantPhoneVisible: false, // 授权手机弹框
|
41
|
40
|
}
|
42
|
41
|
|
43
|
42
|
componentWillMount() {
|
44
|
43
|
ready.queue(() => {
|
45
|
|
- // const router = Taro.getStorageSync('router')
|
46
|
|
- // const id = this.$router.params.id || router.query.id || '4604a792d575eb8187711625bd88832c'
|
47
|
44
|
// 分享场景需要先授权手机, 再授权头像
|
48
|
45
|
const options = wx.getLaunchOptionsSync()
|
49
|
46
|
if (sceneInShare(options.scene)) {
|
|
@@ -66,19 +63,20 @@ export default class Index extends Component {
|
66
|
63
|
const router = Taro.getStorageSync('router')
|
67
|
64
|
const id = this.$router.params.id || router.query.id
|
68
|
65
|
|
69
|
|
- if (router.query.id) {
|
70
|
|
- this.setState({
|
71
|
|
- cardId: id,
|
72
|
|
- modalStatus: true
|
73
|
|
- }, this.loadCardDetail)
|
|
66
|
+ if (!id) {
|
|
67
|
+ getQrCodeParams(this.$router.params.scene).then(res => {
|
|
68
|
+ this.setState({ cardId: res.id }, this.loadCardDetail)
|
|
69
|
+ addCardUv(res.id)
|
|
70
|
+ }).catch(err => {
|
|
71
|
+ Taro.showToast({
|
|
72
|
+ title: '没有找到卡片',
|
|
73
|
+ icon: 'none'
|
|
74
|
+ })
|
|
75
|
+ })
|
74
|
76
|
} else {
|
75
|
|
- this.setState({
|
76
|
|
- cardId: id,
|
77
|
|
- modalStatus: false
|
78
|
|
- }, this.loadCardDetail)
|
|
77
|
+ this.setState({ cardId: id }, this.loadCardDetail)
|
|
78
|
+ addCardUv(id)
|
79
|
79
|
}
|
80
|
|
-
|
81
|
|
- addCardUv(id)
|
82
|
80
|
}
|
83
|
81
|
|
84
|
82
|
componentWillReceiveProps(nextProps) {
|
|
@@ -377,7 +375,6 @@ export default class Index extends Component {
|
377
|
375
|
const { cardInfo, userInfo: { person } } = this.props
|
378
|
376
|
if (person.personId != cardInfo.id) {
|
379
|
377
|
reportClient(payload).then(res => {
|
380
|
|
- this.hideModal()
|
381
|
378
|
this.setState({ bound: true })
|
382
|
379
|
if (res !== 'bound') {
|
383
|
380
|
Taro.showToast({
|
|
@@ -439,11 +436,6 @@ export default class Index extends Component {
|
439
|
436
|
}
|
440
|
437
|
}
|
441
|
438
|
|
442
|
|
- hideModal() {
|
443
|
|
- this.setState({
|
444
|
|
- modalStatus: false
|
445
|
|
- })
|
446
|
|
- }
|
447
|
439
|
handleAuthPhoneSuccess = (phone) => {
|
448
|
440
|
const { person = {} } = this.props.userInfo || {}
|
449
|
441
|
if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
|
|
@@ -463,7 +455,7 @@ export default class Index extends Component {
|
463
|
455
|
})
|
464
|
456
|
}
|
465
|
457
|
render() {
|
466
|
|
- const { makePosterStatus, posterData, modalStatus, grantPhoneVisible } = this.state
|
|
458
|
+ const { makePosterStatus, posterData, grantPhoneVisible } = this.state
|
467
|
459
|
const { userInfo, cardInfo, projectDetail } = this.props
|
468
|
460
|
const { person: { personType, personId, phone, tel } } = userInfo
|
469
|
461
|
const { unReadNum, picture, visitors, id, isReport } = cardInfo
|
|
@@ -475,8 +467,6 @@ export default class Index extends Component {
|
475
|
467
|
const isConsultant = personType === ROLE_CODE['CONSULTANT']
|
476
|
468
|
const hadPhone = (phone || tel) ? true : false // nb
|
477
|
469
|
const visibleChatBtn = !isConsultant && !isSelf
|
478
|
|
- // const visibleConfirmModal = modalStatus && !isReport && !isSelf && (personType === ROLE_CODE['DRIFT'] || personType === ROLE_CODE['CUSTOMER'])
|
479
|
|
- const visibleConfirmModal = modalStatus && !isReport && !isSelf
|
480
|
470
|
const showAuthPhone = grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone
|
481
|
471
|
return (
|
482
|
472
|
<Block>
|
|
@@ -487,23 +477,6 @@ export default class Index extends Component {
|
487
|
477
|
showAuthPhone &&
|
488
|
478
|
<AchievePhone user={userInfo.person} onCancel={this.handeAuthPhoneFail} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
|
489
|
479
|
}
|
490
|
|
- {
|
491
|
|
- // !showAuthPhone && visibleConfirmModal && (
|
492
|
|
- // <View className="modal">
|
493
|
|
- // <View className="modal-mask" onClick={this.hideModal}></View>
|
494
|
|
- // <View className="modal-body">
|
495
|
|
- // <View className="modal-body__con">请确认是否成为他的客户?</View>
|
496
|
|
- // {
|
497
|
|
- // hadPhone ? (
|
498
|
|
- // <Button onClick={this.handleModalConfirm} className='modal-body__btn'>确认</Button>
|
499
|
|
- // ) : (
|
500
|
|
- // <Button open-type="getPhoneNumber" onGetphonenumber={this.handleGetPhone} className='modal-body__btn'>确认</Button>
|
501
|
|
- // )
|
502
|
|
- // }
|
503
|
|
- // </View>
|
504
|
|
- // </View>
|
505
|
|
- // )
|
506
|
|
- }
|
507
|
480
|
|
508
|
481
|
{this.state.loaded && (
|
509
|
482
|
<View className='mycard'>
|