|
@@ -46,8 +46,6 @@ export default class Index extends Component {
|
46
|
46
|
bound: false,
|
47
|
47
|
grantPhoneVisible: false, // 授权电话
|
48
|
48
|
grantAvatarVisible: false, // 授权头像
|
49
|
|
- avatarImg: 'http://pic1.zhimg.com/50/v2-fce4f8a778fe3f24bca2cafc709b6847_hd.jpg',//头像路径
|
50
|
|
- avatarPopVisible: false,
|
51
|
49
|
}
|
52
|
50
|
|
53
|
51
|
componentWillMount() {
|
|
@@ -68,10 +66,28 @@ export default class Index extends Component {
|
68
|
66
|
}
|
69
|
67
|
|
70
|
68
|
componentDidShow() {
|
|
69
|
+
|
71
|
70
|
wx.setStorage({
|
72
|
71
|
key: "from-card",
|
73
|
72
|
data: "true"
|
74
|
73
|
})
|
|
74
|
+ if (this.$router.params.loadInfo == 'need') {
|
|
75
|
+ Taro.navigateBack({ delta: 1 })
|
|
76
|
+ const { cardId } = this.state
|
|
77
|
+ const { dispatchCardInfo, dispatchProjectDetail } = this.props
|
|
78
|
+ Taro.showLoading()
|
|
79
|
+ dispatchCardInfo(cardId).then(res => {
|
|
80
|
+ Taro.hideLoading()
|
|
81
|
+ this.setState({
|
|
82
|
+ loaded: true,
|
|
83
|
+ isSave: res.isSave
|
|
84
|
+ })
|
|
85
|
+ let buildingId = (res.projects || [])[0]
|
|
86
|
+ if (buildingId) {
|
|
87
|
+ dispatchProjectDetail(buildingId)
|
|
88
|
+ }
|
|
89
|
+ })
|
|
90
|
+ }
|
75
|
91
|
}
|
76
|
92
|
|
77
|
93
|
initPageData() {
|
|
@@ -90,7 +106,6 @@ export default class Index extends Component {
|
90
|
106
|
})
|
91
|
107
|
})
|
92
|
108
|
} else {
|
93
|
|
-
|
94
|
109
|
this.setState({ cardId: id }, this.loadCardDetail)
|
95
|
110
|
addCardUv(id)
|
96
|
111
|
}
|
|
@@ -509,9 +524,9 @@ export default class Index extends Component {
|
509
|
524
|
icon: 'none'
|
510
|
525
|
})
|
511
|
526
|
}
|
|
527
|
+
|
512
|
528
|
// 选择图片
|
513
|
529
|
bindAlbumClick(e) {
|
514
|
|
- console.log('222222222222222')
|
515
|
530
|
|
516
|
531
|
e.stopPropagation()
|
517
|
532
|
|
|
@@ -524,24 +539,16 @@ export default class Index extends Component {
|
524
|
539
|
sourceType: ['album', 'camera'], //可选择性开放访问相册、相机
|
525
|
540
|
success: res => {
|
526
|
541
|
uploadFiles(res.tempFilePaths).then(data => {
|
527
|
|
- this.setState({
|
528
|
|
- avatarPopVisible: true,
|
529
|
|
- avatarImg: data[0]
|
|
542
|
+ Taro.navigateTo({
|
|
543
|
+ url: `/pages/card/photo?photoUrl=${encodeURIComponent(data[0])}`
|
530
|
544
|
})
|
531
|
545
|
})
|
532
|
546
|
},
|
533
|
|
- complete: res => {
|
534
|
|
- Taro.hideLoading()
|
535
|
|
- }
|
536
|
|
- })
|
537
|
|
- }
|
538
|
|
- saveBtn() {
|
539
|
|
- this.setState({
|
540
|
|
- avatarPopVisible: false,
|
541
|
547
|
})
|
542
|
548
|
}
|
|
549
|
+
|
543
|
550
|
render() {
|
544
|
|
- const { makePosterStatus, posterData, grantPhoneVisible, grantAvatarVisible, cardId, avatarImg } = this.state
|
|
551
|
+ const { makePosterStatus, posterData, grantPhoneVisible, grantAvatarVisible, cardId } = this.state
|
545
|
552
|
const { userInfo, cardInfo, projectDetail } = this.props
|
546
|
553
|
const { person: { personType, personId, phone, tel } } = userInfo
|
547
|
554
|
const { unReadNum, picture, visitors, id, isReport } = cardInfo
|
|
@@ -573,13 +580,6 @@ export default class Index extends Component {
|
573
|
580
|
grantAvatarVisible &&
|
574
|
581
|
<AchieveAvatar user={userInfo.person} onSuccess={() => { this.setState({ grantAvatarVisible: false }) }} ></AchieveAvatar>
|
575
|
582
|
}
|
576
|
|
- {
|
577
|
|
- avatarPopVisible &&
|
578
|
|
- <View className="avatar-pop">
|
579
|
|
- <Image src={avatarImg} className='avatar-img' onClick={this.bindAlbumClick} mode="aspectFill"></Image>
|
580
|
|
- <Button className="save-btn" onClick={this.saveBtn}>保存</Button>
|
581
|
|
- </View>
|
582
|
|
- }
|
583
|
583
|
|
584
|
584
|
{this.state.loaded && (
|
585
|
585
|
<View className='mycard'>
|
|
@@ -589,7 +589,9 @@ export default class Index extends Component {
|
589
|
589
|
<View className='mycard__user__imgox'>
|
590
|
590
|
<Image className='mycard__user__img' src={picture} mode="widthFix"></Image>
|
591
|
591
|
<Image src={picture} mode="aspectFill" className='head__img'></Image>
|
592
|
|
- <Image src={require('@/assets/edit.png')} className='edit-img' onClick={this.bindAlbumClick} mode="aspectFill"></Image>
|
|
592
|
+ {
|
|
593
|
+ isSelf && <Image src={require('@/assets/edit.png')} className='edit-img' onClick={this.bindAlbumClick} mode="aspectFill"></Image>
|
|
594
|
+ }
|
593
|
595
|
</View>
|
594
|
596
|
<Image src={require('@/assets/person/top.png')} className='top-img' mode="aspectFill"></Image>
|
595
|
597
|
</View>
|