@conecli/cone-render 0.10.1-shop-beta.5 → 0.10.1-shop3.0
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/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/base/CustomVideo/common.ts +1 -0
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.module.scss +8 -4
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/Price/Base/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/components/floorItem.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +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/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/util.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/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/utils.ts +1 -1
- package/package.json +1 -1
package/dist/utils/h5Utils.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {
|
|
2
1
|
isApp,
|
|
3
2
|
isIOS,
|
|
4
3
|
getAppVersion,
|
|
5
4
|
version,
|
|
6
5
|
getUUID,
|
|
7
6
|
getUrlQuery,
|
|
8
7
|
assign,
|
|
9
8
|
isString,
|
|
10
9
|
isObject,
|
|
11
10
|
serialize,
|
|
12
11
|
isAndroid,
|
|
13
12
|
versionCompare,
|
|
14
13
|
isIPad,
|
|
15
14
|
CHANNEL_TYPE,
|
|
16
15
|
JDShopViewBusinessPathType,
|
|
17
16
|
JDShopViewBusinessPathList,
|
|
18
17
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
19
18
|
SECTION_HOME_TAB_TYPE,
|
|
20
19
|
parseQueryUrlObj,
|
|
21
20
|
if (window?.__sgm__) {
|
|
22
21
|
resolve(true)
|
|
23
22
|
} else {
|
|
24
23
|
if (isSgmReadyError) {
|
|
25
24
|
console.log("当前sgm初始化失败")
|
|
26
25
|
reject(false)
|
|
27
26
|
} else {
|
|
28
27
|
ready('__sgm__', 2000).then(() => {
|
|
29
28
|
isSgmReadyError = false
|
|
30
29
|
console.log("当前sgm初始化成功")
|
|
31
30
|
resolve(true)
|
|
32
31
|
}).catch(() => {
|
|
33
32
|
isSgmReadyError = true
|
|
34
33
|
console.log("当前sgm初始化失败")
|
|
35
34
|
reject(false)
|
|
36
35
|
})
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
try {
|
|
40
39
|
return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
|
|
41
40
|
} catch (e) {
|
|
42
41
|
return {}
|
|
43
42
|
}
|
|
44
43
|
isWxMiniH5View && urlCookie['wxapp_type'] == '1'
|
|
45
44
|
if (isH5AdnJxMini) {
|
|
46
45
|
return 'jxxcx'
|
|
47
46
|
} else if (isTJApp) {
|
|
48
47
|
return 'tjapp'
|
|
49
48
|
} else if (isTjM) {
|
|
50
49
|
return 'tjm'
|
|
51
50
|
} else if (isTjJxM) {
|
|
52
51
|
return 'jxh5'
|
|
53
52
|
}
|
|
54
53
|
return ''
|
|
55
54
|
START: 'start',
|
|
56
55
|
MOVE: 'move',
|
|
57
56
|
END: 'end',
|
|
58
57
|
x: 0,
|
|
59
58
|
y: 0
|
|
60
59
|
const startX = startPos.x
|
|
61
60
|
const startY = startPos.y
|
|
62
61
|
const endX = touchEvent.clientX
|
|
63
62
|
const endY = touchEvent.clientY
|
|
64
63
|
const dy = startY - endY
|
|
65
64
|
const dx = endX - startX
|
|
66
65
|
let result = 0
|
|
67
66
|
if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
|
|
68
67
|
return result
|
|
69
68
|
}
|
|
70
69
|
const angle = Math.atan2(dy,dx) * 180 / Math.PI
|
|
71
70
|
if (angle >= -45 && angle < 45) {
|
|
72
71
|
result = 4
|
|
73
72
|
} else if (angle >= 45 && angle < 135) {
|
|
74
73
|
result = 1
|
|
75
74
|
} else if (angle >= -135 && angle < -45) {
|
|
76
75
|
result = 2
|
|
77
76
|
} else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
|
|
78
77
|
result = 3
|
|
79
78
|
}
|
|
80
79
|
return result
|
|
81
80
|
if (isJdApp && e) {
|
|
82
81
|
const touchEvent =
|
|
83
82
|
e?.originalEvent?.targetTouches[0] || e?.targetTouches[0]
|
|
84
83
|
let _touchState = touchType
|
|
85
84
|
let _getDirectionState = false
|
|
86
85
|
if(touchType === TouchType.START){
|
|
87
86
|
StopNativeScrollEventPos.x = touchEvent.clientX
|
|
88
87
|
StopNativeScrollEventPos.y = touchEvent.clientY
|
|
89
88
|
}else if(touchType === TouchType.MOVE){
|
|
90
89
|
_getDirectionState = [1,2].includes(touchMoveGetSlideDirection(StopNativeScrollEventPos,touchEvent))
|
|
91
90
|
if(_getDirectionState){
|
|
92
91
|
_touchState = TouchType.END
|
|
93
92
|
}
|
|
94
93
|
console.log("对外提供阻止横滑方法,当前touchType为move,设定1、2向上或向下方向,当前计算后的滑动是否为纵向", _getDirectionState)
|
|
95
94
|
}else if(touchType === TouchType.END){
|
|
96
95
|
StopNativeScrollEventPos.x = 0
|
|
97
96
|
StopNativeScrollEventPos.y = 0
|
|
98
97
|
}
|
|
99
98
|
isIosDevice
|
|
100
99
|
? iosDeviceStopNativeScrollEvent(e, _touchState, stopTouchDocumentScrollState)
|
|
101
100
|
: androidDeviceStopNativeScrollEvent(_touchState, stopTouchDocumentScrollState)
|
|
102
101
|
if(!isAppHomeForMarketPage && stopTouchDocumentScrollState && _touchState === TouchType.START){
|
|
103
102
|
rootEleNode && rootEleNode.classList.add('over-hidden')
|
|
104
103
|
}
|
|
105
104
|
if(_touchState === TouchType.MOVE && _getDirectionState){
|
|
106
105
|
rootEleNode && rootEleNode.classList.contains('over-hidden') && rootEleNode.classList.remove('over-hidden')
|
|
107
106
|
}else if (_touchState === TouchType.END) {
|
|
108
107
|
setTimeout(() => {
|
|
109
108
|
rootEleNode && rootEleNode.classList.contains('over-hidden') && rootEleNode.classList.remove('over-hidden')
|
|
110
109
|
},isAppHomeForMarketPage || _getDirectionState ? 0 : 200)
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
112
|
isJdApp &&
|
|
114
113
|
touchType !== TouchType.MOVE &&
|
|
115
114
|
isAndroidDevice &&
|
|
116
115
|
window?.JdAndroid &&
|
|
117
116
|
window?.JdAndroid.requestEvent(touchType === TouchType.START)
|
|
118
117
|
console.log("对外提供阻止安卓横滑方法,true-禁止外部事件H5可滑动,false-外部拦截h5事件,当前touchType为",touchType,"当前非move触发requestEvent状态为",touchType === TouchType.START,"当前stopTouchDocumentScrollState为",stopTouchDocumentScrollState)
|
|
119
118
|
e && e.stopPropagation();
|
|
120
119
|
console.log("对外提供阻止ios横滑方法,当前touchType为", touchType, "当前stopTouchDocumentScrollState为",stopTouchDocumentScrollState)
|
|
121
120
|
window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
|
|
122
121
|
method: 'callRouterModuleWithParams',
|
|
123
122
|
params: {
|
|
124
123
|
routerURL: 'router://JDShopModule/processShoph5SlideState',
|
|
125
124
|
routerParam: {
|
|
126
125
|
slideDirection: 'horizontal',
|
|
127
126
|
state: touchType,
|
|
128
127
|
},
|
|
129
128
|
callBackId: new Date().getTime(),
|
|
130
129
|
},
|
|
131
130
|
})
|
|
132
131
|
if (isH5AndJdShopView) {
|
|
133
132
|
return (
|
|
134
133
|
CHANNEL_TYPE[currentChannel] ||
|
|
135
134
|
CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
136
135
|
)
|
|
137
136
|
}
|
|
138
137
|
return null
|
|
139
138
|
isH5 && isJdApp && ['/app/home', '/app/classify', '/member/shopcard','/favorite/list', '/favorite/home'].includes(urlPathname)
|
|
140
139
|
isH5 && isJdApp && !['/app/home'].includes(urlPathname)
|
|
141
140
|
return isJdApp ? versionCompare(nowVersion, compareVersion) : -2
|
|
142
141
|
getSgmReadyPromise().then(() => {
|
|
143
142
|
if (
|
|
144
143
|
customObj.hasOwnProperty('code') &&
|
|
145
144
|
customObj.code.indexOf(NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG) !== -1
|
|
146
145
|
) {
|
|
147
146
|
const originCode = customObj.code.substring(
|
|
148
147
|
NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG.length,
|
|
149
148
|
customObj.code.length,
|
|
150
149
|
)
|
|
151
150
|
customObj['code'] = getSgmCustomCode(handleSgmCodeTaroVersion(originCode))
|
|
152
151
|
}
|
|
153
152
|
const getCustomObj = {
|
|
154
153
|
type: 1,
|
|
155
154
|
code: 'all',
|
|
156
155
|
cost1: 1,
|
|
157
156
|
...customObj
|
|
158
157
|
}
|
|
159
158
|
try {
|
|
160
159
|
window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
|
|
161
160
|
} catch (e) {
|
|
162
161
|
console.log("当前sgm上报异常, 原始数据为",JSON.stringify(customObj))
|
|
163
162
|
}
|
|
164
163
|
}).catch(() => {
|
|
165
164
|
console.error("当前页面sgm加载异常,无法进行异常上报, 原始数据为",JSON.stringify(customObj))
|
|
166
165
|
})
|
|
167
166
|
if(isJdAndAndroidDevice && typeof displayObj === 'object'){
|
|
168
167
|
const deviceRatio = window?.devicePixelRatio
|
|
169
168
|
Object.keys(displayObj).forEach(key => {
|
|
170
169
|
if(key === 'nativeHeaderHeight'){
|
|
171
170
|
displayObj[key] = Math.ceil(displayObj[key] / (deviceRatio * deviceRatio) - 2)
|
|
172
171
|
}else {
|
|
173
172
|
displayObj[key] = Math.ceil(displayObj[key] / deviceRatio)
|
|
174
173
|
}
|
|
175
174
|
})
|
|
176
175
|
}
|
|
177
176
|
return displayObj
|
|
177
|
+
import {
|
|
178
178
|
isApp,
|
|
179
179
|
isIOS,
|
|
180
180
|
getAppVersion,
|
|
181
181
|
version,
|
|
182
182
|
getUUID,
|
|
183
183
|
getUrlQuery,
|
|
184
184
|
assign,
|
|
185
185
|
isString,
|
|
186
186
|
isObject,
|
|
187
187
|
serialize,
|
|
188
188
|
isAndroid,
|
|
189
189
|
versionCompare,
|
|
190
190
|
isIPad,
|
|
191
191
|
CHANNEL_TYPE,
|
|
192
192
|
JDShopViewBusinessPathType,
|
|
193
193
|
JDShopViewBusinessPathList,
|
|
194
194
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
195
195
|
SECTION_HOME_TAB_TYPE,
|
|
196
196
|
DraBuryPointFlags,
|
|
197
197
|
MPAAS_CONFIG_APP_VERSION,
|
|
198
198
|
window?.location?.href ?? '',
|
|
199
199
|
new Promise((resolve, reject) => {
|
|
200
200
|
if (window?.__sgm__) {
|
|
201
201
|
resolve(true)
|
|
202
202
|
} else {
|
|
203
203
|
if (isSgmReadyError) {
|
|
204
204
|
console.log('当前sgm初始化失败')
|
|
205
205
|
reject(false)
|
|
206
206
|
} else {
|
|
207
207
|
ready('__sgm__', 2000)
|
|
208
208
|
.then(() => {
|
|
209
209
|
isSgmReadyError = false
|
|
210
210
|
console.log('当前sgm初始化成功')
|
|
211
211
|
resolve(true)
|
|
212
212
|
})
|
|
213
213
|
.catch(() => {
|
|
214
214
|
isSgmReadyError = true
|
|
215
215
|
console.log('当前sgm初始化失败')
|
|
216
216
|
reject(false)
|
|
217
217
|
})
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
})
|
|
221
221
|
console.log(message)
|
|
222
222
|
reject(new Error(message))
|
|
223
223
|
return ready('dra', 2000)
|
|
224
224
|
.then(() => {
|
|
225
225
|
isNewDraSdkReadyError = false
|
|
226
226
|
console.log('当前新版烛龙sdk初始化成功')
|
|
227
227
|
return true
|
|
228
228
|
})
|
|
229
229
|
.catch(() => {
|
|
230
230
|
isNewDraSdkReadyError = true
|
|
231
231
|
throw new Error('当前新版烛龙sdk初始化失败')
|
|
232
232
|
})
|
|
233
233
|
return new Promise((resolve, reject) => {
|
|
234
234
|
if (window?.dra) {
|
|
235
235
|
resolve(true)
|
|
236
236
|
} else if (isNewDraSdkReadyError) {
|
|
237
237
|
logAndReject('当前新版烛龙sdk初始化失败', reject)
|
|
238
238
|
} else {
|
|
239
239
|
initializeDraSdk()
|
|
240
240
|
.then(resolve)
|
|
241
241
|
.catch((error) => logAndReject(error.message, reject))
|
|
242
242
|
}
|
|
243
243
|
})
|
|
244
244
|
try {
|
|
245
245
|
return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
|
|
246
246
|
} catch (e) {
|
|
247
247
|
return {}
|
|
248
248
|
}
|
|
249
249
|
isWxMiniH5View && urlCookie['wxapp_type'] == '1'
|
|
250
250
|
window.shopGlobalSwitch?.isH5AndJdShopViewH5ScrollVersion || ''
|
|
251
251
|
!!document.getElementById('mallType') &&
|
|
252
252
|
!!document.getElementById('pageInstance_id') &&
|
|
253
253
|
!!document.getElementById('pageInstance_appId')
|
|
254
254
|
isTjScence &&
|
|
255
255
|
isWxMiniH5View &&
|
|
256
256
|
(urlCookie['wxapp_type'] == '2' ||
|
|
257
257
|
cookie.get('wxapp_type') == '2' ||
|
|
258
258
|
parseQueryUrlObj['tjChannel'] === 'jxxcx')
|
|
259
259
|
isTjScence && isWxMiniH5View && parseQueryUrlObj['sourceApp'] === 'haowujie'
|
|
260
260
|
isTjScence &&
|
|
261
261
|
(parseQueryUrlObj['appCode'] === 'ms27cba806' ||
|
|
262
262
|
document.referrer?.match(/(?:https?:)?\/\/(?:kpl\.m|css|cs)\.jd\.com/i)
|
|
263
263
|
?.length ||
|
|
264
264
|
(parseQueryUrlObj['sourceApp'] == 'jsb-m' &&
|
|
265
265
|
parseQueryUrlObj['appCode'] === '') ||
|
|
266
266
|
parseQueryUrlObj['tjChannel'] === 'tjm')
|
|
267
267
|
if (isH5AdnJxMini) {
|
|
268
268
|
return 'jxxcx'
|
|
269
269
|
} else if (isTJApp) {
|
|
270
270
|
return 'tjapp'
|
|
271
271
|
} else if (isTjM) {
|
|
272
272
|
return 'tjm'
|
|
273
273
|
} else if (isTjJxM) {
|
|
274
274
|
return 'jxh5'
|
|
275
275
|
}
|
|
276
276
|
return ''
|
|
277
277
|
START: 'start',
|
|
278
278
|
MOVE: 'move',
|
|
279
279
|
END: 'end',
|
|
280
280
|
x: 0,
|
|
281
281
|
y: 0,
|
|
282
282
|
const startX = startPos.x
|
|
283
283
|
const startY = startPos.y
|
|
284
284
|
const endX = touchEvent.clientX
|
|
285
285
|
const endY = touchEvent.clientY
|
|
286
286
|
const dy = startY - endY
|
|
287
287
|
const dx = endX - startX
|
|
288
288
|
let result = 0
|
|
289
289
|
if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
|
|
290
290
|
return result
|
|
291
291
|
}
|
|
292
292
|
const angle = (Math.atan2(dy, dx) * 180) / Math.PI
|
|
293
293
|
if (angle >= -45 && angle < 45) {
|
|
294
294
|
result = 4
|
|
295
295
|
} else if (angle >= 45 && angle < 135) {
|
|
296
296
|
result = 1
|
|
297
297
|
} else if (angle >= -135 && angle < -45) {
|
|
298
298
|
result = 2
|
|
299
299
|
} else if (
|
|
300
300
|
(angle >= 135 && angle <= 180) ||
|
|
301
301
|
(angle >= -180 && angle < -135)
|
|
302
302
|
) {
|
|
303
303
|
result = 3
|
|
304
304
|
}
|
|
305
305
|
return result
|
|
306
306
|
e: Event,
|
|
307
307
|
touchType = TouchType.START,
|
|
308
308
|
stopTouchDocumentScrollState = false,
|
|
309
309
|
if (isJdApp && e) {
|
|
310
310
|
const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0]
|
|
311
311
|
let _touchState = touchType
|
|
312
312
|
let _getDirectionState = false
|
|
313
313
|
if (touchType === TouchType.START) {
|
|
314
314
|
StopNativeScrollEventPos.x = touchEvent.clientX
|
|
315
315
|
StopNativeScrollEventPos.y = touchEvent.clientY
|
|
316
316
|
} else if (touchType === TouchType.MOVE) {
|
|
317
317
|
_getDirectionState = [1, 2].includes(
|
|
318
318
|
touchMoveGetSlideDirection(StopNativeScrollEventPos, touchEvent),
|
|
319
319
|
)
|
|
320
320
|
if (_getDirectionState) {
|
|
321
321
|
_touchState = TouchType.END
|
|
322
322
|
}
|
|
323
323
|
console.log(
|
|
324
324
|
'对外提供阻止横滑方法,当前touchType为move,设定1、2向上或向下方向,当前计算后的滑动是否为纵向',
|
|
325
325
|
_getDirectionState,
|
|
326
326
|
)
|
|
327
327
|
} else if (touchType === TouchType.END) {
|
|
328
328
|
StopNativeScrollEventPos.x = 0
|
|
329
329
|
StopNativeScrollEventPos.y = 0
|
|
330
330
|
}
|
|
331
331
|
isIosDevice
|
|
332
332
|
? iosDeviceStopNativeScrollEvent(
|
|
333
333
|
e,
|
|
334
334
|
_touchState,
|
|
335
335
|
stopTouchDocumentScrollState,
|
|
336
336
|
)
|
|
337
337
|
: androidDeviceStopNativeScrollEvent(
|
|
338
338
|
_touchState,
|
|
339
339
|
stopTouchDocumentScrollState,
|
|
340
340
|
)
|
|
341
341
|
if (
|
|
342
342
|
!isAppHomeForMarketPage &&
|
|
343
343
|
stopTouchDocumentScrollState &&
|
|
344
344
|
_touchState === TouchType.START
|
|
345
345
|
) {
|
|
346
346
|
rootEleNode && rootEleNode.classList.add('over-hidden')
|
|
347
347
|
}
|
|
348
348
|
if (_touchState === TouchType.MOVE && _getDirectionState) {
|
|
349
349
|
rootEleNode &&
|
|
350
350
|
rootEleNode.classList.contains('over-hidden') &&
|
|
351
351
|
rootEleNode.classList.remove('over-hidden')
|
|
352
352
|
} else if (_touchState === TouchType.END) {
|
|
353
353
|
setTimeout(
|
|
354
354
|
() => {
|
|
355
355
|
rootEleNode &&
|
|
356
356
|
rootEleNode.classList.contains('over-hidden') &&
|
|
357
357
|
rootEleNode.classList.remove('over-hidden')
|
|
358
358
|
},
|
|
359
359
|
isAppHomeForMarketPage || _getDirectionState ? 0 : 200,
|
|
360
360
|
)
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
touchType = TouchType.START,
|
|
364
364
|
stopTouchDocumentScrollState = false,
|
|
365
365
|
isJdApp &&
|
|
366
366
|
touchType !== TouchType.MOVE &&
|
|
367
367
|
isAndroidDevice &&
|
|
368
368
|
window?.JdAndroid &&
|
|
369
369
|
window?.JdAndroid.requestEvent(touchType === TouchType.START)
|
|
370
370
|
console.log(
|
|
371
371
|
'对外提供阻止安卓横滑方法,true-禁止外部事件H5可滑动,false-外部拦截h5事件,当前touchType为',
|
|
372
372
|
touchType,
|
|
373
373
|
'当前非move触发requestEvent状态为',
|
|
374
374
|
touchType === TouchType.START,
|
|
375
375
|
'当前stopTouchDocumentScrollState为',
|
|
376
376
|
stopTouchDocumentScrollState,
|
|
377
377
|
)
|
|
378
378
|
e,
|
|
379
379
|
touchType = TouchType.START,
|
|
380
380
|
stopTouchDocumentScrollState = false,
|
|
381
381
|
e && e.stopPropagation()
|
|
382
382
|
console.log(
|
|
383
383
|
'对外提供阻止ios横滑方法,当前touchType为',
|
|
384
384
|
touchType,
|
|
385
385
|
'当前stopTouchDocumentScrollState为',
|
|
386
386
|
stopTouchDocumentScrollState,
|
|
387
387
|
)
|
|
388
388
|
window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
|
|
389
389
|
method: 'callRouterModuleWithParams',
|
|
390
390
|
params: {
|
|
391
391
|
routerURL: 'router://JDShopModule/processShoph5SlideState',
|
|
392
392
|
routerParam: {
|
|
393
393
|
slideDirection: 'horizontal',
|
|
394
394
|
state: touchType,
|
|
395
395
|
},
|
|
396
396
|
callBackId: new Date().getTime(),
|
|
397
397
|
},
|
|
398
398
|
})
|
|
399
399
|
if (isH5AndJdShopView) {
|
|
400
400
|
return (
|
|
401
401
|
CHANNEL_TYPE[currentChannel] ||
|
|
402
402
|
CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
403
403
|
)
|
|
404
404
|
}
|
|
405
405
|
return null
|
|
406
406
|
isH5 &&
|
|
407
407
|
isJdApp &&
|
|
408
408
|
[
|
|
409
409
|
'/app/home',
|
|
410
410
|
'/app/classify',
|
|
411
411
|
'/member/shopcard',
|
|
412
412
|
'/favorite/list',
|
|
413
413
|
'/favorite/home',
|
|
414
414
|
].includes(urlPathname)
|
|
415
415
|
isH5 && isJdApp && !['/app/home'].includes(urlPathname)
|
|
416
416
|
['/app/home'].includes(urlPathname) &&
|
|
417
417
|
menuObj.tabActiveType != SECTION_HOME_TAB_TYPE.HOME_PROMOTION &&
|
|
418
418
|
menuObj.tabActiveType != SECTION_HOME_TAB_TYPE.HOME_MEMBER
|
|
419
419
|
isAppHomePage && parseQueryUrlObj['source'] === 'app-marketing'
|
|
420
420
|
isH5 &&
|
|
421
421
|
isAppHomePage &&
|
|
422
422
|
versionCompare(
|
|
423
423
|
jdAppVersion?.full ? jdAppVersion.full : '',
|
|
424
424
|
isH5AndJdShopViewH5ScrollVersion,
|
|
425
425
|
) >= 0
|
|
426
426
|
compareVersion,
|
|
427
427
|
nowVersion = jdAppVersionStr,
|
|
428
428
|
return isJdApp ? versionCompare(nowVersion, compareVersion) : -2
|
|
429
429
|
getSgmReadyPromise()
|
|
430
430
|
.then(() => {
|
|
431
431
|
if (
|
|
432
432
|
customObj.hasOwnProperty('code') &&
|
|
433
433
|
customObj.code.indexOf(NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG) !== -1
|
|
434
434
|
) {
|
|
435
435
|
const originCode = customObj.code.substring(
|
|
436
436
|
NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG.length,
|
|
437
437
|
customObj.code.length,
|
|
438
438
|
)
|
|
439
439
|
customObj['code'] = getSgmCustomCode(
|
|
440
440
|
handleSgmCodeTaroVersion(originCode),
|
|
441
441
|
)
|
|
442
442
|
}
|
|
443
443
|
const getCustomObj = {
|
|
444
444
|
type: 1,
|
|
445
445
|
code: 'all',
|
|
446
446
|
cost1: 1,
|
|
447
447
|
...customObj,
|
|
448
448
|
}
|
|
449
449
|
try {
|
|
450
450
|
window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
|
|
451
451
|
} catch (e) {
|
|
452
452
|
console.log('当前sgm上报异常, 原始数据为', JSON.stringify(customObj))
|
|
453
453
|
}
|
|
454
454
|
})
|
|
455
455
|
.catch(() => {
|
|
456
456
|
console.error(
|
|
457
457
|
'当前页面sgm加载异常,无法进行异常上报, 原始数据为',
|
|
458
458
|
JSON.stringify(customObj),
|
|
459
459
|
)
|
|
460
460
|
})
|
|
461
461
|
customContextObj = {},
|
|
462
462
|
customMetricsObj = {},
|
|
463
463
|
name?,
|
|
464
464
|
try {
|
|
465
465
|
await getNewDraSdkReadyPromise()
|
|
466
466
|
const draBurypointFlag = name ?? DraBuryPointFlags.BUSINESS
|
|
467
467
|
const commonObj = {
|
|
468
468
|
shopId: `${global.info.queryInfo.shopId || ''}`,
|
|
469
469
|
venderId: `${global.info.queryInfo.venderId || ''}`,
|
|
470
470
|
taroRenderVersion: window?.taroRenderVersion,
|
|
471
471
|
environmentType: getEnvironmentType(),
|
|
472
472
|
pageType: getPageType(),
|
|
473
473
|
}
|
|
474
474
|
try {
|
|
475
475
|
window.dra.sendCustomEvent(
|
|
476
476
|
{
|
|
477
477
|
name: draBurypointFlag,
|
|
478
478
|
metrics: {
|
|
479
479
|
timeStamp: Date.now(),
|
|
480
480
|
...customMetricsObj,
|
|
481
481
|
},
|
|
482
482
|
context: {
|
|
483
483
|
...commonObj,
|
|
484
484
|
...customContextObj,
|
|
485
485
|
},
|
|
486
486
|
},
|
|
487
487
|
true,
|
|
488
488
|
)
|
|
489
489
|
} catch (e) {
|
|
490
490
|
console.error(
|
|
491
491
|
'当前新版烛龙sdk上报异常, 原始数据为',
|
|
492
492
|
JSON.stringify({ ...customContextObj, ...customMetricsObj }),
|
|
493
493
|
'e',
|
|
494
494
|
e,
|
|
495
495
|
)
|
|
496
496
|
}
|
|
497
497
|
} catch (e) {
|
|
498
498
|
console.error(
|
|
499
499
|
'当前页面新版烛龙sdk加载异常,无法进行异常上报, 原始数据为',
|
|
500
500
|
JSON.stringify({ ...customContextObj, ...customMetricsObj }),
|
|
501
501
|
'e',
|
|
502
502
|
e,
|
|
503
503
|
)
|
|
504
504
|
}
|
|
505
505
|
customContextObj = {},
|
|
506
506
|
customMetricsObj = {},
|
|
507
507
|
draCustomReport(customContextObj, customMetricsObj, DraBuryPointFlags.REMOTE)
|
|
508
508
|
customContextObj = {},
|
|
509
509
|
customMetricsObj = {},
|
|
510
510
|
draCustomReport(
|
|
511
511
|
customContextObj,
|
|
512
512
|
customMetricsObj,
|
|
513
513
|
DraBuryPointFlags.INTERFACE,
|
|
514
514
|
)
|
|
515
515
|
customContextObj = {},
|
|
516
516
|
customMetricsObj = {},
|
|
517
517
|
draCustomReport(
|
|
518
518
|
customContextObj,
|
|
519
519
|
customMetricsObj,
|
|
520
520
|
DraBuryPointFlags.BUSINESS,
|
|
521
521
|
)
|
|
522
522
|
if (isJdAndAndroidDevice && typeof displayObj === 'object') {
|
|
523
523
|
const deviceRatio = window?.devicePixelRatio
|
|
524
524
|
Object.keys(displayObj).forEach((key) => {
|
|
525
525
|
if (key === 'nativeHeaderHeight') {
|
|
526
526
|
displayObj[key] = Math.ceil(
|
|
527
527
|
displayObj[key] / (deviceRatio * deviceRatio) - 2,
|
|
528
528
|
)
|
|
529
529
|
} else {
|
|
530
530
|
displayObj[key] = Math.ceil(displayObj[key] / deviceRatio)
|
|
531
531
|
}
|
|
532
532
|
})
|
|
533
533
|
}
|
|
534
534
|
return displayObj
|
|
535
535
|
isJdAndAndroidDevice && /TBS\/\d+/.test(window?.navigator?.userAgent)
|
|
536
536
|
jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
|