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