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