|
@@ -1,25 +1,28 @@
|
1
|
|
-import Taro, { Component } from '@tarojs/taro'
|
2
|
|
-import * as actions from '@/actions/user'
|
3
|
|
-import getUserPhone from '@/utils/getUserPhone'
|
4
|
|
-import './index.scss'
|
5
|
|
-import { getHFiveDetail } from '@/services/user'
|
6
|
|
-import ready from '@/utils/ready'
|
7
|
|
-import { reportClient } from '@/services/report'
|
8
|
|
-import { connect } from '@tarojs/redux'
|
9
|
|
-import { ROLE_CODE } from '@/constants/user'
|
10
|
|
-import { getQrCodeParams } from '@/utils/qrcode'
|
11
|
|
-import { getMiniQrcode, savePoint, updatePoint } from '@/services/common'
|
12
|
|
-import { isEmpty, parseURL } from '@/utils/tools'
|
13
|
|
-import { rule as ruleToast } from '@/utils/ruleToast'
|
14
|
|
-import { share as shareSavePoint } from '@/utils/shareSavePoint'
|
15
|
|
-import { report as reportCustomer } from '@/utils/customer'
|
16
|
|
-
|
17
|
|
-const bgImg = "https://njcj.oss-cn-shanghai.aliyuncs.com/miniapp/images/helpgroup/bg.png"
|
18
|
|
-
|
19
|
|
-@connect(state => state.user, { ...actions })
|
20
|
|
-
|
|
1
|
+import Taro, { Component } from "@tarojs/taro";
|
|
2
|
+import * as actions from "@/actions/user";
|
|
3
|
+import getUserPhone from "@/utils/getUserPhone";
|
|
4
|
+import { getHFiveDetail } from "@/services/user";
|
|
5
|
+import ready from "@/utils/ready";
|
|
6
|
+// import { reportClient } from "@/services/report";
|
|
7
|
+import { connect } from "@tarojs/redux";
|
|
8
|
+import { ROLE_CODE } from "@/constants/user";
|
|
9
|
+import { getQrCodeParams } from "@/utils/qrcode";
|
|
10
|
+import { getMiniQrcode, savePoint, updatePoint } from "@/services/common";
|
|
11
|
+import { isEmpty, parseURL, mergeQueryParams } from "@/utils/tools";
|
|
12
|
+import { rule as ruleToast } from "@/utils/ruleToast";
|
|
13
|
+import { share as shareSavePoint } from "@/utils/shareSavePoint";
|
|
14
|
+import { report as reportCustomer } from "@/utils/customer";
|
|
15
|
+
|
|
16
|
+import "./index.scss";
|
|
17
|
+
|
|
18
|
+const bgImg =
|
|
19
|
+ "https://njcj.oss-cn-shanghai.aliyuncs.com/miniapp/images/helpgroup/bg.png";
|
|
20
|
+
|
|
21
|
+@connect(
|
|
22
|
+ state => state.user,
|
|
23
|
+ { ...actions }
|
|
24
|
+)
|
21
|
25
|
export default class Index extends Component {
|
22
|
|
-
|
23
|
26
|
state = {
|
24
|
27
|
recordId: undefined, // 埋点ID
|
25
|
28
|
avatarVisible: false,
|
|
@@ -30,119 +33,128 @@ export default class Index extends Component {
|
30
|
33
|
codeParams: {}, // 解析二维码参数
|
31
|
34
|
h5Id: undefined,
|
32
|
35
|
reportedCustomer: false,
|
33
|
|
- buildingId: undefined,
|
34
|
|
- }
|
|
36
|
+ buildingId: undefined
|
|
37
|
+ };
|
35
|
38
|
|
36
|
39
|
componentWillMount() {
|
37
|
40
|
ready.queue(() => {
|
38
|
|
- Taro.showLoading()
|
|
41
|
+ Taro.showLoading();
|
39
|
42
|
if (this.$router.params.scene) {
|
40
|
|
- getQrCodeParams(this.$router.params.scene).then((res) => {
|
41
|
|
- console.log(res, "解析二维码返回值")
|
42
|
|
- this.setState({
|
43
|
|
- codeParams: res || {},
|
44
|
|
- h5Id: res.id,
|
45
|
|
- buildingId: res.buildingId || '',
|
46
|
|
- }, () => {
|
47
|
|
- if (isEmpty(res.id)) {
|
48
|
|
- Taro.showModal({
|
49
|
|
- title: '提示',
|
50
|
|
- content: '活动不存在',
|
51
|
|
- success: (res) => {
|
52
|
|
- if (res.confirm) {
|
53
|
|
- this.gotoIndex()
|
|
43
|
+ getQrCodeParams(this.$router.params.scene).then(res => {
|
|
44
|
+ console.log(res, "解析二维码返回值");
|
|
45
|
+ this.setState(
|
|
46
|
+ {
|
|
47
|
+ codeParams: res || {},
|
|
48
|
+ h5Id: res.id,
|
|
49
|
+ buildingId: res.buildingId || ""
|
|
50
|
+ },
|
|
51
|
+ () => {
|
|
52
|
+ if (isEmpty(res.id)) {
|
|
53
|
+ Taro.showModal({
|
|
54
|
+ title: "提示",
|
|
55
|
+ content: "活动不存在",
|
|
56
|
+ success: res => {
|
|
57
|
+ if (res.confirm) {
|
|
58
|
+ this.gotoIndex();
|
|
59
|
+ }
|
54
|
60
|
}
|
55
|
|
- },
|
56
|
|
- })
|
57
|
|
- return;
|
58
|
|
- }
|
|
61
|
+ });
|
|
62
|
+ return;
|
|
63
|
+ }
|
59
|
64
|
|
60
|
|
- if (!isEmpty(this.state.h5Id)) {
|
61
|
|
- this.loadH5Profile(res.id)
|
|
65
|
+ if (!isEmpty(this.state.h5Id)) {
|
|
66
|
+ this.loadH5Profile(res.id);
|
|
67
|
+ }
|
|
68
|
+ this.avatarPhone();
|
62
|
69
|
}
|
63
|
|
- this.avatarPhone()
|
64
|
|
- })
|
65
|
|
- })
|
|
70
|
+ );
|
|
71
|
+ });
|
66
|
72
|
} else {
|
67
|
|
- const hFiveId = this.$router.params.id
|
|
73
|
+ const hFiveId = this.$router.params.id;
|
68
|
74
|
// 没有 H5ID, 也没有分享
|
69
|
75
|
if (isEmpty(hFiveId)) {
|
70
|
76
|
Taro.showModal({
|
71
|
|
- title: '提示',
|
72
|
|
- content: '活动不存在',
|
73
|
|
- success: (res) => {
|
|
77
|
+ title: "提示",
|
|
78
|
+ content: "活动不存在",
|
|
79
|
+ success: res => {
|
74
|
80
|
if (res.confirm) {
|
75
|
|
- this.gotoIndex()
|
|
81
|
+ this.gotoIndex();
|
76
|
82
|
}
|
77
|
|
- },
|
78
|
|
- })
|
|
83
|
+ }
|
|
84
|
+ });
|
79
|
85
|
return;
|
80
|
86
|
}
|
81
|
87
|
|
82
|
88
|
if (!isEmpty(hFiveId)) {
|
83
|
|
- this.loadH5Profile(hFiveId)
|
|
89
|
+ this.loadH5Profile(hFiveId);
|
84
|
90
|
}
|
85
|
91
|
|
86
|
|
- this.avatarPhone()
|
87
|
|
-
|
|
92
|
+ this.avatarPhone();
|
88
|
93
|
}
|
89
|
|
- })
|
|
94
|
+ });
|
90
|
95
|
}
|
91
|
96
|
|
92
|
97
|
avatarPhone() {
|
93
|
|
- const { userInfo: { person: { avatarurl, phone } } } = this.props
|
|
98
|
+ const {
|
|
99
|
+ userInfo: {
|
|
100
|
+ person: { avatarurl, phone }
|
|
101
|
+ }
|
|
102
|
+ } = this.props;
|
94
|
103
|
|
95
|
|
- if (avatarurl && avatarurl.indexOf('wx.qlogo.cn') != -1) {
|
96
|
|
- console.log(avatarurl, "有头像哦~")
|
|
104
|
+ if (avatarurl && avatarurl.indexOf("wx.qlogo.cn") != -1) {
|
|
105
|
+ console.log(avatarurl, "有头像哦~");
|
97
|
106
|
this.setState({
|
98
|
|
- avatarVisible: false,
|
99
|
|
- })
|
100
|
|
- Taro.hideLoading()
|
101
|
|
- console.log(phone, "phone#########")
|
|
107
|
+ avatarVisible: false
|
|
108
|
+ });
|
|
109
|
+ Taro.hideLoading();
|
|
110
|
+ console.log(phone, "phone#########");
|
102
|
111
|
// 头像手机号都有
|
103
|
112
|
if (phone) {
|
104
|
|
- this.reportClientFn()
|
105
|
|
- this.success()
|
|
113
|
+ this.reportClientFn();
|
|
114
|
+ this.success();
|
106
|
115
|
this.setState({
|
107
|
116
|
phoneVisible: false,
|
108
|
|
- webViewVisible: true,
|
109
|
|
- })
|
|
117
|
+ webViewVisible: true
|
|
118
|
+ });
|
110
|
119
|
} else {
|
111
|
120
|
this.setState({
|
112
|
|
- phoneVisible: true,
|
113
|
|
- })
|
|
121
|
+ phoneVisible: true
|
|
122
|
+ });
|
114
|
123
|
}
|
115
|
124
|
} else {
|
116
|
|
- Taro.hideLoading()
|
|
125
|
+ Taro.hideLoading();
|
117
|
126
|
this.setState({
|
118
|
|
- avatarVisible: true,
|
119
|
|
- })
|
|
127
|
+ avatarVisible: true
|
|
128
|
+ });
|
120
|
129
|
if (phone) {
|
121
|
130
|
this.setState({
|
122
|
|
- phoneVisible: false,
|
123
|
|
- })
|
|
131
|
+ phoneVisible: false
|
|
132
|
+ });
|
124
|
133
|
}
|
125
|
134
|
}
|
126
|
135
|
}
|
127
|
136
|
|
128
|
137
|
componentWillUnmount() {
|
129
|
|
- const { recordId } = this.state
|
130
|
|
- recordId && updatePoint(recordId)
|
|
138
|
+ const { recordId } = this.state;
|
|
139
|
+ recordId && updatePoint(recordId);
|
131
|
140
|
}
|
132
|
141
|
|
133
|
142
|
// 埋点
|
134
|
143
|
success() {
|
135
|
|
- const { codeParams, buildingId } = this.state
|
136
|
|
- const firstShare = this.$router.params.firstShare || codeParams.firstShare || ""
|
137
|
|
- const consultant = this.$router.params.consultant || codeParams.consultant || ""
|
138
|
|
- const sharePersonId = this.$router.params.sharePersonId || codeParams.sharePersonId || ""
|
139
|
|
- const h5Id = this.state.h5Id || this.$router.params.id
|
|
144
|
+ const { codeParams, buildingId } = this.state;
|
|
145
|
+ const firstShare =
|
|
146
|
+ this.$router.params.firstShare || codeParams.firstShare || "";
|
|
147
|
+ const consultant =
|
|
148
|
+ this.$router.params.consultant || codeParams.consultant || "";
|
|
149
|
+ const sharePersonId =
|
|
150
|
+ this.$router.params.sharePersonId || codeParams.sharePersonId || "";
|
|
151
|
+ const h5Id = this.state.h5Id || this.$router.params.id;
|
140
|
152
|
|
141
|
153
|
savePoint({
|
142
|
|
- event: 'detail',
|
143
|
|
- eventType: 'h5',
|
144
|
|
- propertyName: 'h5详情',
|
145
|
|
- buildingId: buildingId || '',
|
|
154
|
+ event: "detail",
|
|
155
|
+ eventType: "h5",
|
|
156
|
+ propertyName: "h5详情",
|
|
157
|
+ buildingId: buildingId || "",
|
146
|
158
|
consultantId: consultant,
|
147
|
159
|
sharePersonId: sharePersonId,
|
148
|
160
|
targetId: h5Id,
|
|
@@ -150,55 +162,76 @@ export default class Index extends Component {
|
150
|
162
|
}).then(res => {
|
151
|
163
|
this.setState({
|
152
|
164
|
recordId: res.recordId
|
153
|
|
- })
|
154
|
|
- console.log('访问记录')
|
155
|
|
- })
|
|
165
|
+ });
|
|
166
|
+ console.log("访问记录");
|
|
167
|
+ });
|
156
|
168
|
}
|
157
|
169
|
|
|
170
|
+ h5ExtendParams = null;
|
|
171
|
+
|
|
172
|
+ // H5 分享交互
|
|
173
|
+ handleMessage = e => {
|
|
174
|
+ const { data } = e.detail;
|
|
175
|
+ const { params } =
|
|
176
|
+ (data || []).reverse().filter(x => x.type === "share")[0] || {};
|
|
177
|
+
|
|
178
|
+ console.log("----share message----->", params);
|
|
179
|
+ if (params) {
|
|
180
|
+ this.h5ExtendParams = params;
|
|
181
|
+ }
|
|
182
|
+ };
|
|
183
|
+
|
158
|
184
|
// 分享好友
|
159
|
185
|
onShareAppMessage = () => {
|
160
|
|
- const { pageInfo, h5Id, buildingId } = this.state
|
161
|
|
- const currentPage = `/${this.currentPageAndParams().join('?')}`
|
162
|
|
- const { userInfo: { person: { personId, personType, userId } } } = this.props
|
163
|
|
- const consultantId = personType == ROLE_CODE['CONSULTANT'] ? userId : ""
|
164
|
|
-
|
165
|
|
- console.log(currentPage)
|
166
|
|
-
|
167
|
|
- shareSavePoint({
|
168
|
|
- event: 'share',
|
169
|
|
- eventType: 'activity',
|
170
|
|
- targetType: 'h5',
|
171
|
|
- propertyName: 'h5详情分享',
|
172
|
|
- consultantId: consultantId,
|
173
|
|
- sharePersonId: personId,
|
174
|
|
- targetId: h5Id,
|
175
|
|
- buildingId: buildingId || '',
|
176
|
|
- data: '{}'
|
177
|
|
- }, 'h5')
|
178
|
|
- // savePoint({
|
179
|
|
- // event: 'share',
|
180
|
|
- // eventType: 'h5',
|
181
|
|
- // propertyName: 'h5详情分享',
|
182
|
|
- // consultantId: consultantId,
|
183
|
|
- // sharePersonId: personId,
|
184
|
|
- // targetId: h5Id,
|
185
|
|
- // data: '{}'
|
186
|
|
- // }).then(res => {
|
187
|
|
- // console.info('h5详情分享')
|
188
|
|
- // })
|
|
186
|
+ const { pageInfo, h5Id, buildingId } = this.state;
|
|
187
|
+ const [currentPage, currentParams] = this.currentPageAndParams();
|
|
188
|
+ const sharePath = `/${currentPage}?${mergeQueryParams(
|
|
189
|
+ currentParams,
|
|
190
|
+ this.h5ExtendParams
|
|
191
|
+ )}`;
|
|
192
|
+ const {
|
|
193
|
+ userInfo: {
|
|
194
|
+ person: { personId, personType, userId }
|
|
195
|
+ }
|
|
196
|
+ } = this.props;
|
|
197
|
+ const consultantId = personType == ROLE_CODE["CONSULTANT"] ? userId : "";
|
|
198
|
+
|
|
199
|
+ // 用后即焚
|
|
200
|
+ this.h5ExtendParams = null;
|
|
201
|
+
|
|
202
|
+ console.log("----sharePath----->", sharePath);
|
|
203
|
+
|
|
204
|
+ shareSavePoint(
|
|
205
|
+ {
|
|
206
|
+ event: "share",
|
|
207
|
+ eventType: "activity",
|
|
208
|
+ targetType: "h5",
|
|
209
|
+ propertyName: "h5详情分享",
|
|
210
|
+ consultantId: consultantId,
|
|
211
|
+ sharePersonId: personId,
|
|
212
|
+ targetId: h5Id,
|
|
213
|
+ buildingId: buildingId || "",
|
|
214
|
+ data: "{}"
|
|
215
|
+ },
|
|
216
|
+ "h5"
|
|
217
|
+ );
|
|
218
|
+
|
189
|
219
|
return {
|
190
|
220
|
title: pageInfo.shareTitle,
|
191
|
|
- path: currentPage,
|
|
221
|
+ path: sharePath,
|
192
|
222
|
imageUrl: pageInfo.shareImg
|
193
|
|
- }
|
194
|
|
- }
|
|
223
|
+ };
|
|
224
|
+ };
|
195
|
225
|
|
196
|
226
|
currentPageAndParams() {
|
197
|
|
- const { userInfo: { person } } = this.props
|
198
|
|
- const { h5Id, buildingId } = this.state
|
|
227
|
+ const {
|
|
228
|
+ userInfo: { person }
|
|
229
|
+ } = this.props;
|
|
230
|
+ const { h5Id, buildingId } = this.state;
|
199
|
231
|
|
200
|
|
- const consultantId = person.personType == ROLE_CODE['CONSULTANT'] ? person.userId : ""
|
201
|
|
- const firstShare = this.$router.params.firstShare || person.personId
|
|
232
|
+ const consultantId =
|
|
233
|
+ person.personType == ROLE_CODE["CONSULTANT"] ? person.userId : "";
|
|
234
|
+ const firstShare = this.$router.params.firstShare || person.personId;
|
202
|
235
|
|
203
|
236
|
let queryParams = [
|
204
|
237
|
`sharePersonId=${person.personId}`,
|
|
@@ -209,178 +242,214 @@ export default class Index extends Component {
|
209
|
242
|
`firstShare=${firstShare}`,
|
210
|
243
|
`id=${h5Id}`,
|
211
|
244
|
`buildingId=${buildingId}`
|
212
|
|
- ]
|
|
245
|
+ ];
|
213
|
246
|
|
214
|
|
- const res = [
|
215
|
|
- 'pages/project/h5Page',
|
216
|
|
- queryParams.join('&'),
|
217
|
|
- ]
|
|
247
|
+ const res = ["pages/project/h5Page", queryParams.join("&")];
|
218
|
248
|
|
219
|
|
- return res
|
|
249
|
+ return res;
|
220
|
250
|
}
|
221
|
251
|
|
222
|
|
-
|
223
|
252
|
gotoIndex = () => {
|
224
|
253
|
Taro.switchTab({
|
225
|
|
- url: '/pages/project/index'
|
226
|
|
- })
|
227
|
|
- }
|
|
254
|
+ url: "/pages/project/index"
|
|
255
|
+ });
|
|
256
|
+ };
|
228
|
257
|
|
229
|
|
- loadH5Profile = (id) => {
|
|
258
|
+ loadH5Profile = id => {
|
230
|
259
|
// h5id 、第一个分享人ID、置业顾问ID、分享人ID
|
231
|
260
|
getHFiveDetail(id).then(res => {
|
232
|
|
- Taro.hideLoading()
|
|
261
|
+ Taro.hideLoading();
|
233
|
262
|
if (res.status == 1) {
|
234
|
263
|
this.setState({
|
235
|
264
|
pageInfo: res,
|
236
|
265
|
h5Id: id,
|
237
|
|
- buildingId: res.buildingId || '',
|
238
|
|
- })
|
|
266
|
+ buildingId: res.buildingId || ""
|
|
267
|
+ });
|
239
|
268
|
} else {
|
240
|
269
|
Taro.showModal({
|
241
|
|
- title: '提示',
|
242
|
|
- content: '活动已下架',
|
243
|
|
- showCancel: false,
|
|
270
|
+ title: "提示",
|
|
271
|
+ content: "活动已下架",
|
|
272
|
+ showCancel: false
|
244
|
273
|
}).then(() => {
|
245
|
|
- this.gotoIndex()
|
246
|
|
- })
|
|
274
|
+ this.gotoIndex();
|
|
275
|
+ });
|
247
|
276
|
}
|
248
|
|
- })
|
249
|
|
- }
|
|
277
|
+ });
|
|
278
|
+ };
|
250
|
279
|
|
251
|
280
|
// 授权头像成功
|
252
|
281
|
onAvatarSuccess() {
|
253
|
282
|
this.setState({
|
254
|
|
- avatarVisible: false,
|
255
|
|
-
|
256
|
|
- })
|
257
|
|
- const { userInfo: { person: { phone } } } = this.props
|
|
283
|
+ avatarVisible: false
|
|
284
|
+ });
|
|
285
|
+ const {
|
|
286
|
+ userInfo: {
|
|
287
|
+ person: { phone }
|
|
288
|
+ }
|
|
289
|
+ } = this.props;
|
258
|
290
|
if (phone) {
|
259
|
291
|
this.setState({
|
260
|
292
|
phoneVisible: false,
|
261
|
|
- webViewVisible: true,
|
262
|
|
- })
|
263
|
|
- this.success()
|
|
293
|
+ webViewVisible: true
|
|
294
|
+ });
|
|
295
|
+ this.success();
|
264
|
296
|
} else {
|
265
|
297
|
this.setState({
|
266
|
|
- phoneVisible: true,
|
267
|
|
- })
|
|
298
|
+ phoneVisible: true
|
|
299
|
+ });
|
268
|
300
|
}
|
269
|
|
- console.log("授权头像成功!")
|
|
301
|
+ console.log("授权头像成功!");
|
270
|
302
|
}
|
271
|
303
|
|
272
|
304
|
// 授权用户信息
|
273
|
305
|
getUserInfo() {
|
|
306
|
+ const { dispatchUpdateUserInfo } = this.props;
|
|
307
|
+ const sessionKey = Taro.getStorageSync("sessionKey");
|
274
|
308
|
|
275
|
|
- const { dispatchUpdateUserInfo } = this.props
|
276
|
|
- const sessionKey = Taro.getStorageSync('sessionKey')
|
277
|
|
-
|
278
|
|
- Taro.showLoading()
|
|
309
|
+ Taro.showLoading();
|
279
|
310
|
|
280
|
311
|
Taro.getUserInfo({
|
281
|
|
- lang: 'zh_CN',
|
|
312
|
+ lang: "zh_CN",
|
282
|
313
|
success: res => {
|
283
|
|
- const payload = Object.assign(res, { sessionKey })
|
284
|
|
- console.log(res, "获取用户信息返回值")
|
|
314
|
+ const payload = Object.assign(res, { sessionKey });
|
|
315
|
+ console.log(res, "获取用户信息返回值");
|
285
|
316
|
// 用户信息保存至服务器
|
286
|
317
|
dispatchUpdateUserInfo(payload).then(res => {
|
287
|
318
|
this.onAvatarSuccess();
|
288
|
|
- console.log('获取用户信息成功')
|
289
|
|
- Taro.hideLoading()
|
290
|
|
- })
|
|
319
|
+ console.log("获取用户信息成功");
|
|
320
|
+ Taro.hideLoading();
|
|
321
|
+ });
|
291
|
322
|
},
|
292
|
|
- fail: (err) => {
|
293
|
|
- Taro.hideLoading()
|
294
|
|
- console.error(err)
|
|
323
|
+ fail: err => {
|
|
324
|
+ Taro.hideLoading();
|
|
325
|
+ console.error(err);
|
295
|
326
|
this.setState({
|
296
|
|
- avatarVisible: true,
|
297
|
|
- })
|
|
327
|
+ avatarVisible: true
|
|
328
|
+ });
|
298
|
329
|
Taro.showToast({
|
299
|
|
- title: '获取用户信息失败',
|
300
|
|
- icon: 'none'
|
301
|
|
- })
|
302
|
|
- return
|
|
330
|
+ title: "获取用户信息失败",
|
|
331
|
+ icon: "none"
|
|
332
|
+ });
|
|
333
|
+ return;
|
303
|
334
|
}
|
304
|
|
- })
|
|
335
|
+ });
|
305
|
336
|
}
|
306
|
337
|
userInfoClick() {
|
307
|
|
- console.log('userInfoClick')
|
|
338
|
+ console.log("userInfoClick");
|
308
|
339
|
this.setState({
|
309
|
|
- avatarVisible: false,
|
310
|
|
- })
|
|
340
|
+ avatarVisible: false
|
|
341
|
+ });
|
311
|
342
|
}
|
312
|
343
|
// 授权手机号
|
313
|
344
|
getPhoneNumber(e) {
|
314
|
|
- const { buildingId, pageInfo } = this.state
|
315
|
|
- const loadOptions = wx.getLaunchOptionsSync()
|
|
345
|
+ const { buildingId, pageInfo } = this.state;
|
|
346
|
+ const loadOptions = wx.getLaunchOptionsSync();
|
316
|
347
|
const achieveParams = {
|
317
|
|
- buildingId: buildingId || '',
|
318
|
|
- targetName: pageInfo.name || '',
|
319
|
|
- targetType: 'h5',
|
320
|
|
- targetId: pageInfo.drainageId || '',
|
321
|
|
- promoter: Taro.getStorageSync('recommender'),
|
|
348
|
+ buildingId: buildingId || "",
|
|
349
|
+ targetName: pageInfo.name || "",
|
|
350
|
+ targetType: "h5",
|
|
351
|
+ targetId: pageInfo.drainageId || "",
|
|
352
|
+ promoter: Taro.getStorageSync("recommender"),
|
322
|
353
|
sceneId: loadOptions.scene
|
323
|
|
- }
|
324
|
|
- console.log(achieveParams, "achieveParamsachieveParamsachieveParamsachieveParams")
|
325
|
|
- getUserPhone(e, achieveParams, (phoneNumber) => {
|
|
354
|
+ };
|
|
355
|
+ console.log(
|
|
356
|
+ achieveParams,
|
|
357
|
+ "achieveParamsachieveParamsachieveParamsachieveParams"
|
|
358
|
+ );
|
|
359
|
+ getUserPhone(e, achieveParams, phoneNumber => {
|
326
|
360
|
if (!phoneNumber) {
|
327
|
361
|
Taro.showToast({
|
328
|
|
- title: '获取手机号失败',
|
329
|
|
- icon: 'none'
|
330
|
|
- })
|
|
362
|
+ title: "获取手机号失败",
|
|
363
|
+ icon: "none"
|
|
364
|
+ });
|
331
|
365
|
} else {
|
332
|
|
- ruleToast('signup-agent')
|
|
366
|
+ ruleToast("signup-agent");
|
333
|
367
|
setTimeout(() => {
|
334
|
|
- this.success()
|
335
|
|
- this.reportClientFn()
|
|
368
|
+ this.success();
|
|
369
|
+ this.reportClientFn();
|
336
|
370
|
this.setState({
|
337
|
371
|
phoneVisible: false,
|
338
|
|
- webViewVisible: true,
|
339
|
|
- })
|
340
|
|
- }, 1000)
|
|
372
|
+ webViewVisible: true
|
|
373
|
+ });
|
|
374
|
+ }, 1000);
|
341
|
375
|
}
|
342
|
|
- })
|
|
376
|
+ });
|
343
|
377
|
}
|
344
|
378
|
// 报备客户
|
345
|
379
|
reportClientFn() {
|
346
|
|
- const { codeParams } = this.state
|
347
|
|
- const consultant = this.$router.params.consultant || codeParams.consultant || ""
|
348
|
|
- const { userInfo: { person } } = this.props
|
|
380
|
+ const { codeParams } = this.state;
|
|
381
|
+ const consultant =
|
|
382
|
+ this.$router.params.consultant || codeParams.consultant || "";
|
|
383
|
+ const {
|
|
384
|
+ userInfo: { person }
|
|
385
|
+ } = this.props;
|
349
|
386
|
|
350
|
387
|
if (!this.state.reportedCustomer) {
|
351
|
388
|
reportCustomer(person, consultant).then(() => {
|
352
|
|
- this.setState({ reportedCustomer: true })
|
353
|
|
- })
|
|
389
|
+ this.setState({ reportedCustomer: true });
|
|
390
|
+ });
|
354
|
391
|
}
|
355
|
392
|
}
|
356
|
393
|
|
357
|
394
|
renderMaskBanner() {
|
358
|
|
- const { avatarVisible, phoneVisible, pageInfo, h5Id } = this.state
|
|
395
|
+ const { avatarVisible, phoneVisible, pageInfo, h5Id } = this.state;
|
359
|
396
|
return (
|
360
|
397
|
<View>
|
361
|
|
- <Image src={pageInfo.middleImg || bgImg} mode='widthFix' className='bg_img'></Image>
|
|
398
|
+ <Image
|
|
399
|
+ src={pageInfo.middleImg || bgImg}
|
|
400
|
+ mode="widthFix"
|
|
401
|
+ className="bg_img"
|
|
402
|
+ ></Image>
|
362
|
403
|
<View className="middle-page">
|
363
|
|
- {avatarVisible && h5Id &&
|
|
404
|
+ {avatarVisible && h5Id && (
|
364
|
405
|
<View className="content">
|
365
|
406
|
<View className="title">授权头像,围观活动</View>
|
366
|
|
- <View className="touxiang"><open-data type="userAvatarUrl"></open-data></View>
|
367
|
|
- <View className="name"><open-data type="userNickName"></open-data></View>
|
368
|
|
- <Button className="btn" open-type="getUserInfo" lang="zh_CN" onClick={this.userInfoClick} onGetUserInfo={this.getUserInfo}>好</Button>
|
|
407
|
+ <View className="touxiang">
|
|
408
|
+ <open-data type="userAvatarUrl"></open-data>
|
|
409
|
+ </View>
|
|
410
|
+ <View className="name">
|
|
411
|
+ <open-data type="userNickName"></open-data>
|
|
412
|
+ </View>
|
|
413
|
+ <Button
|
|
414
|
+ className="btn"
|
|
415
|
+ open-type="getUserInfo"
|
|
416
|
+ lang="zh_CN"
|
|
417
|
+ onClick={this.userInfoClick}
|
|
418
|
+ onGetUserInfo={this.getUserInfo}
|
|
419
|
+ >
|
|
420
|
+ 好
|
|
421
|
+ </Button>
|
369
|
422
|
</View>
|
370
|
|
- }
|
371
|
|
- {phoneVisible && h5Id &&
|
372
|
|
- <Button className="phone-btn" open-type="getPhoneNumber" lang="zh_CN" onGetphonenumber={this.getPhoneNumber}>点击授权查看详情</Button>
|
373
|
|
- }
|
|
423
|
+ )}
|
|
424
|
+ {phoneVisible && h5Id && (
|
|
425
|
+ <Button
|
|
426
|
+ className="phone-btn"
|
|
427
|
+ open-type="getPhoneNumber"
|
|
428
|
+ lang="zh_CN"
|
|
429
|
+ onGetphonenumber={this.getPhoneNumber}
|
|
430
|
+ >
|
|
431
|
+ 点击授权查看详情
|
|
432
|
+ </Button>
|
|
433
|
+ )}
|
374
|
434
|
</View>
|
375
|
435
|
</View>
|
376
|
|
- )
|
|
436
|
+ );
|
377
|
437
|
}
|
378
|
438
|
render() {
|
379
|
|
-
|
380
|
|
- const { pageInfo, webViewVisible, codeParams, pageHide, h5Id, buildingId } = this.state
|
381
|
|
- const { userInfo: { person } } = this.props
|
382
|
|
- const consultant = person.personType == ROLE_CODE['CONSULTANT'] ? person.userId : ""
|
383
|
|
- const firstShare = this.$router.params.firstShare || person.personId
|
|
439
|
+ const {
|
|
440
|
+ pageInfo,
|
|
441
|
+ webViewVisible,
|
|
442
|
+ codeParams,
|
|
443
|
+ pageHide,
|
|
444
|
+ h5Id,
|
|
445
|
+ buildingId
|
|
446
|
+ } = this.state;
|
|
447
|
+ const {
|
|
448
|
+ userInfo: { person }
|
|
449
|
+ } = this.props;
|
|
450
|
+ const consultant =
|
|
451
|
+ person.personType == ROLE_CODE["CONSULTANT"] ? person.userId : "";
|
|
452
|
+ const firstShare = this.$router.params.firstShare || person.personId;
|
384
|
453
|
const webUrlParams = [
|
385
|
454
|
`personId=${person.personId}`,
|
386
|
455
|
`recommender=${person.personId}`,
|
|
@@ -388,20 +457,30 @@ export default class Index extends Component {
|
388
|
457
|
`buildingId=${buildingId}`,
|
389
|
458
|
`consultant=${consultant}`,
|
390
|
459
|
`firstShare=${firstShare}`,
|
391
|
|
- `codeParams=${encodeURIComponent(codeParams['__raw'])}`,
|
392
|
|
- ].join('&')
|
393
|
|
-
|
394
|
|
- const showH5 = !isEmpty(h5Id) && pageInfo.h5Address && pageInfo.h5Address !== 'about' && pageInfo.h5Address !== 'http://about' && pageInfo.h5Address !== 'https://about'
|
395
|
|
-
|
396
|
|
- const originURL = parseURL(pageInfo.h5Address) || {}
|
397
|
|
- const queryString = [webUrlParams, originURL.query].join('&')
|
398
|
|
- const webURL = [`${originURL.origin}${originURL.path}?${queryString}`, originURL.hash].join('#')
|
|
460
|
+ `codeParams=${encodeURIComponent(codeParams["__raw"])}`
|
|
461
|
+ ].join("&");
|
|
462
|
+
|
|
463
|
+ const showH5 =
|
|
464
|
+ !isEmpty(h5Id) &&
|
|
465
|
+ pageInfo.h5Address &&
|
|
466
|
+ pageInfo.h5Address !== "about" &&
|
|
467
|
+ pageInfo.h5Address !== "http://about" &&
|
|
468
|
+ pageInfo.h5Address !== "https://about";
|
|
469
|
+
|
|
470
|
+ const originURL = parseURL(pageInfo.h5Address) || {};
|
|
471
|
+ const queryString = [webUrlParams, originURL.query].join("&");
|
|
472
|
+ const webURL = [
|
|
473
|
+ `${originURL.origin}${originURL.path}?${queryString}`,
|
|
474
|
+ originURL.hash
|
|
475
|
+ ].join("#");
|
399
|
476
|
|
400
|
477
|
return (
|
401
|
478
|
<Block>
|
402
|
479
|
{this.renderMaskBanner()}
|
403
|
|
- {webViewVisible && showH5 && <WebView src={webURL} />}
|
|
480
|
+ {webViewVisible && showH5 && (
|
|
481
|
+ <WebView src={webURL} onMessage={this.handleMessage} />
|
|
482
|
+ )}
|
404
|
483
|
</Block>
|
405
|
|
- )
|
|
484
|
+ );
|
406
|
485
|
}
|
407
|
486
|
}
|