|
@@ -9,6 +9,8 @@ import { connect } from '@tarojs/redux'
|
9
|
9
|
import { ROLE_CODE } from '@constants/user'
|
10
|
10
|
import { getQrCodeParams } from '@utils/qrcode'
|
11
|
11
|
import { getMiniQrcode, savePoint, updatePoint } from '@services/common'
|
|
12
|
+import { isEmpty } from '@utils/tools'
|
|
13
|
+
|
12
|
14
|
const bgImg = require('@assets/helpgroup/bg.png')
|
13
|
15
|
|
14
|
16
|
@connect(state => state.user, { ...actions })
|
|
@@ -19,31 +21,40 @@ export default class Index extends Component {
|
19
|
21
|
avatarVisible: false,
|
20
|
22
|
phoneVisible: false,
|
21
|
23
|
webViewVisible: false,
|
|
24
|
+ // pageHide: true,
|
22
|
25
|
pageInfo: {},
|
23
|
26
|
codeParams: '', // 解析二维码参数
|
|
27
|
+ h5Id: undefined,
|
24
|
28
|
}
|
25
|
29
|
|
26
|
30
|
componentWillUnmount() {
|
27
|
31
|
const { recordId } = this.state
|
28
|
32
|
recordId && updatePoint(recordId)
|
29
|
33
|
}
|
|
34
|
+
|
|
35
|
+ // componentDidHide() {
|
|
36
|
+ // this.setState({ pageHide: true });
|
|
37
|
+ // }
|
|
38
|
+
|
|
39
|
+ // componentDidShow() {
|
|
40
|
+ // this.setState({ pageHide: false });
|
|
41
|
+ // }
|
|
42
|
+
|
30
|
43
|
// 埋点
|
31
|
44
|
success() {
|
32
|
|
- const { userInfo: { person } } = this.props
|
33
|
|
-
|
34
|
|
- const router = Taro.getStorageSync('router')
|
|
45
|
+ const router = Taro.getStorageSync('router') || { query: {} }
|
35
|
46
|
const firstShare = this.$router.params.firstShare || router.query.firstShare || ""
|
36
|
47
|
const consultant = this.$router.params.consultant || router.query.consultant || ""
|
37
|
48
|
const sharePersonId = this.$router.params.sharePersonId || router.query.sharePersonId || ""
|
38
|
|
- const { pageInfo } = this.state
|
39
|
|
- const targetId = pageInfo.drainageId || this.$router.params.id || router.query.id || ""
|
|
49
|
+ const { h5Id } = this.state
|
|
50
|
+
|
40
|
51
|
savePoint({
|
41
|
52
|
event: 'detail',
|
42
|
53
|
eventType: 'h5',
|
43
|
54
|
propertyName: 'h5活动',
|
44
|
55
|
consultantId: consultant,
|
45
|
56
|
sharePersonId: sharePersonId,
|
46
|
|
- targetId: targetId,
|
|
57
|
+ targetId: h5Id,
|
47
|
58
|
data: '{"firstShare":"' + firstShare + '"}'
|
48
|
59
|
}).then(res => {
|
49
|
60
|
this.setState({
|
|
@@ -52,6 +63,7 @@ export default class Index extends Component {
|
52
|
63
|
console.log('访问记录')
|
53
|
64
|
})
|
54
|
65
|
}
|
|
66
|
+
|
55
|
67
|
// 分享好友
|
56
|
68
|
onShareAppMessage = () => {
|
57
|
69
|
const { pageInfo } = this.state
|
|
@@ -74,20 +86,19 @@ export default class Index extends Component {
|
74
|
86
|
// })
|
75
|
87
|
// }
|
76
|
88
|
|
77
|
|
-
|
78
|
89
|
currentPageAndParams() {
|
79
|
90
|
const { userInfo: { person } } = this.props
|
80
|
|
- const router = Taro.getStorageSync('router')
|
|
91
|
+ const { h5Id } = this.state
|
|
92
|
+ const router = Taro.getStorageSync('router') || { query: {} }
|
81
|
93
|
|
82
|
94
|
const consultant = person.personType == ROLE_CODE['CONSULTANT'] ? person.userId : ""
|
83
|
95
|
const firstShare = this.$router.params.firstShare || router.query.firstShare || person.personId
|
84
|
|
- const id = this.$router.params.id || router.query.id || ""
|
85
|
96
|
|
86
|
97
|
let queryParams = [
|
87
|
98
|
`sharePersonId=${person.personId}`,
|
88
|
99
|
`consultant=${consultant}`,
|
89
|
100
|
`firstShare=${firstShare}`,
|
90
|
|
- `id=${id}`
|
|
101
|
+ `id=${h5Id}`
|
91
|
102
|
]
|
92
|
103
|
|
93
|
104
|
const res = [
|
|
@@ -97,8 +108,10 @@ export default class Index extends Component {
|
97
|
108
|
|
98
|
109
|
return res
|
99
|
110
|
}
|
|
111
|
+
|
100
|
112
|
componentWillMount() {
|
101
|
113
|
ready.queue(() => {
|
|
114
|
+
|
102
|
115
|
Taro.showLoading()
|
103
|
116
|
if (this.$router.params.scene) {
|
104
|
117
|
|
|
@@ -106,36 +119,49 @@ export default class Index extends Component {
|
106
|
119
|
this.setState({
|
107
|
120
|
codeParams: res['__raw'] || ''
|
108
|
121
|
})
|
|
122
|
+
|
|
123
|
+ if (isEmpty(res.id)) {
|
|
124
|
+ Taro.showModal({
|
|
125
|
+ title: '提示',
|
|
126
|
+ content: '活动不存在',
|
|
127
|
+ success: (res) => {
|
|
128
|
+ if (res.confirm) {
|
|
129
|
+ this.gotoIndex()
|
|
130
|
+ }
|
|
131
|
+ },
|
|
132
|
+ })
|
|
133
|
+ return;
|
|
134
|
+ }
|
|
135
|
+
|
|
136
|
+ if (!this.state.h5Id) {
|
|
137
|
+ this.loadH5Profile(res.id)
|
|
138
|
+ }
|
109
|
139
|
// console.log(codeParams, "解析二维码返回值")
|
110
|
140
|
})
|
111
|
141
|
}
|
112
|
142
|
|
113
|
|
- console.log(this.$router, "this.$router")
|
114
|
|
- const router = Taro.getStorageSync('router')
|
115
|
|
- console.log(router, "router")
|
116
|
|
- const hFiveId = this.$router.params.id || router.query.id || ""
|
117
|
|
- console.log(hFiveId, "hFiveId")
|
118
|
|
- // h5id 、第一个分享人ID、置业顾问ID、分享人ID
|
119
|
|
- getHFiveDetail(hFiveId).then(res => {
|
120
|
|
- Taro.hideLoading()
|
121
|
|
- if (res.status == 1) {
|
122
|
|
- this.setState({
|
123
|
|
- pageInfo: res
|
124
|
|
- })
|
125
|
|
- } else {
|
126
|
|
- Taro.showModal({
|
127
|
|
- title: '提示',
|
128
|
|
- content: '活动已下架',
|
129
|
|
- showCancel: false,
|
130
|
|
- }).then(() => {
|
131
|
|
- Taro.switchTab({
|
132
|
|
- url: '/pages/project/index'
|
133
|
|
- })
|
134
|
|
- })
|
135
|
|
- }
|
136
|
|
- })
|
|
143
|
+ const router = Taro.getStorageSync('router') || { query: {} }
|
|
144
|
+ const hFiveId = this.$router.params.id || router.query.id
|
|
145
|
+
|
|
146
|
+ if (!isEmpty(hFiveId)) {
|
|
147
|
+ this.loadH5Profile(hFiveId)
|
|
148
|
+ }
|
|
149
|
+
|
|
150
|
+ // 没有 H5ID, 也没有分享
|
|
151
|
+ if (isEmpty(hFiveId) && !this.$router.params.scene) {
|
|
152
|
+ Taro.showModal({
|
|
153
|
+ title: '提示',
|
|
154
|
+ content: '活动不存在',
|
|
155
|
+ success: (res) => {
|
|
156
|
+ if (res.confirm) {
|
|
157
|
+ this.gotoIndex()
|
|
158
|
+ }
|
|
159
|
+ },
|
|
160
|
+ })
|
|
161
|
+ return;
|
|
162
|
+ }
|
|
163
|
+
|
137
|
164
|
const { userInfo: { person: { avatarurl, phone } } } = this.props
|
138
|
|
- console.log(this.props, "this.propsthis.propsthis.props")
|
139
|
165
|
|
140
|
166
|
if (avatarurl && avatarurl.indexOf('wx.qlogo.cn') != -1) {
|
141
|
167
|
console.log(avatarurl, "有头像哦~")
|
|
@@ -171,6 +197,34 @@ export default class Index extends Component {
|
171
|
197
|
}
|
172
|
198
|
})
|
173
|
199
|
}
|
|
200
|
+
|
|
201
|
+ gotoIndex = () => {
|
|
202
|
+ Taro.switchTab({
|
|
203
|
+ url: '/pages/project/index'
|
|
204
|
+ })
|
|
205
|
+ }
|
|
206
|
+
|
|
207
|
+ loadH5Profile = (id) => {
|
|
208
|
+ // h5id 、第一个分享人ID、置业顾问ID、分享人ID
|
|
209
|
+ getHFiveDetail(id).then(res => {
|
|
210
|
+ Taro.hideLoading()
|
|
211
|
+ if (res.status == 1) {
|
|
212
|
+ this.setState({
|
|
213
|
+ pageInfo: res,
|
|
214
|
+ h5Id: id,
|
|
215
|
+ })
|
|
216
|
+ } else {
|
|
217
|
+ Taro.showModal({
|
|
218
|
+ title: '提示',
|
|
219
|
+ content: '活动已下架',
|
|
220
|
+ showCancel: false,
|
|
221
|
+ }).then(() => {
|
|
222
|
+ this.gotoIndex()
|
|
223
|
+ })
|
|
224
|
+ }
|
|
225
|
+ })
|
|
226
|
+ }
|
|
227
|
+
|
174
|
228
|
// 授权头像成功
|
175
|
229
|
onAvatarSuccess() {
|
176
|
230
|
this.setState({
|
|
@@ -221,6 +275,7 @@ export default class Index extends Component {
|
221
|
275
|
}
|
222
|
276
|
})
|
223
|
277
|
}
|
|
278
|
+
|
224
|
279
|
// 授权手机号
|
225
|
280
|
getPhoneNumber(e) {
|
226
|
281
|
getUserPhone(e, (phoneNumber) => {
|
|
@@ -240,15 +295,16 @@ export default class Index extends Component {
|
240
|
295
|
}
|
241
|
296
|
})
|
242
|
297
|
}
|
|
298
|
+
|
243
|
299
|
// 报备客户
|
244
|
300
|
reportClient() {
|
245
|
301
|
|
246
|
|
- const router = Taro.getStorageSync('router')
|
|
302
|
+ const router = Taro.getStorageSync('router') || { query: {} }
|
247
|
303
|
const consultant = this.$router.params.consultant || router.query.consultant || ""
|
248
|
304
|
const {
|
249
|
305
|
userInfo: { person: { phone, tel, userId } }
|
250
|
306
|
} = this.props
|
251
|
|
- // debugger
|
|
307
|
+
|
252
|
308
|
if (consultant && consultant != userId) {
|
253
|
309
|
const realPhone = phone || tel
|
254
|
310
|
const payload = {
|
|
@@ -266,12 +322,12 @@ export default class Index extends Component {
|
266
|
322
|
}
|
267
|
323
|
|
268
|
324
|
renderMaskBanner() {
|
269
|
|
- const { avatarVisible, phoneVisible, pageInfo } = this.state
|
|
325
|
+ const { avatarVisible, phoneVisible, pageInfo, h5Id } = this.state
|
270
|
326
|
return (
|
271
|
327
|
<View>
|
272
|
328
|
<Image src={pageInfo.middleImg || bgImg} mode='widthFix' className='bg_img'></Image>
|
273
|
329
|
<View className="middle-page">
|
274
|
|
- {avatarVisible &&
|
|
330
|
+ {avatarVisible && h5Id &&
|
275
|
331
|
<View className="content">
|
276
|
332
|
<View className="title">授权头像,围观活动</View>
|
277
|
333
|
<View className="touxiang"><open-data type="userAvatarUrl"></open-data></View>
|
|
@@ -279,7 +335,7 @@ export default class Index extends Component {
|
279
|
335
|
<Button className="btn" open-type="getUserInfo" lang="zh_CN" onGetUserInfo={this.getUserInfo}>好</Button>
|
280
|
336
|
</View>
|
281
|
337
|
}
|
282
|
|
- {phoneVisible &&
|
|
338
|
+ {phoneVisible && h5Id &&
|
283
|
339
|
<Button className="phone-btn" open-type="getPhoneNumber" lang="zh_CN" onGetphonenumber={this.getPhoneNumber}>点击授权查看详情</Button>
|
284
|
340
|
}
|
285
|
341
|
</View>
|
|
@@ -287,23 +343,22 @@ export default class Index extends Component {
|
287
|
343
|
)
|
288
|
344
|
}
|
289
|
345
|
render() {
|
290
|
|
- const router = Taro.getStorageSync('router')
|
291
|
|
- const { pageInfo, webViewVisible, codeParams } = this.state
|
|
346
|
+ const router = Taro.getStorageSync('router') || { query: {} }
|
|
347
|
+ const { pageInfo, webViewVisible, codeParams, pageHide, h5Id } = this.state
|
292
|
348
|
const { userInfo: { person } } = this.props
|
293
|
349
|
const consultant = person.personType == ROLE_CODE['CONSULTANT'] ? person.userId : ""
|
294
|
|
- const h5id = this.$router.params.id || router.query.id || ""
|
295
|
350
|
const firstShare = this.$router.params.firstShare || router.query.firstShare || person.personId
|
296
|
351
|
const webUrlParams = [
|
297
|
352
|
`personId=${person.personId}`,
|
298
|
|
- `h5id=${h5id}`,
|
|
353
|
+ `h5id=${h5Id}`,
|
299
|
354
|
`consultant=${consultant}`,
|
300
|
355
|
`firstShare=${firstShare}`,
|
301
|
356
|
`codeParams=${encodeURIComponent(codeParams)}`,
|
302
|
357
|
].join('&')
|
303
|
358
|
|
304
|
|
- console.log('----web-h5------>', `${pageInfo.h5Address}?${webUrlParams}`)
|
|
359
|
+ const showH5 = !isEmpty(h5Id) && pageInfo.h5Address && pageInfo.h5Address !== 'about' && pageInfo.h5Address !== 'http://about' && pageInfo.h5Address !== 'https://about'
|
305
|
360
|
|
306
|
|
- const showH5 = pageInfo.h5Address && pageInfo.h5Address !== 'about' && pageInfo.h5Address !== 'http://about' && pageInfo.h5Address !== 'https://about'
|
|
361
|
+ console.log('----web-h5------>', showH5, `${pageInfo.h5Address}?${webUrlParams}`)
|
307
|
362
|
|
308
|
363
|
return (
|
309
|
364
|
<Block>
|