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