@conecli/cone-render 0.9.1-shop2.18 → 0.9.1-shop2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import { JdJumpJdApp } from './jdJumpJdApp'
|
|
2
1
|
reportClick,
|
|
3
2
|
reportPV,
|
|
4
3
|
reportToCart,
|
|
5
4
|
routerInfo: {
|
|
6
5
|
params: {},
|
|
7
6
|
},
|
|
8
7
|
nativeEvent: null,
|
|
9
8
|
jumpConfig: {
|
|
10
9
|
venderId: null,
|
|
11
10
|
shopId: null,
|
|
12
11
|
sourceValue: '',
|
|
13
12
|
sourceType: 'App-H5',
|
|
14
13
|
activityType: 'shopx',
|
|
15
14
|
moduleId: 'none',
|
|
16
15
|
entrance: 'none',
|
|
17
16
|
},
|
|
18
17
|
logPageParamStr: '',
|
|
19
18
|
public logPageId: string
|
|
20
19
|
public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
|
|
21
20
|
constructor(opt = {}) {
|
|
22
21
|
super(opt)
|
|
23
22
|
this.getConfig(opt)
|
|
24
23
|
}
|
|
25
24
|
getConfig(opt = {}) {
|
|
26
25
|
return Object.assign(this, {}, defaultConfig, opt)
|
|
27
26
|
}
|
|
28
27
|
updateInfo(
|
|
29
28
|
routerInfo,
|
|
30
29
|
logPname = LogPnameInfo.HOME,
|
|
31
30
|
pageId = LogPageIdInfo.APP,
|
|
32
31
|
) {
|
|
33
32
|
this.logPageId = pageId
|
|
34
33
|
this.routerInfo = routerInfo
|
|
35
34
|
this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params)
|
|
36
35
|
this.logPname = logPname
|
|
37
36
|
}
|
|
38
37
|
reportInfoPv(
|
|
39
38
|
pageId = LogPageIdInfo.APP,
|
|
40
39
|
opt: {
|
|
41
40
|
pageParam?: any
|
|
42
41
|
} = {},
|
|
43
42
|
) {
|
|
44
43
|
const { pageParam } = opt
|
|
45
44
|
this.logPageParamStr = pageParam
|
|
46
45
|
? pageParam
|
|
47
46
|
: this.creatParamToLogStr(this.jumpConfig)
|
|
48
47
|
.replace(/moduleId/, 'JumpmoduleID')
|
|
49
48
|
.replace(/entrance/, 'Jumpentrance')
|
|
50
49
|
reportPV({
|
|
51
50
|
pageId,
|
|
52
51
|
pageParam: this.logPageParamStr,
|
|
53
52
|
...opt,
|
|
54
53
|
})
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
jdJumpToDongDongChatGroup(groupId, source = '4') {
|
|
58
57
|
this.jdNavigateToNative({
|
|
59
58
|
category: 'jump',
|
|
60
59
|
des: 'dongdong_group_chat',
|
|
61
60
|
source: source,
|
|
62
61
|
groupId: `${groupId}`,
|
|
63
62
|
})
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
jdJumpToWeb(
|
|
67
66
|
url,
|
|
68
67
|
logEventInfo,
|
|
69
68
|
successBack?: Function | undefined,
|
|
70
69
|
failBack?: Function | undefined,
|
|
71
70
|
) {
|
|
72
71
|
console.log('jd web',this.isOpenJdAppUrl(url),url)
|
|
73
72
|
if (this.isOpenJdAppUrl(url)) {
|
|
74
73
|
const getOpenAppParams = this.jdOpenAppParams(url)
|
|
75
74
|
console.log(
|
|
76
75
|
'jd web 获取自定义openApp链接解析后的参数结果',
|
|
77
76
|
getOpenAppParams,
|
|
78
77
|
)
|
|
79
78
|
if (getOpenAppParams) {
|
|
80
79
|
this.jdNavigateToNative(
|
|
81
80
|
Object.assign({}, getOpenAppParams, {
|
|
82
81
|
logEventInfo,
|
|
83
82
|
}),
|
|
84
83
|
)
|
|
85
84
|
}
|
|
86
85
|
} else {
|
|
87
86
|
const getLastUrl = !/jwebprog=0/.test(url) ? `${url}${url.indexOf("?") !== -1 ? '&jwebprog=0' : '?jwebprog=0'}` : url
|
|
88
87
|
super.jdJumpToWeb(
|
|
89
88
|
getLastUrl,
|
|
90
89
|
{
|
|
91
90
|
...logEventInfo,
|
|
92
91
|
},
|
|
93
92
|
successBack,
|
|
94
93
|
failBack,
|
|
95
94
|
)
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
jdJumpToWebInner(url, logEventInfo) {
|
|
100
99
|
this.jdJumpToWeb(url, logEventInfo)
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
jdJumpConfigUrl(detail, logEventInfo = {}) {
|
|
104
103
|
const { configDataType, configDataValue } = detail
|
|
105
104
|
switch (configDataType) {
|
|
106
105
|
case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
|
|
107
106
|
this.jdJumpToShopCategory({
|
|
108
107
|
...configDataValue,
|
|
109
108
|
logEventInfo,
|
|
110
109
|
})
|
|
111
110
|
break
|
|
112
111
|
case LinkConfigType.CONFIG_TYPE_SKU_LIST:
|
|
113
112
|
if(logEventInfo?.jsonParam?.logBaseInfo?.mInfo){
|
|
114
113
|
logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds
|
|
115
114
|
}
|
|
116
115
|
this.jdJumpToProduct(configDataValue.skuIds, logEventInfo)
|
|
117
116
|
break
|
|
118
117
|
case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
|
|
119
118
|
this.jdJumpToWeb(
|
|
120
119
|
`${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
|
|
121
120
|
{},
|
|
122
121
|
)
|
|
123
122
|
break
|
|
124
123
|
case LinkConfigType.CONFIG_TYPE_CATEGORY:
|
|
125
124
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
126
125
|
const getShopSearchParams = this.jdOpenAppParams(
|
|
127
126
|
configDataValue.clickUrl,
|
|
128
127
|
)
|
|
129
128
|
console.log(
|
|
130
129
|
'jd web 获取店铺分类链接解析后的参数结果',
|
|
131
130
|
getShopSearchParams,
|
|
132
131
|
)
|
|
133
132
|
getShopSearchParams &&
|
|
134
133
|
this.jdJumpToShopSearch(
|
|
135
134
|
Object.assign({}, getShopSearchParams, {
|
|
136
135
|
logEventInfo,
|
|
137
136
|
}),
|
|
138
137
|
)
|
|
139
138
|
} else {
|
|
140
139
|
this.jdJumpToShopSearch(
|
|
141
140
|
configDataValue['cid']
|
|
142
141
|
? Object.assign(
|
|
143
142
|
{},
|
|
144
143
|
{
|
|
145
144
|
shopId: global.info.queryInfo.shopId,
|
|
146
145
|
categoryId: configDataValue.cid,
|
|
147
146
|
searchType: '5',
|
|
148
147
|
logEventInfo,
|
|
149
148
|
},
|
|
150
149
|
)
|
|
151
150
|
: {
|
|
152
151
|
shopId: global.info.queryInfo.shopId,
|
|
153
152
|
logEventInfo,
|
|
154
153
|
},
|
|
155
154
|
)
|
|
156
155
|
}
|
|
157
156
|
break
|
|
158
157
|
case LinkConfigType.CONFIG_TYPE_MEMBER:
|
|
159
158
|
if(isAppHomeForMarketPage){
|
|
160
159
|
this.jdJumpToBottomTabBrandMember({
|
|
161
160
|
logEventInfo
|
|
162
161
|
})
|
|
163
162
|
}else {
|
|
164
163
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
165
164
|
const getShopMemberParams = this.jdOpenAppParams(
|
|
166
165
|
configDataValue.clickUrl,
|
|
167
166
|
)
|
|
168
167
|
getShopMemberParams &&
|
|
169
168
|
this.jdJumpToShopMember(
|
|
170
169
|
Object.assign({}, getShopMemberParams, {
|
|
171
170
|
logEventInfo,
|
|
172
171
|
}),
|
|
173
172
|
)
|
|
174
173
|
} else {
|
|
175
174
|
this.jdJumpToShopMember({
|
|
176
175
|
shopId: global.info.queryInfo.shopId,
|
|
177
176
|
venderId: configDataValue.shopDetail,
|
|
178
177
|
logEventInfo,
|
|
179
178
|
})
|
|
180
179
|
}
|
|
181
180
|
}
|
|
182
181
|
break
|
|
183
182
|
case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
|
|
184
183
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
185
184
|
const getShopActivityParams = this.jdOpenAppParams(
|
|
186
185
|
configDataValue.clickUrl,
|
|
187
186
|
)
|
|
188
187
|
getShopActivityParams &&
|
|
189
188
|
this.jdJumpToShopActivity(
|
|
190
189
|
Object.assign({}, getShopActivityParams, {
|
|
191
190
|
logEventInfo,
|
|
192
191
|
}),
|
|
193
192
|
)
|
|
194
193
|
} else if (configDataValue['projectId']) {
|
|
195
194
|
this.jdJumpToShopActivity({
|
|
196
195
|
projectId: configDataValue['projectId'],
|
|
197
196
|
configDataValue,
|
|
198
197
|
logEventInfo,
|
|
199
198
|
})
|
|
200
199
|
}
|
|
201
200
|
break
|
|
202
201
|
case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
|
|
203
202
|
case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
|
|
204
203
|
const _url = configDataValue.linkUrl
|
|
205
204
|
if (
|
|
206
205
|
_url.indexOf('to=') === -1 &&
|
|
207
206
|
_url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
|
|
208
207
|
) {
|
|
209
208
|
const _shopId = _url.match(/\d+/g)[0]
|
|
210
209
|
this.jdJumpToShopHome({
|
|
211
210
|
shopId: `${_shopId}`,
|
|
212
211
|
logEventInfo,
|
|
213
212
|
})
|
|
214
213
|
} else if (this.isOpenJdAppUrl(_url)) {
|
|
215
214
|
const getOpenAppParams = this.jdOpenAppParams(_url)
|
|
216
215
|
console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
|
|
217
216
|
if (getOpenAppParams) {
|
|
218
217
|
let _changeOpenAppParams = getOpenAppParams
|
|
219
218
|
if(isAppHomeForMarketPage){
|
|
220
219
|
const { operation, ...otherOpenAppParams } = getOpenAppParams
|
|
221
220
|
if(operation && operation === 'jumpTabInner'){
|
|
222
221
|
_changeOpenAppParams = otherOpenAppParams
|
|
223
222
|
}
|
|
224
223
|
}
|
|
225
224
|
this.jdNavigateToNative(
|
|
226
225
|
Object.assign({}, _changeOpenAppParams, {
|
|
227
226
|
logEventInfo,
|
|
228
227
|
}),
|
|
229
228
|
)
|
|
230
229
|
}
|
|
231
230
|
} else {
|
|
232
231
|
this.jdJumpToWeb(_url, logEventInfo)
|
|
233
232
|
}
|
|
234
233
|
break
|
|
235
234
|
}
|
|
236
235
|
case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
|
|
237
236
|
this.jdJumpToShopDetail({
|
|
238
237
|
venderId: global.info.queryInfo.venderId,
|
|
239
238
|
shopId: global.info.queryInfo.shopId,
|
|
240
239
|
logEventInfo,
|
|
241
240
|
})
|
|
242
241
|
break
|
|
243
242
|
case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
|
|
244
243
|
this.jdJumpToShopHome({
|
|
245
244
|
...configDataValue,
|
|
246
245
|
logEventInfo,
|
|
247
246
|
})
|
|
248
247
|
break
|
|
249
248
|
case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
|
|
250
249
|
break
|
|
251
250
|
case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
|
|
252
251
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
253
252
|
const getShoppingGuideParams = this.jdOpenAppParams(
|
|
254
253
|
configDataValue.clickUrl,
|
|
255
254
|
)
|
|
256
255
|
getShoppingGuideParams &&
|
|
257
256
|
this.jdJumpToShopActivity(
|
|
258
257
|
Object.assign({}, getShoppingGuideParams, {
|
|
259
258
|
logEventInfo,
|
|
260
259
|
}),
|
|
261
260
|
)
|
|
262
261
|
}
|
|
263
262
|
break
|
|
264
263
|
case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
|
|
265
264
|
const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '')
|
|
266
265
|
const search = linkUrl.match(/\?.+/)
|
|
267
266
|
if (search) {
|
|
268
267
|
const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
|
|
269
268
|
parseQueryUrlString(linkUrl)
|
|
270
269
|
try {
|
|
271
270
|
miniQueryData.param = JSON.parse(<string>miniQueryData?.param)
|
|
272
271
|
} catch (e) {
|
|
273
272
|
console.warn('解析小程序 param 错误:', miniQueryData.param)
|
|
274
273
|
}
|
|
275
274
|
this.jdJumpToMiniProgram(miniQueryData)
|
|
276
275
|
} else {
|
|
277
276
|
console.warn('小程序地址错误:', linkUrl)
|
|
278
277
|
}
|
|
279
278
|
break
|
|
280
279
|
}
|
|
281
280
|
case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
|
|
282
281
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
283
282
|
const getShopSearchParams = this.jdOpenAppParams(
|
|
284
283
|
configDataValue.clickUrl,
|
|
285
284
|
)
|
|
286
285
|
console.log(
|
|
287
286
|
'jd web 获取店铺结果落地页链接解析后的参数结果',
|
|
288
287
|
getShopSearchParams,
|
|
289
288
|
)
|
|
290
289
|
getShopSearchParams &&
|
|
291
290
|
this.jdJumpToShopSearch(
|
|
292
291
|
Object.assign({}, getShopSearchParams, {
|
|
293
292
|
logEventInfo,
|
|
294
293
|
}),
|
|
295
294
|
)
|
|
296
295
|
} else {
|
|
297
296
|
this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo)
|
|
298
297
|
}
|
|
299
298
|
break
|
|
300
299
|
}
|
|
301
300
|
default:
|
|
302
301
|
}
|
|
303
302
|
}
|
|
304
303
|
|
|
305
304
|
jdNavigateToNative(
|
|
306
305
|
params: {},
|
|
307
306
|
url = 'openapp.jdmobile://virtual',
|
|
308
307
|
successBack?: Function | null,
|
|
309
308
|
failBack?: Function | null,
|
|
310
309
|
) {
|
|
311
310
|
console.log('[降级H5] jdNavigateToNative web.jd:', params)
|
|
312
311
|
const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
|
|
313
312
|
Object.assign(
|
|
314
313
|
{},
|
|
315
314
|
{
|
|
316
315
|
sourceValue: 'sourceValue_jshopModuleWeb',
|
|
317
316
|
sourceType: 'sourceType_jshopModuleWeb',
|
|
318
317
|
param: {},
|
|
319
318
|
},
|
|
320
319
|
params,
|
|
321
320
|
)
|
|
322
321
|
const { logEventInfo, ...otherParams } = getResParams
|
|
323
322
|
console.log(
|
|
324
323
|
'jd web 获取open协议参数 jdNavigateToNative params: ',
|
|
325
324
|
getResParams,
|
|
326
325
|
)
|
|
327
326
|
console.log('logEventInfo params: ', logEventInfo)
|
|
328
327
|
global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
|
|
329
328
|
this.clickEventLog(logEventInfo || getResParams)
|
|
330
329
|
.then(() => {
|
|
331
330
|
if (typeof successBack == 'function') {
|
|
332
331
|
successBack(getResParams)
|
|
333
332
|
} else {
|
|
334
333
|
try {
|
|
335
334
|
const paramsStr = JSON.stringify(otherParams)
|
|
336
335
|
console.log('跳转web jd open协议', `${url}?params=${paramsStr}`)
|
|
337
336
|
window.location.href = `${url}?params=${paramsStr}`
|
|
338
337
|
} catch (e) {
|
|
339
338
|
console.log('跳转异常', e)
|
|
340
339
|
}
|
|
341
340
|
}
|
|
342
341
|
})
|
|
343
342
|
.catch(() => {
|
|
344
343
|
typeof failBack == 'function' && failBack(getResParams)
|
|
345
344
|
})
|
|
346
345
|
}
|
|
347
346
|
|
|
348
347
|
clickEventLog(
|
|
349
348
|
opts: JumpEventReportInterFace.OptEventLogParams = {},
|
|
350
349
|
reportKey = 'click',
|
|
351
350
|
) {
|
|
352
351
|
const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
|
|
353
352
|
if (eventId && jsonParam) {
|
|
354
353
|
const { etModelInfo, logBaseInfo } = jsonParam
|
|
355
354
|
let getJsonParam = {}
|
|
356
355
|
if (etModelInfo && logBaseInfo) {
|
|
357
356
|
getJsonParam = logBaseInfo
|
|
358
357
|
} else {
|
|
359
358
|
if (Array.isArray(jsonParam)){
|
|
360
359
|
getJsonParam = jsonParam
|
|
361
360
|
} else {
|
|
362
361
|
getJsonParam = Object.assign(
|
|
363
362
|
{},
|
|
364
363
|
{
|
|
365
364
|
shopid: global.info.queryInfo?.shopId,
|
|
366
365
|
},
|
|
367
366
|
jsonParam,
|
|
368
367
|
)
|
|
369
368
|
}
|
|
370
369
|
}
|
|
371
370
|
if(reportKey === 'exposure' && /^TerminatorNew/.test(eventId) && !Array.isArray(getJsonParam)){
|
|
372
371
|
getJsonParam = [getJsonParam]
|
|
373
372
|
}
|
|
374
373
|
const webLogParams = {
|
|
375
374
|
eid: eventId,
|
|
376
375
|
elevel: eventLevel,
|
|
377
376
|
jsonParam: JSON.stringify(getJsonParam),
|
|
378
377
|
etModel: JSON.stringify(etModelInfo || {}),
|
|
379
378
|
pageId: this.logPageId,
|
|
380
379
|
pageParam: this.logPageParamStr,
|
|
381
380
|
...otherParams,
|
|
382
381
|
}
|
|
383
382
|
return /click|exposure/.test(reportKey)
|
|
384
383
|
? reportClick(webLogParams)
|
|
385
384
|
: reportToCart(opts,webLogParams)
|
|
386
385
|
} else {
|
|
387
386
|
console.log('暂无埋点参数eventId和eventParam')
|
|
388
387
|
return Promise.resolve(false)
|
|
389
388
|
}
|
|
390
389
|
}
|
|
391
390
|
|
|
392
391
|
exposureEventLog(opts) {
|
|
393
392
|
return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
|
|
394
393
|
? this.clickEventLog(
|
|
395
394
|
{
|
|
396
395
|
...opts,
|
|
397
396
|
exposureState: true,
|
|
398
397
|
},
|
|
399
398
|
'exposure',
|
|
400
399
|
)
|
|
401
400
|
: Promise.resolve(false)
|
|
402
401
|
}
|
|
402
|
+
import { JdJumpJdApp } from './jdJumpJdApp'
|
|
403
403
|
reportClick,
|
|
404
404
|
reportPV,
|
|
405
405
|
reportToCart,
|
|
406
406
|
routerInfo: {
|
|
407
407
|
params: {},
|
|
408
408
|
},
|
|
409
409
|
nativeEvent: null,
|
|
410
410
|
jumpConfig: {
|
|
411
411
|
venderId: null,
|
|
412
412
|
shopId: null,
|
|
413
413
|
sourceValue: '',
|
|
414
414
|
sourceType: 'App-H5',
|
|
415
415
|
activityType: 'shopx',
|
|
416
416
|
moduleId: 'none',
|
|
417
417
|
entrance: 'none',
|
|
418
418
|
},
|
|
419
419
|
logPageParamStr: '',
|
|
420
420
|
public logPageId: string
|
|
421
421
|
public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig
|
|
422
422
|
constructor(opt = {}) {
|
|
423
423
|
super(opt)
|
|
424
424
|
this.getConfig(opt)
|
|
425
425
|
}
|
|
426
426
|
getConfig(opt = {}) {
|
|
427
427
|
return Object.assign(this, {}, defaultConfig, opt)
|
|
428
428
|
}
|
|
429
429
|
updateInfo(
|
|
430
430
|
routerInfo,
|
|
431
431
|
logPname = LogPnameInfo.HOME,
|
|
432
432
|
pageId = LogPageIdInfo.APP,
|
|
433
433
|
) {
|
|
434
434
|
this.logPageId = pageId
|
|
435
435
|
this.routerInfo = routerInfo
|
|
436
436
|
this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params)
|
|
437
437
|
this.logPname = logPname
|
|
438
438
|
}
|
|
439
439
|
reportInfoPv(
|
|
440
440
|
pageId = LogPageIdInfo.APP,
|
|
441
441
|
opt: {
|
|
442
442
|
pageParam?: any
|
|
443
443
|
} = {},
|
|
444
444
|
) {
|
|
445
445
|
const { pageParam } = opt
|
|
446
446
|
this.logPageParamStr = pageParam
|
|
447
447
|
? pageParam
|
|
448
448
|
: this.creatParamToLogStr(this.jumpConfig)
|
|
449
449
|
.replace(/moduleId/, 'JumpmoduleID')
|
|
450
450
|
.replace(/entrance/, 'Jumpentrance')
|
|
451
451
|
reportPV({
|
|
452
452
|
pageId,
|
|
453
453
|
pageParam: this.logPageParamStr,
|
|
454
454
|
...opt,
|
|
455
455
|
})
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
jdJumpToDongDongChatGroup(groupId, source = '4') {
|
|
459
459
|
this.jdNavigateToNative({
|
|
460
460
|
category: 'jump',
|
|
461
461
|
des: 'dongdong_group_chat',
|
|
462
462
|
source: source,
|
|
463
463
|
groupId: `${groupId}`,
|
|
464
464
|
})
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
jdJumpToWeb(
|
|
468
468
|
url,
|
|
469
469
|
logEventInfo,
|
|
470
470
|
successBack?: Function | undefined,
|
|
471
471
|
failBack?: Function | undefined,
|
|
472
472
|
) {
|
|
473
473
|
console.log('jd web',this.isOpenJdAppUrl(url),url)
|
|
474
474
|
if (this.isOpenJdAppUrl(url)) {
|
|
475
475
|
const getOpenAppParams = this.jdOpenAppParams(url)
|
|
476
476
|
console.log(
|
|
477
477
|
'jd web 获取自定义openApp链接解析后的参数结果',
|
|
478
478
|
getOpenAppParams,
|
|
479
479
|
)
|
|
480
480
|
if (getOpenAppParams) {
|
|
481
481
|
this.jdNavigateToNative(
|
|
482
482
|
Object.assign({}, getOpenAppParams, {
|
|
483
483
|
logEventInfo,
|
|
484
484
|
}),
|
|
485
485
|
)
|
|
486
486
|
}
|
|
487
487
|
} else {
|
|
488
488
|
let _getLastUrl = url
|
|
489
489
|
if(/shop\.m\.jd\.com|pages\.jd\.com/.test(url)){
|
|
490
490
|
_getLastUrl = !/jwebprog=0/.test(url) ? `${url}${url.indexOf("?") !== -1 ? '&jwebprog=0' : '?jwebprog=0'}` : url
|
|
491
491
|
}
|
|
492
492
|
super.jdJumpToWeb(
|
|
493
493
|
_getLastUrl,
|
|
494
494
|
{
|
|
495
495
|
...logEventInfo,
|
|
496
496
|
},
|
|
497
497
|
successBack,
|
|
498
498
|
failBack,
|
|
499
499
|
)
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
jdJumpToWebInner(url, logEventInfo) {
|
|
504
504
|
this.jdJumpToWeb(url, logEventInfo)
|
|
505
505
|
}
|
|
506
506
|
|
|
507
507
|
jdJumpConfigUrl(detail, logEventInfo = {}) {
|
|
508
508
|
const { configDataType, configDataValue } = detail
|
|
509
509
|
switch (configDataType) {
|
|
510
510
|
case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
|
|
511
511
|
this.jdJumpToShopCategory({
|
|
512
512
|
...configDataValue,
|
|
513
513
|
logEventInfo,
|
|
514
514
|
})
|
|
515
515
|
break
|
|
516
516
|
case LinkConfigType.CONFIG_TYPE_SKU_LIST:
|
|
517
517
|
if(logEventInfo?.jsonParam?.logBaseInfo?.mInfo){
|
|
518
518
|
logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds
|
|
519
519
|
}
|
|
520
520
|
this.jdJumpToProduct(configDataValue.skuIds, logEventInfo)
|
|
521
521
|
break
|
|
522
522
|
case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
|
|
523
523
|
this.jdJumpToWeb(
|
|
524
524
|
`${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
|
|
525
525
|
{},
|
|
526
526
|
)
|
|
527
527
|
break
|
|
528
528
|
case LinkConfigType.CONFIG_TYPE_CATEGORY:
|
|
529
529
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
530
530
|
const getShopSearchParams = this.jdOpenAppParams(
|
|
531
531
|
configDataValue.clickUrl,
|
|
532
532
|
)
|
|
533
533
|
console.log(
|
|
534
534
|
'jd web 获取店铺分类链接解析后的参数结果',
|
|
535
535
|
getShopSearchParams,
|
|
536
536
|
)
|
|
537
537
|
getShopSearchParams &&
|
|
538
538
|
this.jdJumpToShopSearch(
|
|
539
539
|
Object.assign({}, getShopSearchParams, {
|
|
540
540
|
logEventInfo,
|
|
541
541
|
}),
|
|
542
542
|
)
|
|
543
543
|
} else {
|
|
544
544
|
this.jdJumpToShopSearch(
|
|
545
545
|
configDataValue['cid']
|
|
546
546
|
? Object.assign(
|
|
547
547
|
{},
|
|
548
548
|
{
|
|
549
549
|
shopId: global.info.queryInfo.shopId,
|
|
550
550
|
categoryId: configDataValue.cid,
|
|
551
551
|
searchType: '5',
|
|
552
552
|
logEventInfo,
|
|
553
553
|
},
|
|
554
554
|
)
|
|
555
555
|
: {
|
|
556
556
|
shopId: global.info.queryInfo.shopId,
|
|
557
557
|
logEventInfo,
|
|
558
558
|
},
|
|
559
559
|
)
|
|
560
560
|
}
|
|
561
561
|
break
|
|
562
562
|
case LinkConfigType.CONFIG_TYPE_MEMBER:
|
|
563
563
|
if(isAppHomeForMarketPage){
|
|
564
564
|
this.jdJumpToBottomTabBrandMember({
|
|
565
565
|
logEventInfo
|
|
566
566
|
})
|
|
567
567
|
}else {
|
|
568
568
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
569
569
|
const getShopMemberParams = this.jdOpenAppParams(
|
|
570
570
|
configDataValue.clickUrl,
|
|
571
571
|
)
|
|
572
572
|
getShopMemberParams &&
|
|
573
573
|
this.jdJumpToShopMember(
|
|
574
574
|
Object.assign({}, getShopMemberParams, {
|
|
575
575
|
logEventInfo,
|
|
576
576
|
}),
|
|
577
577
|
)
|
|
578
578
|
} else {
|
|
579
579
|
this.jdJumpToShopMember({
|
|
580
580
|
shopId: global.info.queryInfo.shopId,
|
|
581
581
|
venderId: configDataValue.shopDetail,
|
|
582
582
|
logEventInfo,
|
|
583
583
|
})
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
break
|
|
587
587
|
case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
|
|
588
588
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
589
589
|
const getShopActivityParams = this.jdOpenAppParams(
|
|
590
590
|
configDataValue.clickUrl,
|
|
591
591
|
)
|
|
592
592
|
getShopActivityParams &&
|
|
593
593
|
this.jdJumpToShopActivity(
|
|
594
594
|
Object.assign({}, getShopActivityParams, {
|
|
595
595
|
logEventInfo,
|
|
596
596
|
}),
|
|
597
597
|
)
|
|
598
598
|
} else if (configDataValue['projectId']) {
|
|
599
599
|
this.jdJumpToShopActivity({
|
|
600
600
|
projectId: configDataValue['projectId'],
|
|
601
601
|
configDataValue,
|
|
602
602
|
logEventInfo,
|
|
603
603
|
})
|
|
604
604
|
}
|
|
605
605
|
break
|
|
606
606
|
case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
|
|
607
607
|
case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
|
|
608
608
|
const _url = configDataValue.linkUrl
|
|
609
609
|
if (
|
|
610
610
|
_url.indexOf('to=') === -1 &&
|
|
611
611
|
_url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
|
|
612
612
|
) {
|
|
613
613
|
const _shopId = _url.match(/\d+/g)[0]
|
|
614
614
|
this.jdJumpToShopHome({
|
|
615
615
|
shopId: `${_shopId}`,
|
|
616
616
|
logEventInfo,
|
|
617
617
|
})
|
|
618
618
|
} else if (this.isOpenJdAppUrl(_url)) {
|
|
619
619
|
const getOpenAppParams = this.jdOpenAppParams(_url)
|
|
620
620
|
console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams)
|
|
621
621
|
if (getOpenAppParams) {
|
|
622
622
|
let _changeOpenAppParams = getOpenAppParams
|
|
623
623
|
if(isAppHomeForMarketPage){
|
|
624
624
|
const { operation, ...otherOpenAppParams } = getOpenAppParams
|
|
625
625
|
if(operation && operation === 'jumpTabInner'){
|
|
626
626
|
_changeOpenAppParams = otherOpenAppParams
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
this.jdNavigateToNative(
|
|
630
630
|
Object.assign({}, _changeOpenAppParams, {
|
|
631
631
|
logEventInfo,
|
|
632
632
|
}),
|
|
633
633
|
)
|
|
634
634
|
}
|
|
635
635
|
} else {
|
|
636
636
|
this.jdJumpToWeb(_url, logEventInfo)
|
|
637
637
|
}
|
|
638
638
|
break
|
|
639
639
|
}
|
|
640
640
|
case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
|
|
641
641
|
this.jdJumpToShopDetail({
|
|
642
642
|
venderId: global.info.queryInfo.venderId,
|
|
643
643
|
shopId: global.info.queryInfo.shopId,
|
|
644
644
|
logEventInfo,
|
|
645
645
|
})
|
|
646
646
|
break
|
|
647
647
|
case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
|
|
648
648
|
this.jdJumpToShopHome({
|
|
649
649
|
...configDataValue,
|
|
650
650
|
logEventInfo,
|
|
651
651
|
})
|
|
652
652
|
break
|
|
653
653
|
case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
|
|
654
654
|
break
|
|
655
655
|
case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
|
|
656
656
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
657
657
|
const getShoppingGuideParams = this.jdOpenAppParams(
|
|
658
658
|
configDataValue.clickUrl,
|
|
659
659
|
)
|
|
660
660
|
getShoppingGuideParams &&
|
|
661
661
|
this.jdJumpToShopActivity(
|
|
662
662
|
Object.assign({}, getShoppingGuideParams, {
|
|
663
663
|
logEventInfo,
|
|
664
664
|
}),
|
|
665
665
|
)
|
|
666
666
|
}
|
|
667
667
|
break
|
|
668
668
|
case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
|
|
669
669
|
const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '')
|
|
670
670
|
const search = linkUrl.match(/\?.+/)
|
|
671
671
|
if (search) {
|
|
672
672
|
const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
|
|
673
673
|
parseQueryUrlString(linkUrl)
|
|
674
674
|
try {
|
|
675
675
|
miniQueryData.param = JSON.parse(<string>miniQueryData?.param)
|
|
676
676
|
} catch (e) {
|
|
677
677
|
console.warn('解析小程序 param 错误:', miniQueryData.param)
|
|
678
678
|
}
|
|
679
679
|
this.jdJumpToMiniProgram(miniQueryData)
|
|
680
680
|
} else {
|
|
681
681
|
console.warn('小程序地址错误:', linkUrl)
|
|
682
682
|
}
|
|
683
683
|
break
|
|
684
684
|
}
|
|
685
685
|
case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
|
|
686
686
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
687
687
|
const getShopSearchParams = this.jdOpenAppParams(
|
|
688
688
|
configDataValue.clickUrl,
|
|
689
689
|
)
|
|
690
690
|
console.log(
|
|
691
691
|
'jd web 获取店铺结果落地页链接解析后的参数结果',
|
|
692
692
|
getShopSearchParams,
|
|
693
693
|
)
|
|
694
694
|
getShopSearchParams &&
|
|
695
695
|
this.jdJumpToShopSearch(
|
|
696
696
|
Object.assign({}, getShopSearchParams, {
|
|
697
697
|
logEventInfo,
|
|
698
698
|
}),
|
|
699
699
|
)
|
|
700
700
|
} else {
|
|
701
701
|
this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo)
|
|
702
702
|
}
|
|
703
703
|
break
|
|
704
704
|
}
|
|
705
705
|
default:
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
jdNavigateToNative(
|
|
710
710
|
params: {},
|
|
711
711
|
url = 'openapp.jdmobile://virtual',
|
|
712
712
|
successBack?: Function | null,
|
|
713
713
|
failBack?: Function | null,
|
|
714
714
|
) {
|
|
715
715
|
console.log('[降级H5] jdNavigateToNative web.jd:', params)
|
|
716
716
|
const getResParams: JumpEventReportInterFace.JdMiniJumpParams =
|
|
717
717
|
Object.assign(
|
|
718
718
|
{},
|
|
719
719
|
{
|
|
720
720
|
sourceValue: 'sourceValue_jshopModuleWeb',
|
|
721
721
|
sourceType: 'sourceType_jshopModuleWeb',
|
|
722
722
|
param: {},
|
|
723
723
|
},
|
|
724
724
|
params,
|
|
725
725
|
)
|
|
726
726
|
const { logEventInfo, ...otherParams } = getResParams
|
|
727
727
|
console.log(
|
|
728
728
|
'jd web 获取open协议参数 jdNavigateToNative params: ',
|
|
729
729
|
getResParams,
|
|
730
730
|
)
|
|
731
731
|
console.log('logEventInfo params: ', logEventInfo)
|
|
732
732
|
global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
|
|
733
733
|
this.clickEventLog(logEventInfo || getResParams)
|
|
734
734
|
.then(() => {
|
|
735
735
|
if (typeof successBack == 'function') {
|
|
736
736
|
successBack(getResParams)
|
|
737
737
|
} else {
|
|
738
738
|
try {
|
|
739
739
|
const paramsStr = JSON.stringify(otherParams)
|
|
740
740
|
console.log('跳转web jd open协议', `${url}?params=${paramsStr}`)
|
|
741
741
|
window.location.href = `${url}?params=${paramsStr}`
|
|
742
742
|
} catch (e) {
|
|
743
743
|
console.log('跳转异常', e)
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
746
|
})
|
|
747
747
|
.catch(() => {
|
|
748
748
|
typeof failBack == 'function' && failBack(getResParams)
|
|
749
749
|
})
|
|
750
750
|
}
|
|
751
751
|
|
|
752
752
|
clickEventLog(
|
|
753
753
|
opts: JumpEventReportInterFace.OptEventLogParams = {},
|
|
754
754
|
reportKey = 'click',
|
|
755
755
|
) {
|
|
756
756
|
const { eventId, jsonParam, eventLevel = 3, ...otherParams } = opts
|
|
757
757
|
if (eventId && jsonParam) {
|
|
758
758
|
const { etModelInfo, logBaseInfo } = jsonParam
|
|
759
759
|
let getJsonParam = {}
|
|
760
760
|
if (etModelInfo && logBaseInfo) {
|
|
761
761
|
getJsonParam = logBaseInfo
|
|
762
762
|
} else {
|
|
763
763
|
if (Array.isArray(jsonParam)){
|
|
764
764
|
getJsonParam = jsonParam
|
|
765
765
|
} else {
|
|
766
766
|
getJsonParam = Object.assign(
|
|
767
767
|
{},
|
|
768
768
|
{
|
|
769
769
|
shopid: global.info.queryInfo?.shopId,
|
|
770
770
|
},
|
|
771
771
|
jsonParam,
|
|
772
772
|
)
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
775
|
if(reportKey === 'exposure' && /^TerminatorNew/.test(eventId) && !Array.isArray(getJsonParam)){
|
|
776
776
|
getJsonParam = [getJsonParam]
|
|
777
777
|
}
|
|
778
778
|
const webLogParams = {
|
|
779
779
|
eid: eventId,
|
|
780
780
|
elevel: eventLevel,
|
|
781
781
|
jsonParam: JSON.stringify(getJsonParam),
|
|
782
782
|
etModel: JSON.stringify(etModelInfo || {}),
|
|
783
783
|
pageId: this.logPageId,
|
|
784
784
|
pageParam: this.logPageParamStr,
|
|
785
785
|
...otherParams,
|
|
786
786
|
}
|
|
787
787
|
return /click|exposure/.test(reportKey)
|
|
788
788
|
? reportClick(webLogParams)
|
|
789
789
|
: reportToCart(opts,webLogParams)
|
|
790
790
|
} else {
|
|
791
791
|
console.log('暂无埋点参数eventId和eventParam')
|
|
792
792
|
return Promise.resolve(false)
|
|
793
793
|
}
|
|
794
794
|
}
|
|
795
795
|
|
|
796
796
|
exposureEventLog(opts) {
|
|
797
797
|
return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
|
|
798
798
|
? this.clickEventLog(
|
|
799
799
|
{
|
|
800
800
|
...opts,
|
|
801
801
|
exposureState: true,
|
|
802
802
|
},
|
|
803
803
|
'exposure',
|
|
804
804
|
)
|
|
805
805
|
: Promise.resolve(false)
|
|
806
806
|
}
|