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