|
@@ -7,6 +7,7 @@ import BackHomeBtn from '@components/BackHomeBtn'
|
7
|
7
|
import getUserPhone from '@utils/getUserPhone'
|
8
|
8
|
import ready from '@utils/ready'
|
9
|
9
|
import AchievePhone from '@components/achievePhone'
|
|
10
|
+import AchieveAvatar from '@components/achieveAvatar'
|
10
|
11
|
import { sceneInShare } from '@utils/tools'
|
11
|
12
|
import { ROLE_CODE } from '@constants/user'
|
12
|
13
|
import { addCardUv, addCardShareNum, favorCard, cancelFavorCard } from '@services/card'
|
|
@@ -38,6 +39,7 @@ export default class Index extends Component {
|
38
|
39
|
bound: false,
|
39
|
40
|
modalStatus: false,
|
40
|
41
|
grantPhoneVisible: false, // 授权手机弹框
|
|
42
|
+ grantAvatarVisible: false, // 授权头像弹框
|
41
|
43
|
}
|
42
|
44
|
|
43
|
45
|
componentWillMount() {
|
|
@@ -62,6 +64,7 @@ export default class Index extends Component {
|
62
|
64
|
this.initPageData()
|
63
|
65
|
})
|
64
|
66
|
}
|
|
67
|
+
|
65
|
68
|
initPageData() {
|
66
|
69
|
const router = Taro.getStorageSync('router')
|
67
|
70
|
const id = this.$router.params.id || router.query.id
|
|
@@ -143,12 +146,16 @@ export default class Index extends Component {
|
143
|
146
|
}
|
144
|
147
|
|
145
|
148
|
getLocation = () => {
|
146
|
|
- const { cardInfo: { address, company } } = this.props
|
|
149
|
+ const { cardInfo: { address, company,coordinate } } = this.props
|
|
150
|
+ const coord = coordinate.split(',')
|
|
151
|
+ const latitude = parseFloat(coord[0])
|
|
152
|
+ const longitude = parseFloat(coord[1])
|
|
153
|
+
|
147
|
154
|
Taro.getLocation({ //返回可以用于Taro.openLocation的经纬度,官方提示bug: iOS 6.3.30 type 参数不生效,只会返回 wgs84 类型的坐标信息
|
148
|
155
|
success: function (res) {
|
149
|
156
|
Taro.openLocation({
|
150
|
|
- latitude: 31.979190,
|
151
|
|
- longitude: 118.733660,
|
|
157
|
+ latitude,
|
|
158
|
+ longitude,
|
152
|
159
|
name: company,
|
153
|
160
|
address
|
154
|
161
|
})
|
|
@@ -441,17 +448,30 @@ export default class Index extends Component {
|
441
|
448
|
})
|
442
|
449
|
}
|
443
|
450
|
handleAuthPhoneSuccess = (phone) => {
|
444
|
|
- const { person = {} } = this.props.userInfo || {}
|
445
|
|
- if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
|
446
|
|
- Taro.reLaunch({ url: '/pages/auth/index' })
|
447
|
|
- return
|
448
|
|
- }
|
449
|
|
-
|
450
|
|
- this.setState({ grantPhoneVisible: false })
|
|
451
|
+ // const { person = {} } = this.props.userInfo || {}
|
|
452
|
+ // if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
|
|
453
|
+ // Taro.reLaunch({ url: '/pages/auth/index' })
|
|
454
|
+ // return
|
|
455
|
+ // }
|
|
456
|
+
|
|
457
|
+ // this.setState({ grantPhoneVisible: false })
|
|
458
|
+ this.toggleGrantAvatar()
|
451
|
459
|
this.initPageData()
|
452
|
460
|
// this.handleModalConfirm(phone)
|
453
|
461
|
}
|
|
462
|
+ // 调起授权头像
|
|
463
|
+ toggleGrantAvatar = () => {
|
|
464
|
+ const { userInfo: { person: { avatarurl } } } = this.props
|
|
465
|
+
|
|
466
|
+ if (!avatarurl || avatarurl.indexOf('wx.qlogo.cn') === -1) {
|
|
467
|
+ this.setState({ grantAvatarVisible: true })
|
|
468
|
+ return false
|
|
469
|
+ }
|
454
|
470
|
|
|
471
|
+ console.log(avatarurl,"avatarurl")
|
|
472
|
+ console.log(this.props.userInfo,"this.props")
|
|
473
|
+ return true
|
|
474
|
+}
|
455
|
475
|
handeAuthPhoneFail = () => {
|
456
|
476
|
Taro.showToast({
|
457
|
477
|
title: '未授权手机号无法成为报备客户',
|
|
@@ -459,7 +479,7 @@ export default class Index extends Component {
|
459
|
479
|
})
|
460
|
480
|
}
|
461
|
481
|
render() {
|
462
|
|
- const { makePosterStatus, posterData, modalStatus, grantPhoneVisible } = this.state
|
|
482
|
+ const { makePosterStatus, posterData, modalStatus, grantPhoneVisible,grantAvatarVisible } = this.state
|
463
|
483
|
const { userInfo, cardInfo, projectDetail } = this.props
|
464
|
484
|
const { person: { personType, personId, phone, tel } } = userInfo
|
465
|
485
|
const { unReadNum, picture, visitors, id, isReport } = cardInfo
|
|
@@ -483,6 +503,10 @@ export default class Index extends Component {
|
483
|
503
|
showAuthPhone &&
|
484
|
504
|
<AchievePhone user={userInfo.person} onCancel={this.handeAuthPhoneFail} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
|
485
|
505
|
}
|
|
506
|
+ {
|
|
507
|
+ grantAvatarVisible &&
|
|
508
|
+ <AchieveAvatar user={userInfo.person} onSuccess={() => { this.setState({ grantAvatarVisible: false }) }} ></AchieveAvatar>
|
|
509
|
+ }
|
486
|
510
|
{
|
487
|
511
|
// !showAuthPhone && visibleConfirmModal && (
|
488
|
512
|
// <View className="modal">
|