@conecli/cone-render 0.10.1-shop3.96 → 0.10.1-shop3.97
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.
- package/dist/common/const.ts +1 -1
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/interface/common.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.h5.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import { JdJumpJdApp } from './jdJumpJdApp';
|
|
2
1
|
isAppHomeForMarketPage,
|
|
3
2
|
isJdAndHarmonyDevice,
|
|
4
3
|
isNewHarmonyShop,
|
|
5
4
|
parseQueryUrlString,
|
|
6
5
|
objectToUrlEncode,
|
|
7
6
|
isInJdShopView,
|
|
8
7
|
routerInfo: {
|
|
9
8
|
params: {},
|
|
10
9
|
},
|
|
11
10
|
nativeEvent: null,
|
|
12
11
|
jumpConfig: {
|
|
13
12
|
venderId: null,
|
|
14
13
|
shopId: null,
|
|
15
14
|
sourceValue: '',
|
|
16
15
|
sourceType: 'App-H5',
|
|
17
16
|
activityType: 'shopx',
|
|
18
17
|
moduleId: 'none',
|
|
19
18
|
entrance: 'none',
|
|
20
19
|
},
|
|
21
20
|
logPageParamStr: '',
|
|
22
21
|
public logPageId: string;
|
|
23
22
|
public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
|
|
24
23
|
constructor(opt = {}) {
|
|
25
24
|
super(opt);
|
|
26
25
|
this.getConfig(opt);
|
|
27
26
|
}
|
|
28
27
|
getConfig(opt = {}) {
|
|
29
28
|
return Object.assign(this, {}, defaultConfig, opt);
|
|
30
29
|
}
|
|
31
30
|
updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
|
|
32
31
|
this.logPageId = pageId;
|
|
33
32
|
this.routerInfo = routerInfo;
|
|
34
33
|
this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
|
|
35
34
|
this.logPname = logPname;
|
|
36
35
|
}
|
|
37
36
|
reportInfoPv(
|
|
38
37
|
pageId = LogPageIdInfo.APP,
|
|
39
38
|
opt: {
|
|
40
39
|
pageParam?: any;
|
|
41
40
|
} = {},
|
|
42
41
|
) {
|
|
43
42
|
const { pageParam, ...otherOpts } = opt;
|
|
44
43
|
const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam;
|
|
45
44
|
this.logPageParamStr = pageParamStr
|
|
46
45
|
? pageParamStr
|
|
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
|
...otherOpts,
|
|
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?: functionType | undefined,
|
|
70
69
|
failBack?: functionType | 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('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
|
|
76
75
|
if (getOpenAppParams) {
|
|
77
76
|
|
|
78
77
|
const { useEncodeParams, ...otherLogInfo } = logEventInfo || {};
|
|
79
78
|
this.jdNavigateToNative(
|
|
80
79
|
Object.assign({}, getOpenAppParams, {
|
|
81
80
|
logEventInfo: otherLogInfo,
|
|
82
81
|
useEncodeParams: Boolean(useEncodeParams),
|
|
83
82
|
}),
|
|
84
83
|
);
|
|
85
84
|
}
|
|
86
85
|
} else {
|
|
87
86
|
let _getLastUrl = url;
|
|
88
87
|
if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
|
|
89
88
|
const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
|
|
90
89
|
if (!/jwebprog=0/.test(_getLastUrl)) {
|
|
91
90
|
_getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
|
|
92
91
|
}
|
|
93
92
|
if (global.info.sysInfo?.newFlexPad && !/terminal=flex/.test(_getLastUrl)) {
|
|
94
93
|
_getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}terminal=flex`;
|
|
95
94
|
} else if (
|
|
96
95
|
global.info.sysInfo?.isJdTabletDevice &&
|
|
97
96
|
!global.info.sysInfo?.newFlexPad &&
|
|
98
97
|
!/device=tablet/.test(_getLastUrl)
|
|
99
98
|
) {
|
|
100
99
|
_getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}device=tablet`;
|
|
101
100
|
}
|
|
102
101
|
if (isInJdShopView && /sale\/home/.test(_getLastUrl)) {
|
|
103
102
|
_getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}origin=appShop`;
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
super.jdJumpToWeb(
|
|
107
106
|
_getLastUrl,
|
|
108
107
|
{
|
|
109
108
|
...logEventInfo,
|
|
110
109
|
},
|
|
111
110
|
successBack,
|
|
112
111
|
failBack,
|
|
113
112
|
);
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
jdJumpToWebInner(url, logEventInfo) {
|
|
118
117
|
this.jdJumpToWeb(url, logEventInfo);
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
jdJumpConfigUrl(detail, logEventInfo = {}) {
|
|
122
121
|
const { configDataType, configDataValue } = detail;
|
|
123
122
|
switch (configDataType) {
|
|
124
123
|
case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
|
|
125
124
|
this.jdJumpToShopCategory({
|
|
126
125
|
...configDataValue,
|
|
127
126
|
logEventInfo,
|
|
128
127
|
});
|
|
129
128
|
break;
|
|
130
129
|
case LinkConfigType.CONFIG_TYPE_SKU_LIST:
|
|
131
130
|
if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
|
|
132
131
|
logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
|
|
133
132
|
}
|
|
134
133
|
this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
|
|
135
134
|
break;
|
|
136
135
|
case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
|
|
137
136
|
this.jdJumpToWeb(
|
|
138
137
|
`${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
|
|
139
138
|
{},
|
|
140
139
|
);
|
|
141
140
|
break;
|
|
142
141
|
case LinkConfigType.CONFIG_TYPE_CATEGORY:
|
|
143
142
|
if (isJdAndHarmonyDevice && isNewHarmonyShop && jdAppVersionStr === '15.1.70') {
|
|
144
143
|
const baseInfo = {
|
|
145
144
|
shopId: global.info.queryInfo.shopId,
|
|
146
145
|
venderId: global.info.queryInfo.venderId,
|
|
147
146
|
};
|
|
148
147
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
149
148
|
const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
150
149
|
console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
|
|
151
150
|
let openAppParams =
|
|
152
151
|
typeof getShopSearchParams === 'boolean'
|
|
153
152
|
? { categoryId: '', ...baseInfo }
|
|
154
153
|
: getShopSearchParams;
|
|
155
154
|
const getInfo = openAppParams['categoryId']
|
|
156
155
|
? { ...openAppParams, cateId: openAppParams['categoryId'] }
|
|
157
156
|
: openAppParams;
|
|
158
157
|
console.log('处理后的参数', objectToUrlEncode(getInfo));
|
|
159
158
|
this.jdJumpToWeb(
|
|
160
159
|
`${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
|
|
161
160
|
logEventInfo,
|
|
162
161
|
);
|
|
163
162
|
} else {
|
|
164
163
|
const getInfo = configDataValue['cid']
|
|
165
164
|
? { ...baseInfo, ...configDataValue, cateId: configDataValue.cid, searchType: '5' }
|
|
166
165
|
: { ...baseInfo, ...configDataValue };
|
|
167
166
|
this.jdJumpToWeb(
|
|
168
167
|
`${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
|
|
169
168
|
logEventInfo,
|
|
170
169
|
);
|
|
171
170
|
}
|
|
172
171
|
} else {
|
|
173
172
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
174
173
|
const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
175
174
|
console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
|
|
176
175
|
getShopSearchParams &&
|
|
177
176
|
this.jdJumpToShopSearch(
|
|
178
177
|
Object.assign({}, getShopSearchParams, {
|
|
179
178
|
logEventInfo,
|
|
180
179
|
}),
|
|
181
180
|
);
|
|
182
181
|
} else {
|
|
183
182
|
const extraParam = configDataValue?.pageId ? { pageId: configDataValue.pageId } : {};
|
|
184
183
|
this.jdJumpToShopSearch(
|
|
185
184
|
configDataValue['cid']
|
|
186
185
|
? Object.assign(
|
|
187
186
|
{},
|
|
188
187
|
{
|
|
189
188
|
shopId: global.info.queryInfo.shopId,
|
|
190
189
|
categoryId: configDataValue.cid,
|
|
191
190
|
searchType: '5',
|
|
192
191
|
...extraParam,
|
|
193
192
|
logEventInfo,
|
|
194
193
|
},
|
|
195
194
|
)
|
|
196
195
|
: {
|
|
197
196
|
shopId: global.info.queryInfo.shopId,
|
|
198
197
|
...extraParam,
|
|
199
198
|
logEventInfo,
|
|
200
199
|
},
|
|
201
200
|
);
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
break;
|
|
205
204
|
case LinkConfigType.CONFIG_TYPE_MEMBER:
|
|
206
205
|
if (isAppHomeForMarketPage) {
|
|
207
206
|
this.jdJumpToBottomTabBrandMember({
|
|
208
207
|
logEventInfo,
|
|
209
208
|
});
|
|
210
209
|
} else {
|
|
211
210
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
212
211
|
const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
213
212
|
getShopMemberParams &&
|
|
214
213
|
this.jdJumpToShopMember(
|
|
215
214
|
Object.assign({}, getShopMemberParams, {
|
|
216
215
|
logEventInfo,
|
|
217
216
|
}),
|
|
218
217
|
);
|
|
219
218
|
} else {
|
|
220
219
|
this.jdJumpToShopMember({
|
|
221
220
|
shopId: global.info.queryInfo.shopId,
|
|
222
221
|
venderId: configDataValue.shopDetail,
|
|
223
222
|
logEventInfo,
|
|
224
223
|
});
|
|
225
224
|
}
|
|
226
225
|
}
|
|
227
226
|
break;
|
|
228
227
|
case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
|
|
229
228
|
if (this.isNewHarmony()) {
|
|
230
229
|
const url = `${domain.sale}/m/h5/${configDataValue.data}.html`;
|
|
231
230
|
this.jdJumpToWeb(url, logEventInfo);
|
|
232
231
|
} else {
|
|
233
232
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
234
233
|
const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
235
234
|
getShopActivityParams &&
|
|
236
235
|
this.jdJumpToShopActivity(
|
|
237
236
|
Object.assign({}, getShopActivityParams, {
|
|
238
237
|
logEventInfo,
|
|
239
238
|
}),
|
|
240
239
|
);
|
|
241
240
|
} else if (configDataValue['projectId']) {
|
|
242
241
|
this.jdJumpToShopActivity({
|
|
243
242
|
projectId: configDataValue['projectId'],
|
|
244
243
|
configDataValue,
|
|
245
244
|
logEventInfo,
|
|
246
245
|
});
|
|
247
246
|
}
|
|
248
247
|
}
|
|
249
248
|
break;
|
|
250
249
|
case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
|
|
251
250
|
case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
|
|
252
251
|
const _url = configDataValue.linkUrl;
|
|
253
252
|
if (
|
|
254
253
|
_url.indexOf('to=') === -1 &&
|
|
255
254
|
_url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
|
|
256
255
|
) {
|
|
257
256
|
const _shopId = _url.match(/\d+/g)[0];
|
|
258
257
|
this.jdJumpToShopHome({
|
|
259
258
|
shopId: `${_shopId}`,
|
|
260
259
|
logEventInfo,
|
|
261
260
|
});
|
|
262
261
|
} else if (this.isOpenJdAppUrl(_url)) {
|
|
263
262
|
const getOpenAppParams = this.jdOpenAppParams(_url);
|
|
264
263
|
console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
|
|
265
264
|
if (getOpenAppParams) {
|
|
266
265
|
let _changeOpenAppParams = getOpenAppParams;
|
|
267
266
|
if (isAppHomeForMarketPage) {
|
|
268
267
|
const { operation, ...otherOpenAppParams } = getOpenAppParams;
|
|
269
268
|
if (operation && operation === 'jumpTabInner') {
|
|
270
269
|
_changeOpenAppParams = otherOpenAppParams;
|
|
271
270
|
}
|
|
272
271
|
}
|
|
273
272
|
this.jdNavigateToNative(
|
|
274
273
|
Object.assign({}, _changeOpenAppParams, {
|
|
275
274
|
logEventInfo,
|
|
276
275
|
}),
|
|
277
276
|
);
|
|
278
277
|
}
|
|
279
278
|
} else {
|
|
280
279
|
this.jdJumpToWeb(_url, logEventInfo);
|
|
281
280
|
}
|
|
282
281
|
break;
|
|
283
282
|
}
|
|
284
283
|
case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
|
|
285
284
|
this.jdJumpToShopDetail({
|
|
286
285
|
venderId: global.info.queryInfo.venderId,
|
|
287
286
|
shopId: global.info.queryInfo.shopId,
|
|
288
287
|
logEventInfo,
|
|
289
288
|
});
|
|
290
289
|
break;
|
|
291
290
|
case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
|
|
292
291
|
this.jdJumpToShopHome({
|
|
293
292
|
...configDataValue,
|
|
294
293
|
logEventInfo,
|
|
295
294
|
});
|
|
296
295
|
break;
|
|
297
296
|
case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
|
|
298
297
|
break;
|
|
299
298
|
case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
|
|
300
299
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
301
300
|
const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
302
301
|
getShoppingGuideParams &&
|
|
303
302
|
this.jdJumpToShopActivity(
|
|
304
303
|
Object.assign({}, getShoppingGuideParams, {
|
|
305
304
|
logEventInfo,
|
|
306
305
|
}),
|
|
307
306
|
);
|
|
308
307
|
}
|
|
309
308
|
break;
|
|
310
309
|
case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
|
|
311
310
|
const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
|
|
312
311
|
const search = linkUrl.match(/\?.+/);
|
|
313
312
|
if (search) {
|
|
314
313
|
const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
|
|
315
314
|
parseQueryUrlString(linkUrl);
|
|
316
315
|
try {
|
|
317
316
|
miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
|
|
318
317
|
} catch (e) {
|
|
319
318
|
console.warn('解析小程序 param 错误:', miniQueryData.param);
|
|
320
319
|
}
|
|
321
320
|
this.jdJumpToMiniProgram(miniQueryData);
|
|
322
321
|
} else {
|
|
323
322
|
console.warn('小程序地址错误:', linkUrl);
|
|
324
323
|
}
|
|
325
324
|
break;
|
|
326
325
|
}
|
|
327
326
|
case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
|
|
328
327
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
329
328
|
const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
330
329
|
console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
|
|
331
330
|
getShopSearchParams &&
|
|
332
331
|
this.jdJumpToShopSearch(
|
|
333
332
|
Object.assign({}, getShopSearchParams, {
|
|
334
333
|
logEventInfo,
|
|
335
334
|
}),
|
|
336
335
|
);
|
|
337
336
|
} else {
|
|
338
337
|
this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
|
|
339
338
|
}
|
|
340
339
|
break;
|
|
341
340
|
}
|
|
342
341
|
default:
|
|
343
342
|
}
|
|
344
343
|
}
|
|
345
344
|
|
|
346
345
|
isNewHarmony() {
|
|
347
346
|
return isJdAndHarmonyDevice && isNewHarmonyShop;
|
|
348
347
|
}
|
|
349
348
|
|
|
350
349
|
jdNavigateToNative(
|
|
351
350
|
params: object,
|
|
352
351
|
url = 'openapp.jdmobile://virtual',
|
|
353
352
|
successBack?: functionType | null,
|
|
354
353
|
failBack?: functionType | null,
|
|
355
354
|
) {
|
|
356
355
|
console.log('[降级H5] jdNavigateToNative web.jd:', params);
|
|
357
356
|
const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
|
|
358
357
|
{},
|
|
359
358
|
{
|
|
360
359
|
sourceValue: 'sourceValue_jshopModuleWeb',
|
|
361
360
|
sourceType: 'sourceType_jshopModuleWeb',
|
|
362
361
|
param: {},
|
|
363
362
|
},
|
|
364
363
|
params,
|
|
365
364
|
);
|
|
366
365
|
const { logEventInfo, useEncodeParams, ...otherParams } = getResParams;
|
|
367
366
|
console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
|
|
368
367
|
console.log('logEventInfo params: ', logEventInfo);
|
|
369
368
|
global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
|
|
370
369
|
this.clickEventLog(logEventInfo || getResParams)
|
|
371
370
|
.then(() => {
|
|
372
371
|
if (typeof successBack === 'function') {
|
|
373
372
|
successBack(getResParams);
|
|
374
373
|
} else {
|
|
375
374
|
if (this.isNewHarmony() && params.operation === 'jumpTabInner') {
|
|
376
375
|
if (params.jumpTab) {
|
|
377
376
|
JumpTabBarInCurrentShop({ position: 'top', item: params.jumpTab, ...params });
|
|
378
377
|
} else if (params.jumpBottomTab) {
|
|
379
378
|
JumpTabBarInCurrentShop({
|
|
380
379
|
position: 'bottom',
|
|
381
380
|
item: params.jumpBottomTab,
|
|
382
381
|
...params,
|
|
383
382
|
});
|
|
384
383
|
} else {
|
|
385
384
|
console.log('[降级H5] 跳转异常 params:', params);
|
|
386
385
|
}
|
|
387
386
|
} else if (
|
|
388
387
|
this.isNewHarmony() &&
|
|
389
388
|
(params.operation === 'jumpBottomTabMember' || params.des === 'jshopMember')
|
|
390
389
|
) {
|
|
391
390
|
JumpTabBarInCurrentShop({ position: 'bottom', item: 'brandMember', ...params });
|
|
392
391
|
} else {
|
|
393
392
|
try {
|
|
394
393
|
const paramsStr = JSON.stringify(otherParams);
|
|
395
394
|
console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
|
|
396
395
|
window.location.href =
|
|
397
396
|
isJdAndHarmonyDevice || useEncodeParams
|
|
398
397
|
? `${url}?params=${encodeURIComponent(paramsStr)}`
|
|
399
398
|
: `${url}?params=${paramsStr}`;
|
|
400
399
|
} catch (e) {
|
|
401
400
|
draBusinessCustomReport({
|
|
402
401
|
eventName: 'entryProtocol',
|
|
403
402
|
errorName: 'shop_jdNavigateToNative_error',
|
|
404
403
|
errorMessage: '跳转web jd open协议发生错误',
|
|
405
404
|
extraData: JSON.stringify({
|
|
406
405
|
url,
|
|
407
406
|
isJdApp,
|
|
408
407
|
jdAppVersion: jdAppVersionStr,
|
|
409
408
|
...otherParams,
|
|
410
409
|
}),
|
|
411
410
|
});
|
|
412
411
|
}
|
|
413
412
|
}
|
|
414
413
|
}
|
|
415
414
|
})
|
|
416
415
|
.catch(() => {
|
|
417
416
|
typeof failBack === 'function' && failBack(getResParams);
|
|
418
417
|
});
|
|
419
418
|
}
|
|
420
419
|
|
|
421
420
|
clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
|
|
422
421
|
const { eventId, spmAllCode, spmCodeForCD, jsonParam, eventLevel = 3, ...otherParams } = opts;
|
|
423
422
|
if ((eventId || spmAllCode || spmCodeForCD) && jsonParam) {
|
|
424
423
|
const { etModelInfo, logBaseInfo } = jsonParam;
|
|
425
424
|
let getJsonParam = {};
|
|
426
425
|
if (etModelInfo && logBaseInfo) {
|
|
427
426
|
getJsonParam = logBaseInfo;
|
|
428
427
|
} else {
|
|
429
428
|
if (Array.isArray(jsonParam)) {
|
|
430
429
|
getJsonParam = jsonParam;
|
|
431
430
|
} else {
|
|
432
431
|
getJsonParam = Object.assign(
|
|
433
432
|
{},
|
|
434
433
|
{
|
|
435
434
|
shopid: global.info.queryInfo?.shopId,
|
|
436
435
|
},
|
|
437
436
|
jsonParam,
|
|
438
437
|
);
|
|
439
438
|
}
|
|
440
439
|
}
|
|
441
440
|
if (
|
|
442
441
|
reportKey === 'exposure' &&
|
|
443
442
|
/^TerminatorNew/.test(eventId) &&
|
|
444
443
|
!Array.isArray(getJsonParam)
|
|
445
444
|
) {
|
|
446
445
|
getJsonParam = [getJsonParam];
|
|
447
446
|
}
|
|
448
447
|
const webLogParams = {
|
|
449
448
|
isExpo: reportKey === 'exposure',
|
|
450
449
|
eid: eventId,
|
|
451
450
|
elevel: eventLevel,
|
|
452
451
|
jsonParam: JSON.stringify(getJsonParam),
|
|
453
452
|
etModel: JSON.stringify(etModelInfo || {}),
|
|
454
453
|
pageId: this.logPageId,
|
|
455
454
|
pageParam: this.logPageParamStr,
|
|
456
455
|
spmAllCode,
|
|
457
456
|
spmCodeForCD,
|
|
458
457
|
...otherParams,
|
|
459
458
|
};
|
|
460
459
|
return /click|exposure/.test(reportKey)
|
|
461
460
|
? reportClick(webLogParams)
|
|
462
461
|
: reportToCart(opts, webLogParams);
|
|
463
462
|
} else {
|
|
464
463
|
console.log('暂无埋点参数eventId和eventParam');
|
|
465
464
|
return Promise.resolve(false);
|
|
466
465
|
}
|
|
467
466
|
}
|
|
468
467
|
|
|
469
468
|
exposureEventLog(opts) {
|
|
470
469
|
return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
|
|
471
470
|
? this.clickEventLog(
|
|
472
471
|
{
|
|
473
472
|
...opts,
|
|
474
473
|
exposureState: true,
|
|
475
474
|
},
|
|
476
475
|
'exposure',
|
|
477
476
|
)
|
|
478
477
|
: Promise.resolve(false);
|
|
479
478
|
}
|
|
479
|
+
import { JdJumpJdApp } from './jdJumpJdApp';
|
|
480
480
|
isAppHomeForMarketPage,
|
|
481
481
|
isJdAndHarmonyDevice,
|
|
482
482
|
isNewHarmonyShop,
|
|
483
483
|
parseQueryUrlString,
|
|
484
484
|
objectToUrlEncode,
|
|
485
485
|
isInJdShopView,
|
|
486
486
|
routerInfo: {
|
|
487
487
|
params: {},
|
|
488
488
|
},
|
|
489
489
|
nativeEvent: null,
|
|
490
490
|
jumpConfig: {
|
|
491
491
|
venderId: null,
|
|
492
492
|
shopId: null,
|
|
493
493
|
sourceValue: '',
|
|
494
494
|
sourceType: 'App-H5',
|
|
495
495
|
activityType: 'shopx',
|
|
496
496
|
moduleId: 'none',
|
|
497
497
|
entrance: 'none',
|
|
498
498
|
},
|
|
499
499
|
logPageParamStr: '',
|
|
500
500
|
public logPageId: string;
|
|
501
501
|
public jumpConfig: JumpEventReportInterFace.JumpH5ReportConfig;
|
|
502
502
|
constructor(opt = {}) {
|
|
503
503
|
super(opt);
|
|
504
504
|
this.getConfig(opt);
|
|
505
505
|
}
|
|
506
506
|
getConfig(opt = {}) {
|
|
507
507
|
return Object.assign(this, {}, defaultConfig, opt);
|
|
508
508
|
}
|
|
509
509
|
updateInfo(routerInfo, logPname = LogPnameInfo.HOME, pageId = LogPageIdInfo.APP) {
|
|
510
510
|
this.logPageId = pageId;
|
|
511
511
|
this.routerInfo = routerInfo;
|
|
512
512
|
this.jumpConfig = Object.assign({}, this.jumpConfig, routerInfo.params);
|
|
513
513
|
this.logPname = logPname;
|
|
514
514
|
}
|
|
515
515
|
reportInfoPv(
|
|
516
516
|
pageId = LogPageIdInfo.APP,
|
|
517
517
|
opt: {
|
|
518
518
|
pageParam?: any;
|
|
519
519
|
} = {},
|
|
520
520
|
) {
|
|
521
521
|
const { pageParam, ...otherOpts } = opt;
|
|
522
522
|
const pageParamStr = typeof pageParam === 'object' ? JSON.stringify(pageParam) : pageParam;
|
|
523
523
|
this.logPageParamStr = pageParamStr
|
|
524
524
|
? pageParamStr
|
|
525
525
|
: this.creatParamToLogStr(this.jumpConfig)
|
|
526
526
|
.replace(/moduleId/, 'JumpmoduleID')
|
|
527
527
|
.replace(/entrance/, 'Jumpentrance');
|
|
528
528
|
reportPV({
|
|
529
529
|
pageId,
|
|
530
530
|
pageParam: this.logPageParamStr,
|
|
531
531
|
...otherOpts,
|
|
532
532
|
});
|
|
533
533
|
}
|
|
534
534
|
|
|
535
535
|
jdJumpToDongDongChatGroup(groupId, source = '4') {
|
|
536
536
|
this.jdNavigateToNative({
|
|
537
537
|
category: 'jump',
|
|
538
538
|
des: 'dongdong_group_chat',
|
|
539
539
|
source: source,
|
|
540
540
|
groupId: `${groupId}`,
|
|
541
541
|
});
|
|
542
542
|
}
|
|
543
543
|
|
|
544
544
|
jdJumpToWeb(
|
|
545
545
|
url,
|
|
546
546
|
logEventInfo,
|
|
547
547
|
successBack?: functionType | undefined,
|
|
548
548
|
failBack?: functionType | undefined,
|
|
549
549
|
) {
|
|
550
550
|
console.log('jd web', this.isOpenJdAppUrl(url), url);
|
|
551
551
|
if (this.isOpenJdAppUrl(url)) {
|
|
552
552
|
const getOpenAppParams = this.jdOpenAppParams(url);
|
|
553
553
|
console.log('jd web 获取自定义openApp链接解析后的参数结果', getOpenAppParams);
|
|
554
554
|
if (getOpenAppParams) {
|
|
555
555
|
|
|
556
556
|
const { useEncodeParams, ...otherLogInfo } = logEventInfo || {};
|
|
557
557
|
this.jdNavigateToNative(
|
|
558
558
|
Object.assign({}, getOpenAppParams, {
|
|
559
559
|
logEventInfo: otherLogInfo,
|
|
560
560
|
useEncodeParams: Boolean(useEncodeParams),
|
|
561
561
|
}),
|
|
562
562
|
);
|
|
563
563
|
}
|
|
564
564
|
} else {
|
|
565
565
|
let _getLastUrl = url;
|
|
566
566
|
if (/shop\.m\.jd\.com|pages\.jd\.com/.test(_getLastUrl)) {
|
|
567
567
|
const getUrlSearchParamState = _getLastUrl.indexOf('?') !== -1;
|
|
568
568
|
if (!/jwebprog=0/.test(_getLastUrl)) {
|
|
569
569
|
_getLastUrl = `${_getLastUrl}${getUrlSearchParamState ? '&' : '?'}jwebprog=0`;
|
|
570
570
|
}
|
|
571
571
|
if (global.info.sysInfo?.newFlexPad && !/terminal=flex/.test(_getLastUrl)) {
|
|
572
572
|
_getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}terminal=flex`;
|
|
573
573
|
} else if (
|
|
574
574
|
global.info.sysInfo?.isJdTabletDevice &&
|
|
575
575
|
!global.info.sysInfo?.newFlexPad &&
|
|
576
576
|
!/device=tablet/.test(_getLastUrl)
|
|
577
577
|
) {
|
|
578
578
|
_getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}device=tablet`;
|
|
579
579
|
}
|
|
580
580
|
if (isInJdShopView && !/origin=appShop/.test(_getLastUrl)) {
|
|
581
581
|
_getLastUrl = `${_getLastUrl}${_getLastUrl.indexOf('?') !== -1 ? '&' : '?'}origin=appShop`;
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
super.jdJumpToWeb(
|
|
585
585
|
_getLastUrl,
|
|
586
586
|
{
|
|
587
587
|
...logEventInfo,
|
|
588
588
|
},
|
|
589
589
|
successBack,
|
|
590
590
|
failBack,
|
|
591
591
|
);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
|
|
595
595
|
jdJumpToWebInner(url, logEventInfo) {
|
|
596
596
|
this.jdJumpToWeb(url, logEventInfo);
|
|
597
597
|
}
|
|
598
598
|
|
|
599
599
|
jdJumpConfigUrl(detail, logEventInfo = {}) {
|
|
600
600
|
const { configDataType, configDataValue } = detail;
|
|
601
601
|
switch (configDataType) {
|
|
602
602
|
case LinkConfigType.CONFIG_TYPE_CATEGORY_PAGE:
|
|
603
603
|
this.jdJumpToShopCategory({
|
|
604
604
|
...configDataValue,
|
|
605
605
|
logEventInfo,
|
|
606
606
|
});
|
|
607
607
|
break;
|
|
608
608
|
case LinkConfigType.CONFIG_TYPE_SKU_LIST:
|
|
609
609
|
if (logEventInfo?.jsonParam?.logBaseInfo?.mInfo) {
|
|
610
610
|
logEventInfo.jsonParam.logBaseInfo.mInfo.skuid = configDataValue.skuIds;
|
|
611
611
|
}
|
|
612
612
|
this.jdJumpToProduct(configDataValue.skuIds, logEventInfo);
|
|
613
613
|
break;
|
|
614
614
|
case LinkConfigType.CONFIG_TYPE_COUPON_LIST:
|
|
615
615
|
this.jdJumpToWeb(
|
|
616
616
|
`${this.jumpWebUrl.shopCoupon}?couponType=1&shopId=${global.info.queryInfo.shopId}&venderId=${global.info.queryInfo.venderId}`,
|
|
617
617
|
{},
|
|
618
618
|
);
|
|
619
619
|
break;
|
|
620
620
|
case LinkConfigType.CONFIG_TYPE_CATEGORY:
|
|
621
621
|
if (isJdAndHarmonyDevice && isNewHarmonyShop && jdAppVersionStr === '15.1.70') {
|
|
622
622
|
const baseInfo = {
|
|
623
623
|
shopId: global.info.queryInfo.shopId,
|
|
624
624
|
venderId: global.info.queryInfo.venderId,
|
|
625
625
|
};
|
|
626
626
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
627
627
|
const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
628
628
|
console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
|
|
629
629
|
let openAppParams =
|
|
630
630
|
typeof getShopSearchParams === 'boolean'
|
|
631
631
|
? { categoryId: '', ...baseInfo }
|
|
632
632
|
: getShopSearchParams;
|
|
633
633
|
const getInfo = openAppParams['categoryId']
|
|
634
634
|
? { ...openAppParams, cateId: openAppParams['categoryId'] }
|
|
635
635
|
: openAppParams;
|
|
636
636
|
console.log('处理后的参数', objectToUrlEncode(getInfo));
|
|
637
637
|
this.jdJumpToWeb(
|
|
638
638
|
`${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
|
|
639
639
|
logEventInfo,
|
|
640
640
|
);
|
|
641
641
|
} else {
|
|
642
642
|
const getInfo = configDataValue['cid']
|
|
643
643
|
? { ...baseInfo, ...configDataValue, cateId: configDataValue.cid, searchType: '5' }
|
|
644
644
|
: { ...baseInfo, ...configDataValue };
|
|
645
645
|
this.jdJumpToWeb(
|
|
646
646
|
`${this.jumpWebUrl.shopSearch}?${objectToUrlEncode(getInfo)}`,
|
|
647
647
|
logEventInfo,
|
|
648
648
|
);
|
|
649
649
|
}
|
|
650
650
|
} else {
|
|
651
651
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
652
652
|
const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
653
653
|
console.log('jd web 获取店铺分类链接解析后的参数结果', getShopSearchParams);
|
|
654
654
|
getShopSearchParams &&
|
|
655
655
|
this.jdJumpToShopSearch(
|
|
656
656
|
Object.assign({}, getShopSearchParams, {
|
|
657
657
|
logEventInfo,
|
|
658
658
|
}),
|
|
659
659
|
);
|
|
660
660
|
} else {
|
|
661
661
|
const extraParam = configDataValue?.pageId ? { pageId: configDataValue.pageId } : {};
|
|
662
662
|
this.jdJumpToShopSearch(
|
|
663
663
|
configDataValue['cid']
|
|
664
664
|
? Object.assign(
|
|
665
665
|
{},
|
|
666
666
|
{
|
|
667
667
|
shopId: global.info.queryInfo.shopId,
|
|
668
668
|
categoryId: configDataValue.cid,
|
|
669
669
|
searchType: '5',
|
|
670
670
|
...extraParam,
|
|
671
671
|
logEventInfo,
|
|
672
672
|
},
|
|
673
673
|
)
|
|
674
674
|
: {
|
|
675
675
|
shopId: global.info.queryInfo.shopId,
|
|
676
676
|
...extraParam,
|
|
677
677
|
logEventInfo,
|
|
678
678
|
},
|
|
679
679
|
);
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
break;
|
|
683
683
|
case LinkConfigType.CONFIG_TYPE_MEMBER:
|
|
684
684
|
if (isAppHomeForMarketPage) {
|
|
685
685
|
this.jdJumpToBottomTabBrandMember({
|
|
686
686
|
logEventInfo,
|
|
687
687
|
});
|
|
688
688
|
} else {
|
|
689
689
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
690
690
|
const getShopMemberParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
691
691
|
getShopMemberParams &&
|
|
692
692
|
this.jdJumpToShopMember(
|
|
693
693
|
Object.assign({}, getShopMemberParams, {
|
|
694
694
|
logEventInfo,
|
|
695
695
|
}),
|
|
696
696
|
);
|
|
697
697
|
} else {
|
|
698
698
|
this.jdJumpToShopMember({
|
|
699
699
|
shopId: global.info.queryInfo.shopId,
|
|
700
700
|
venderId: configDataValue.shopDetail,
|
|
701
701
|
logEventInfo,
|
|
702
702
|
});
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
break;
|
|
706
706
|
case LinkConfigType.CONFIG_TYPE_SHOP_ACTIVITY:
|
|
707
707
|
if (this.isNewHarmony()) {
|
|
708
708
|
const url = `${domain.sale}/m/h5/${configDataValue.data}.html`;
|
|
709
709
|
this.jdJumpToWeb(url, logEventInfo);
|
|
710
710
|
} else {
|
|
711
711
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
712
712
|
const getShopActivityParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
713
713
|
getShopActivityParams &&
|
|
714
714
|
this.jdJumpToShopActivity(
|
|
715
715
|
Object.assign({}, getShopActivityParams, {
|
|
716
716
|
logEventInfo,
|
|
717
717
|
}),
|
|
718
718
|
);
|
|
719
719
|
} else if (configDataValue['projectId']) {
|
|
720
720
|
this.jdJumpToShopActivity({
|
|
721
721
|
projectId: configDataValue['projectId'],
|
|
722
722
|
configDataValue,
|
|
723
723
|
logEventInfo,
|
|
724
724
|
});
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
727
|
break;
|
|
728
728
|
case LinkConfigType.CONFIG_TYPE_CUSTOM_LINK:
|
|
729
729
|
case LinkConfigType.CONFIG_TYPE_FINANCE_COUPON: {
|
|
730
730
|
const _url = configDataValue.linkUrl;
|
|
731
731
|
if (
|
|
732
732
|
_url.indexOf('to=') === -1 &&
|
|
733
733
|
_url.indexOf(`${domain.mshop.replace(/https?:/, '')}/?shopId=`) !== -1
|
|
734
734
|
) {
|
|
735
735
|
const _shopId = _url.match(/\d+/g)[0];
|
|
736
736
|
this.jdJumpToShopHome({
|
|
737
737
|
shopId: `${_shopId}`,
|
|
738
738
|
logEventInfo,
|
|
739
739
|
});
|
|
740
740
|
} else if (this.isOpenJdAppUrl(_url)) {
|
|
741
741
|
const getOpenAppParams = this.jdOpenAppParams(_url);
|
|
742
742
|
console.log('jd web 获取自定义链接解析后的参数结果', getOpenAppParams);
|
|
743
743
|
if (getOpenAppParams) {
|
|
744
744
|
let _changeOpenAppParams = getOpenAppParams;
|
|
745
745
|
if (isAppHomeForMarketPage) {
|
|
746
746
|
const { operation, ...otherOpenAppParams } = getOpenAppParams;
|
|
747
747
|
if (operation && operation === 'jumpTabInner') {
|
|
748
748
|
_changeOpenAppParams = otherOpenAppParams;
|
|
749
749
|
}
|
|
750
750
|
}
|
|
751
751
|
this.jdNavigateToNative(
|
|
752
752
|
Object.assign({}, _changeOpenAppParams, {
|
|
753
753
|
logEventInfo,
|
|
754
754
|
}),
|
|
755
755
|
);
|
|
756
756
|
}
|
|
757
757
|
} else {
|
|
758
758
|
this.jdJumpToWeb(_url, logEventInfo);
|
|
759
759
|
}
|
|
760
760
|
break;
|
|
761
761
|
}
|
|
762
762
|
case LinkConfigType.CONFIG_TYPE_JSHOP_DETAIL:
|
|
763
763
|
this.jdJumpToShopDetail({
|
|
764
764
|
venderId: global.info.queryInfo.venderId,
|
|
765
765
|
shopId: global.info.queryInfo.shopId,
|
|
766
766
|
logEventInfo,
|
|
767
767
|
});
|
|
768
768
|
break;
|
|
769
769
|
case LinkConfigType.CONFIG_TYPE_SHOP_HOME:
|
|
770
770
|
this.jdJumpToShopHome({
|
|
771
771
|
...configDataValue,
|
|
772
772
|
logEventInfo,
|
|
773
773
|
});
|
|
774
774
|
break;
|
|
775
775
|
case LinkConfigType.CONFIG_TYPE_ANCHOR_POINT:
|
|
776
776
|
break;
|
|
777
777
|
case LinkConfigType.CONFIG_TYPE_SHOPPING_GUIDE:
|
|
778
778
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
779
779
|
const getShoppingGuideParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
780
780
|
getShoppingGuideParams &&
|
|
781
781
|
this.jdJumpToShopActivity(
|
|
782
782
|
Object.assign({}, getShoppingGuideParams, {
|
|
783
783
|
logEventInfo,
|
|
784
784
|
}),
|
|
785
785
|
);
|
|
786
786
|
}
|
|
787
787
|
break;
|
|
788
788
|
case LinkConfigType.CONFIG_TYPE_MINI_PROGRAM: {
|
|
789
789
|
const linkUrl = decodeURIComponent(configDataValue?.linkUrl || '');
|
|
790
790
|
const search = linkUrl.match(/\?.+/);
|
|
791
791
|
if (search) {
|
|
792
792
|
const miniQueryData: JumpEventReportInterFace.LinkMiniParams =
|
|
793
793
|
parseQueryUrlString(linkUrl);
|
|
794
794
|
try {
|
|
795
795
|
miniQueryData.param = JSON.parse(<string>miniQueryData?.param);
|
|
796
796
|
} catch (e) {
|
|
797
797
|
console.warn('解析小程序 param 错误:', miniQueryData.param);
|
|
798
798
|
}
|
|
799
799
|
this.jdJumpToMiniProgram(miniQueryData);
|
|
800
800
|
} else {
|
|
801
801
|
console.warn('小程序地址错误:', linkUrl);
|
|
802
802
|
}
|
|
803
803
|
break;
|
|
804
804
|
}
|
|
805
805
|
case LinkConfigType.CONFIG_TYPE_SHOP_SEARCH: {
|
|
806
806
|
if (this.isOpenJdAppUrl(configDataValue.clickUrl)) {
|
|
807
807
|
const getShopSearchParams = this.jdOpenAppParams(configDataValue.clickUrl);
|
|
808
808
|
console.log('jd web 获取店铺结果落地页链接解析后的参数结果', getShopSearchParams);
|
|
809
809
|
getShopSearchParams &&
|
|
810
810
|
this.jdJumpToShopSearch(
|
|
811
811
|
Object.assign({}, getShopSearchParams, {
|
|
812
812
|
logEventInfo,
|
|
813
813
|
}),
|
|
814
814
|
);
|
|
815
815
|
} else {
|
|
816
816
|
this.jdJumpToWeb(configDataValue.clickUrl, logEventInfo);
|
|
817
817
|
}
|
|
818
818
|
break;
|
|
819
819
|
}
|
|
820
820
|
default:
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
823
|
|
|
824
824
|
isNewHarmony() {
|
|
825
825
|
return isJdAndHarmonyDevice && isNewHarmonyShop;
|
|
826
826
|
}
|
|
827
827
|
|
|
828
828
|
jdNavigateToNative(
|
|
829
829
|
params: object,
|
|
830
830
|
url = 'openapp.jdmobile://virtual',
|
|
831
831
|
successBack?: functionType | null,
|
|
832
832
|
failBack?: functionType | null,
|
|
833
833
|
) {
|
|
834
834
|
console.log('[降级H5] jdNavigateToNative web.jd:', params);
|
|
835
835
|
const getResParams: JumpEventReportInterFace.JdMiniJumpParams = Object.assign(
|
|
836
836
|
{},
|
|
837
837
|
{
|
|
838
838
|
sourceValue: 'sourceValue_jshopModuleWeb',
|
|
839
839
|
sourceType: 'sourceType_jshopModuleWeb',
|
|
840
840
|
param: {},
|
|
841
841
|
},
|
|
842
842
|
params,
|
|
843
843
|
);
|
|
844
844
|
const { logEventInfo, useEncodeParams, ...otherParams } = getResParams;
|
|
845
845
|
console.log('jd web 获取open协议参数 jdNavigateToNative params: ', getResParams);
|
|
846
846
|
console.log('logEventInfo params: ', logEventInfo);
|
|
847
847
|
global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE &&
|
|
848
848
|
this.clickEventLog(logEventInfo || getResParams)
|
|
849
849
|
.then(() => {
|
|
850
850
|
if (typeof successBack === 'function') {
|
|
851
851
|
successBack(getResParams);
|
|
852
852
|
} else {
|
|
853
853
|
if (this.isNewHarmony() && params.operation === 'jumpTabInner') {
|
|
854
854
|
if (params.jumpTab) {
|
|
855
855
|
JumpTabBarInCurrentShop({ position: 'top', item: params.jumpTab, ...params });
|
|
856
856
|
} else if (params.jumpBottomTab) {
|
|
857
857
|
JumpTabBarInCurrentShop({
|
|
858
858
|
position: 'bottom',
|
|
859
859
|
item: params.jumpBottomTab,
|
|
860
860
|
...params,
|
|
861
861
|
});
|
|
862
862
|
} else {
|
|
863
863
|
console.log('[降级H5] 跳转异常 params:', params);
|
|
864
864
|
}
|
|
865
865
|
} else if (
|
|
866
866
|
this.isNewHarmony() &&
|
|
867
867
|
(params.operation === 'jumpBottomTabMember' || params.des === 'jshopMember')
|
|
868
868
|
) {
|
|
869
869
|
JumpTabBarInCurrentShop({ position: 'bottom', item: 'brandMember', ...params });
|
|
870
870
|
} else {
|
|
871
871
|
try {
|
|
872
872
|
const paramsStr = JSON.stringify(otherParams);
|
|
873
873
|
console.log('跳转web jd open协议', `${url}?params=${paramsStr}`);
|
|
874
874
|
window.location.href =
|
|
875
875
|
isJdAndHarmonyDevice || useEncodeParams
|
|
876
876
|
? `${url}?params=${encodeURIComponent(paramsStr)}`
|
|
877
877
|
: `${url}?params=${paramsStr}`;
|
|
878
878
|
} catch (e) {
|
|
879
879
|
draBusinessCustomReport({
|
|
880
880
|
eventName: 'entryProtocol',
|
|
881
881
|
errorName: 'shop_jdNavigateToNative_error',
|
|
882
882
|
errorMessage: '跳转web jd open协议发生错误',
|
|
883
883
|
extraData: JSON.stringify({
|
|
884
884
|
url,
|
|
885
885
|
isJdApp,
|
|
886
886
|
jdAppVersion: jdAppVersionStr,
|
|
887
887
|
...otherParams,
|
|
888
888
|
}),
|
|
889
889
|
});
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
893
|
})
|
|
894
894
|
.catch(() => {
|
|
895
895
|
typeof failBack === 'function' && failBack(getResParams);
|
|
896
896
|
});
|
|
897
897
|
}
|
|
898
898
|
|
|
899
899
|
clickEventLog(opts: JumpEventReportInterFace.OptEventLogParams = {}, reportKey = 'click') {
|
|
900
900
|
const { eventId, spmAllCode, spmCodeForCD, jsonParam, eventLevel = 3, ...otherParams } = opts;
|
|
901
901
|
if ((eventId || spmAllCode || spmCodeForCD) && jsonParam) {
|
|
902
902
|
const { etModelInfo, logBaseInfo } = jsonParam;
|
|
903
903
|
let getJsonParam = {};
|
|
904
904
|
if (etModelInfo && logBaseInfo) {
|
|
905
905
|
getJsonParam = logBaseInfo;
|
|
906
906
|
} else {
|
|
907
907
|
if (Array.isArray(jsonParam)) {
|
|
908
908
|
getJsonParam = jsonParam;
|
|
909
909
|
} else {
|
|
910
910
|
getJsonParam = Object.assign(
|
|
911
911
|
{},
|
|
912
912
|
{
|
|
913
913
|
shopid: global.info.queryInfo?.shopId,
|
|
914
914
|
},
|
|
915
915
|
jsonParam,
|
|
916
916
|
);
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
919
|
if (
|
|
920
920
|
reportKey === 'exposure' &&
|
|
921
921
|
/^TerminatorNew/.test(eventId) &&
|
|
922
922
|
!Array.isArray(getJsonParam)
|
|
923
923
|
) {
|
|
924
924
|
getJsonParam = [getJsonParam];
|
|
925
925
|
}
|
|
926
926
|
const webLogParams = {
|
|
927
927
|
isExpo: reportKey === 'exposure',
|
|
928
928
|
eid: eventId,
|
|
929
929
|
elevel: eventLevel,
|
|
930
930
|
jsonParam: JSON.stringify(getJsonParam),
|
|
931
931
|
etModel: JSON.stringify(etModelInfo || {}),
|
|
932
932
|
pageId: this.logPageId,
|
|
933
933
|
pageParam: this.logPageParamStr,
|
|
934
934
|
spmAllCode,
|
|
935
935
|
spmCodeForCD,
|
|
936
936
|
...otherParams,
|
|
937
937
|
};
|
|
938
938
|
return /click|exposure/.test(reportKey)
|
|
939
939
|
? reportClick(webLogParams)
|
|
940
940
|
: reportToCart(opts, webLogParams);
|
|
941
941
|
} else {
|
|
942
942
|
console.log('暂无埋点参数eventId和eventParam');
|
|
943
943
|
return Promise.resolve(false);
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
946
|
|
|
947
947
|
exposureEventLog(opts) {
|
|
948
948
|
return global.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
|
|
949
949
|
? this.clickEventLog(
|
|
950
950
|
{
|
|
951
951
|
...opts,
|
|
952
952
|
exposureState: true,
|
|
953
953
|
},
|
|
954
954
|
'exposure',
|
|
955
955
|
)
|
|
956
956
|
: Promise.resolve(false);
|
|
957
957
|
}
|