|
@@ -1,15 +1,13 @@
|
1
|
1
|
import Taro, { Component } from '@tarojs/taro'
|
2
|
2
|
import './index.scss'
|
3
|
|
-
|
4
|
3
|
import Notice from '@components/Notice'
|
5
|
4
|
import Poster from './poster'
|
6
|
5
|
import ProjectItem from '../project/item'
|
7
|
6
|
import BackHomeBtn from '@components/BackHomeBtn'
|
8
|
7
|
import getUserPhone from '@utils/getUserPhone'
|
9
|
|
-import AchievePhone from '@components/achievePhone'
|
10
|
8
|
import ready from '@utils/ready'
|
|
9
|
+import AchievePhone from '@components/achievePhone'
|
11
|
10
|
import { sceneInShare } from '@utils/tools'
|
12
|
|
-
|
13
|
11
|
import { ROLE_CODE } from '@constants/user'
|
14
|
12
|
import { addCardUv, addCardShareNum, favorCard, cancelFavorCard } from '@services/card'
|
15
|
13
|
import { getMiniQrcode, savePoint, updatePoint } from '@services/common'
|
|
@@ -44,7 +42,8 @@ export default class Index extends Component {
|
44
|
42
|
|
45
|
43
|
componentWillMount() {
|
46
|
44
|
ready.queue(() => {
|
47
|
|
-
|
|
45
|
+ // const router = Taro.getStorageSync('router')
|
|
46
|
+ // const id = this.$router.params.id || router.query.id || '4604a792d575eb8187711625bd88832c'
|
48
|
47
|
// 分享场景需要先授权手机, 再授权头像
|
49
|
48
|
const options = wx.getLaunchOptionsSync()
|
50
|
49
|
if (sceneInShare(options.scene)) {
|
|
@@ -54,6 +53,7 @@ export default class Index extends Component {
|
54
|
53
|
return
|
55
|
54
|
}
|
56
|
55
|
|
|
56
|
+
|
57
|
57
|
this.setState({
|
58
|
58
|
grantPhoneVisible: true,
|
59
|
59
|
})
|
|
@@ -62,7 +62,6 @@ export default class Index extends Component {
|
62
|
62
|
this.initPageData()
|
63
|
63
|
})
|
64
|
64
|
}
|
65
|
|
-
|
66
|
65
|
initPageData() {
|
67
|
66
|
const router = Taro.getStorageSync('router')
|
68
|
67
|
const id = this.$router.params.id || router.query.id
|
|
@@ -87,6 +86,7 @@ export default class Index extends Component {
|
87
|
86
|
this.handleModalConfirm(tel || phone)
|
88
|
87
|
}
|
89
|
88
|
|
|
89
|
+
|
90
|
90
|
componentWillUnmount() {
|
91
|
91
|
const { recordId } = this.state
|
92
|
92
|
recordId && updatePoint(recordId)
|
|
@@ -118,6 +118,7 @@ export default class Index extends Component {
|
118
|
118
|
recordId: res1.recordId
|
119
|
119
|
})
|
120
|
120
|
console.log('个人主页')
|
|
121
|
+ console.log(this.props, "this.props-=====!!")
|
121
|
122
|
})
|
122
|
123
|
})
|
123
|
124
|
}
|
|
@@ -354,12 +355,11 @@ export default class Index extends Component {
|
354
|
355
|
cardInfo: { id, projects = [] },
|
355
|
356
|
userInfo: { person: { phone, tel, personType, avatarurl } }
|
356
|
357
|
} = this.props
|
357
|
|
-
|
358
|
358
|
if (personType === ROLE_CODE['CONSULTANT']) {
|
359
|
359
|
return
|
360
|
360
|
}
|
361
|
|
-
|
362
|
361
|
const buildingId = projects[0]
|
|
362
|
+
|
363
|
363
|
const realPhone = phoneNumber || phone || tel
|
364
|
364
|
|
365
|
365
|
// TODO:
|
|
@@ -370,25 +370,26 @@ export default class Index extends Component {
|
370
|
370
|
buildingId,
|
371
|
371
|
phone: realPhone
|
372
|
372
|
}
|
|
373
|
+ const { cardInfo, userInfo: { person } } = this.props
|
|
374
|
+ if (person.personId != cardInfo.id) {
|
|
375
|
+ reportClient(payload).then(res => {
|
|
376
|
+ this.hideModal()
|
|
377
|
+ this.setState({ bound: true })
|
|
378
|
+ if (res !== 'bound') {
|
|
379
|
+ Taro.showToast({
|
|
380
|
+ title: '恭喜您绑定成功'
|
|
381
|
+ })
|
|
382
|
+ }
|
|
383
|
+ }).catch(err => {
|
|
384
|
+ console.error(err)
|
|
385
|
+ this.setState({ bound: true })
|
373
|
386
|
|
374
|
|
- reportClient(payload).then(res => {
|
375
|
|
- this.hideModal()
|
376
|
|
- this.setState({ bound: true })
|
377
|
|
-
|
378
|
|
- if (res !== 'bound') {
|
379
|
387
|
Taro.showToast({
|
380
|
|
- title: '恭喜您绑定成功'
|
|
388
|
+ title: err.message || err,
|
|
389
|
+ icon: 'none'
|
381
|
390
|
})
|
382
|
|
- }
|
383
|
|
- }).catch(err => {
|
384
|
|
- console.error(err)
|
385
|
|
- this.setState({ bound: true })
|
386
|
|
-
|
387
|
|
- Taro.showToast({
|
388
|
|
- title: err.message || err,
|
389
|
|
- icon: 'none'
|
390
|
391
|
})
|
391
|
|
- })
|
|
392
|
+ }
|
392
|
393
|
|
393
|
394
|
}
|
394
|
395
|
}
|
|
@@ -439,7 +440,6 @@ export default class Index extends Component {
|
439
|
440
|
modalStatus: false
|
440
|
441
|
})
|
441
|
442
|
}
|
442
|
|
-
|
443
|
443
|
handleAuthPhoneSuccess = (phone) => {
|
444
|
444
|
const { person = {} } = this.props.userInfo || {}
|
445
|
445
|
if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
|
|
@@ -453,18 +453,17 @@ export default class Index extends Component {
|
453
|
453
|
}
|
454
|
454
|
|
455
|
455
|
handeAuthPhoneFail = () => {
|
456
|
|
- Taro.showToast({
|
|
456
|
+ Taro.showToast({
|
457
|
457
|
title: '未授权手机号无法成为报备客户',
|
458
|
458
|
icon: 'none'
|
459
|
|
- })
|
|
459
|
+ })
|
460
|
460
|
}
|
461
|
|
-
|
462
|
461
|
render() {
|
463
|
462
|
const { makePosterStatus, posterData, modalStatus, grantPhoneVisible } = this.state
|
464
|
463
|
const { userInfo, cardInfo, projectDetail } = this.props
|
465
|
464
|
const { person: { personType, personId, phone, tel } } = userInfo
|
466
|
465
|
const { unReadNum, picture, visitors, id, isReport } = cardInfo
|
467
|
|
- const { buildingId } = projectDetail
|
|
466
|
+ const { buildingId, address } = projectDetail
|
468
|
467
|
|
469
|
468
|
const visitorList = visitors ? visitors.slice(0, 5) : []
|
470
|
469
|
const isSelf = personId === id
|
|
@@ -475,11 +474,11 @@ export default class Index extends Component {
|
475
|
474
|
// const visibleConfirmModal = modalStatus && !isReport && !isSelf && (personType === ROLE_CODE['DRIFT'] || personType === ROLE_CODE['CUSTOMER'])
|
476
|
475
|
const visibleConfirmModal = modalStatus && !isReport && !isSelf
|
477
|
476
|
const showAuthPhone = grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone
|
478
|
|
-
|
479
|
477
|
return (
|
480
|
478
|
<Block>
|
481
|
479
|
{/* 生成海报 */}
|
482
|
480
|
{makePosterStatus && (<Poster data={posterData} toggle={this.toggleVisiblePoster}></Poster>)}
|
|
481
|
+
|
483
|
482
|
{
|
484
|
483
|
showAuthPhone &&
|
485
|
484
|
<AchievePhone user={userInfo.person} onCancel={this.handeAuthPhoneFail} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
|
|
@@ -592,7 +591,7 @@ export default class Index extends Component {
|
592
|
591
|
</View>
|
593
|
592
|
<View className='detailed__add' onClick={this.getLocation}>
|
594
|
593
|
<View className='detailed__add__txt'>
|
595
|
|
- <Text className='add__txt' space='emsp'>地址 </Text> {cardInfo.address}
|
|
594
|
+ <Text className='add__txt' space='emsp'>地址 </Text> {address}
|
596
|
595
|
</View>
|
597
|
596
|
<Text className='iconfont icon-daohangdizhi add__img'></Text>
|
598
|
597
|
</View>
|