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