@conecli/cone-render 0.9.1-shop2.16 → 0.9.1-shop2.18
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/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/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.tjm.ts +1 -1
- package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -1
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/open/api/device.ts +1 -1
- package/dist/sass/base.scss +45 -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
|
CHANNEL_TYPE,
|
|
15
14
|
JDShopViewBusinessPathType,
|
|
16
15
|
JDShopViewBusinessPathList,
|
|
17
16
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
18
17
|
SECTION_HOME_TAB_TYPE,
|
|
19
18
|
parseQueryUrlObj,
|
|
20
19
|
if (window?.__sgm__) {
|
|
21
20
|
resolve(true)
|
|
22
21
|
} else {
|
|
23
22
|
if (isSgmReadyError) {
|
|
24
23
|
console.log("当前sgm初始化失败")
|
|
25
24
|
reject(false)
|
|
26
25
|
} else {
|
|
27
26
|
ready('__sgm__', 2000).then(() => {
|
|
28
27
|
isSgmReadyError = false
|
|
29
28
|
console.log("当前sgm初始化成功")
|
|
30
29
|
resolve(true)
|
|
31
30
|
}).catch(() => {
|
|
32
31
|
isSgmReadyError = true
|
|
33
32
|
console.log("当前sgm初始化失败")
|
|
34
33
|
reject(false)
|
|
35
34
|
})
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
try {
|
|
39
38
|
return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
|
|
40
39
|
} catch (e) {
|
|
41
40
|
return {}
|
|
42
41
|
}
|
|
43
42
|
isWxMiniH5View && urlCookie['wxapp_type'] == '1'
|
|
44
43
|
if (isH5AdnJxMini) {
|
|
45
44
|
return 'jxxcx'
|
|
46
45
|
} else if (isTJApp) {
|
|
47
46
|
return 'tjapp'
|
|
48
47
|
} else if (isTjM) {
|
|
49
48
|
return 'tjm'
|
|
50
49
|
} else if (isTjJxM) {
|
|
51
50
|
return 'jxh5'
|
|
52
51
|
}
|
|
53
52
|
return ''
|
|
54
53
|
START: 'start',
|
|
55
54
|
MOVE: 'move',
|
|
56
55
|
END: 'end',
|
|
57
56
|
x: 0,
|
|
58
57
|
y: 0
|
|
59
58
|
const startX = startPos.x
|
|
60
59
|
const startY = startPos.y
|
|
61
60
|
const endX = touchEvent.clientX
|
|
62
61
|
const endY = touchEvent.clientY
|
|
63
62
|
const dy = startY - endY
|
|
64
63
|
const dx = endX - startX
|
|
65
64
|
let result = 0
|
|
66
65
|
if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
|
|
67
66
|
return result
|
|
68
67
|
}
|
|
69
68
|
const angle = Math.atan2(dy,dx) * 180 / Math.PI
|
|
70
69
|
if (angle >= -45 && angle < 45) {
|
|
71
70
|
result = 4
|
|
72
71
|
} else if (angle >= 45 && angle < 135) {
|
|
73
72
|
result = 1
|
|
74
73
|
} else if (angle >= -135 && angle < -45) {
|
|
75
74
|
result = 2
|
|
76
75
|
} else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
|
|
77
76
|
result = 3
|
|
78
77
|
}
|
|
79
78
|
return result
|
|
80
79
|
if (isJdApp && e) {
|
|
81
80
|
const touchEvent =
|
|
82
81
|
e?.originalEvent?.targetTouches[0] || e?.targetTouches[0]
|
|
83
82
|
let _touchState = touchType
|
|
84
83
|
let _getDirectionState = false
|
|
85
84
|
if(touchType === TouchType.START){
|
|
86
85
|
StopNativeScrollEventPos.x = touchEvent.clientX
|
|
87
86
|
StopNativeScrollEventPos.y = touchEvent.clientY
|
|
88
87
|
}else if(touchType === TouchType.MOVE){
|
|
89
88
|
_getDirectionState = [1,2].includes(touchMoveGetSlideDirection(StopNativeScrollEventPos,touchEvent))
|
|
90
89
|
if(_getDirectionState){
|
|
91
90
|
_touchState = TouchType.END
|
|
92
91
|
}
|
|
93
92
|
console.log("对外提供阻止横滑方法,当前touchType为move,设定1、2向上或向下方向,当前计算后的滑动是否为纵向", _getDirectionState)
|
|
94
93
|
}else if(touchType === TouchType.END){
|
|
95
94
|
StopNativeScrollEventPos.x = 0
|
|
96
95
|
StopNativeScrollEventPos.y = 0
|
|
97
96
|
}
|
|
98
97
|
isIosDevice
|
|
99
98
|
? iosDeviceStopNativeScrollEvent(e, _touchState, stopTouchDocumentScrollState)
|
|
100
99
|
: androidDeviceStopNativeScrollEvent(_touchState, stopTouchDocumentScrollState)
|
|
101
100
|
if(!isAppHomeForMarketPage && stopTouchDocumentScrollState && _touchState === TouchType.START){
|
|
102
101
|
rootEleNode && rootEleNode.classList.add('over-hidden')
|
|
103
102
|
}
|
|
104
103
|
if(_touchState === TouchType.MOVE && _getDirectionState){
|
|
105
104
|
rootEleNode && rootEleNode.classList.contains('over-hidden') && rootEleNode.classList.remove('over-hidden')
|
|
106
105
|
}else if (_touchState === TouchType.END) {
|
|
107
106
|
setTimeout(() => {
|
|
108
107
|
rootEleNode && rootEleNode.classList.contains('over-hidden') && rootEleNode.classList.remove('over-hidden')
|
|
109
108
|
},isAppHomeForMarketPage || _getDirectionState ? 0 : 200)
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
isJdApp &&
|
|
113
112
|
touchType !== TouchType.MOVE &&
|
|
114
113
|
isAndroidDevice &&
|
|
115
114
|
window?.JdAndroid &&
|
|
116
115
|
window?.JdAndroid.requestEvent(touchType === TouchType.START)
|
|
117
116
|
console.log("对外提供阻止安卓横滑方法,true-禁止外部事件H5可滑动,false-外部拦截h5事件,当前touchType为",touchType,"当前非move触发requestEvent状态为",touchType === TouchType.START,"当前stopTouchDocumentScrollState为",stopTouchDocumentScrollState)
|
|
118
117
|
e && e.stopPropagation();
|
|
119
118
|
console.log("对外提供阻止ios横滑方法,当前touchType为", touchType, "当前stopTouchDocumentScrollState为",stopTouchDocumentScrollState)
|
|
120
119
|
window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
|
|
121
120
|
method: 'callRouterModuleWithParams',
|
|
122
121
|
params: {
|
|
123
122
|
routerURL: 'router://JDShopModule/processShoph5SlideState',
|
|
124
123
|
routerParam: {
|
|
125
124
|
slideDirection: 'horizontal',
|
|
126
125
|
state: touchType,
|
|
127
126
|
},
|
|
128
127
|
callBackId: new Date().getTime(),
|
|
129
128
|
},
|
|
130
129
|
})
|
|
131
130
|
if (isH5AndJdShopView) {
|
|
132
131
|
return (
|
|
133
132
|
CHANNEL_TYPE[currentChannel] ||
|
|
134
133
|
CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
135
134
|
)
|
|
136
135
|
}
|
|
137
136
|
return null
|
|
138
137
|
isH5 && isJdApp && ['/app/home', '/app/classify', '/member/shopcard','/favorite/list', '/favorite/home'].includes(urlPathname)
|
|
139
138
|
isH5 && isJdApp && !['/app/home'].includes(urlPathname)
|
|
140
139
|
return isJdApp ? versionCompare(nowVersion, compareVersion) : -2
|
|
141
140
|
getSgmReadyPromise().then(() => {
|
|
142
141
|
if (
|
|
143
142
|
customObj.hasOwnProperty('code') &&
|
|
144
143
|
customObj.code.indexOf(NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG) !== -1
|
|
145
144
|
) {
|
|
146
145
|
const originCode = customObj.code.substring(
|
|
147
146
|
NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG.length,
|
|
148
147
|
customObj.code.length,
|
|
149
148
|
)
|
|
150
149
|
customObj['code'] = getSgmCustomCode(handleSgmCodeTaroVersion(originCode))
|
|
151
150
|
}
|
|
152
151
|
const getCustomObj = {
|
|
153
152
|
type: 1,
|
|
154
153
|
code: 'all',
|
|
155
154
|
cost1: 1,
|
|
156
155
|
...customObj
|
|
157
156
|
}
|
|
158
157
|
try {
|
|
159
158
|
window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
|
|
160
159
|
} catch (e) {
|
|
161
160
|
console.log("当前sgm上报异常, 原始数据为",JSON.stringify(customObj))
|
|
162
161
|
}
|
|
163
162
|
}).catch(() => {
|
|
164
163
|
console.error("当前页面sgm加载异常,无法进行异常上报, 原始数据为",JSON.stringify(customObj))
|
|
165
164
|
})
|
|
166
165
|
if(isJdAndAndroidDevice && typeof displayObj === 'object'){
|
|
167
166
|
const deviceRatio = window?.devicePixelRatio
|
|
168
167
|
Object.keys(displayObj).forEach(key => {
|
|
169
168
|
if(key === 'nativeHeaderHeight'){
|
|
170
169
|
displayObj[key] = Math.ceil(displayObj[key] / (deviceRatio * deviceRatio) - 2)
|
|
171
170
|
}else {
|
|
172
171
|
displayObj[key] = Math.ceil(displayObj[key] / deviceRatio)
|
|
173
172
|
}
|
|
174
173
|
})
|
|
175
174
|
}
|
|
176
175
|
return displayObj
|
|
176
|
+
import {
|
|
177
177
|
isApp,
|
|
178
178
|
isIOS,
|
|
179
179
|
getAppVersion,
|
|
180
180
|
version,
|
|
181
181
|
getUUID,
|
|
182
182
|
getUrlQuery,
|
|
183
183
|
assign,
|
|
184
184
|
isString,
|
|
185
185
|
isObject,
|
|
186
186
|
serialize,
|
|
187
187
|
isAndroid,
|
|
188
188
|
versionCompare,
|
|
189
189
|
isIPad,
|
|
190
190
|
CHANNEL_TYPE,
|
|
191
191
|
JDShopViewBusinessPathType,
|
|
192
192
|
JDShopViewBusinessPathList,
|
|
193
193
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
194
194
|
SECTION_HOME_TAB_TYPE,
|
|
195
195
|
parseQueryUrlObj,
|
|
196
196
|
if (window?.__sgm__) {
|
|
197
197
|
resolve(true)
|
|
198
198
|
} else {
|
|
199
199
|
if (isSgmReadyError) {
|
|
200
200
|
console.log("当前sgm初始化失败")
|
|
201
201
|
reject(false)
|
|
202
202
|
} else {
|
|
203
203
|
ready('__sgm__', 2000).then(() => {
|
|
204
204
|
isSgmReadyError = false
|
|
205
205
|
console.log("当前sgm初始化成功")
|
|
206
206
|
resolve(true)
|
|
207
207
|
}).catch(() => {
|
|
208
208
|
isSgmReadyError = true
|
|
209
209
|
console.log("当前sgm初始化失败")
|
|
210
210
|
reject(false)
|
|
211
211
|
})
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
try {
|
|
215
215
|
return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
|
|
216
216
|
} catch (e) {
|
|
217
217
|
return {}
|
|
218
218
|
}
|
|
219
219
|
isWxMiniH5View && urlCookie['wxapp_type'] == '1'
|
|
220
220
|
if (isH5AdnJxMini) {
|
|
221
221
|
return 'jxxcx'
|
|
222
222
|
} else if (isTJApp) {
|
|
223
223
|
return 'tjapp'
|
|
224
224
|
} else if (isTjM) {
|
|
225
225
|
return 'tjm'
|
|
226
226
|
} else if (isTjJxM) {
|
|
227
227
|
return 'jxh5'
|
|
228
228
|
}
|
|
229
229
|
return ''
|
|
230
230
|
START: 'start',
|
|
231
231
|
MOVE: 'move',
|
|
232
232
|
END: 'end',
|
|
233
233
|
x: 0,
|
|
234
234
|
y: 0
|
|
235
235
|
const startX = startPos.x
|
|
236
236
|
const startY = startPos.y
|
|
237
237
|
const endX = touchEvent.clientX
|
|
238
238
|
const endY = touchEvent.clientY
|
|
239
239
|
const dy = startY - endY
|
|
240
240
|
const dx = endX - startX
|
|
241
241
|
let result = 0
|
|
242
242
|
if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
|
|
243
243
|
return result
|
|
244
244
|
}
|
|
245
245
|
const angle = Math.atan2(dy,dx) * 180 / Math.PI
|
|
246
246
|
if (angle >= -45 && angle < 45) {
|
|
247
247
|
result = 4
|
|
248
248
|
} else if (angle >= 45 && angle < 135) {
|
|
249
249
|
result = 1
|
|
250
250
|
} else if (angle >= -135 && angle < -45) {
|
|
251
251
|
result = 2
|
|
252
252
|
} else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
|
|
253
253
|
result = 3
|
|
254
254
|
}
|
|
255
255
|
return result
|
|
256
256
|
if (isJdApp && e) {
|
|
257
257
|
const touchEvent =
|
|
258
258
|
e?.originalEvent?.targetTouches[0] || e?.targetTouches[0]
|
|
259
259
|
let _touchState = touchType
|
|
260
260
|
let _getDirectionState = false
|
|
261
261
|
if(touchType === TouchType.START){
|
|
262
262
|
StopNativeScrollEventPos.x = touchEvent.clientX
|
|
263
263
|
StopNativeScrollEventPos.y = touchEvent.clientY
|
|
264
264
|
}else if(touchType === TouchType.MOVE){
|
|
265
265
|
_getDirectionState = [1,2].includes(touchMoveGetSlideDirection(StopNativeScrollEventPos,touchEvent))
|
|
266
266
|
if(_getDirectionState){
|
|
267
267
|
_touchState = TouchType.END
|
|
268
268
|
}
|
|
269
269
|
console.log("对外提供阻止横滑方法,当前touchType为move,设定1、2向上或向下方向,当前计算后的滑动是否为纵向", _getDirectionState)
|
|
270
270
|
}else if(touchType === TouchType.END){
|
|
271
271
|
StopNativeScrollEventPos.x = 0
|
|
272
272
|
StopNativeScrollEventPos.y = 0
|
|
273
273
|
}
|
|
274
274
|
isIosDevice
|
|
275
275
|
? iosDeviceStopNativeScrollEvent(e, _touchState, stopTouchDocumentScrollState)
|
|
276
276
|
: androidDeviceStopNativeScrollEvent(_touchState, stopTouchDocumentScrollState)
|
|
277
277
|
if(!isAppHomeForMarketPage && stopTouchDocumentScrollState && _touchState === TouchType.START){
|
|
278
278
|
rootEleNode && rootEleNode.classList.add('over-hidden')
|
|
279
279
|
}
|
|
280
280
|
if(_touchState === TouchType.MOVE && _getDirectionState){
|
|
281
281
|
rootEleNode && rootEleNode.classList.contains('over-hidden') && rootEleNode.classList.remove('over-hidden')
|
|
282
282
|
}else if (_touchState === TouchType.END) {
|
|
283
283
|
setTimeout(() => {
|
|
284
284
|
rootEleNode && rootEleNode.classList.contains('over-hidden') && rootEleNode.classList.remove('over-hidden')
|
|
285
285
|
},isAppHomeForMarketPage || _getDirectionState ? 0 : 200)
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
isJdApp &&
|
|
289
289
|
touchType !== TouchType.MOVE &&
|
|
290
290
|
isAndroidDevice &&
|
|
291
291
|
window?.JdAndroid &&
|
|
292
292
|
window?.JdAndroid.requestEvent(touchType === TouchType.START)
|
|
293
293
|
console.log("对外提供阻止安卓横滑方法,true-禁止外部事件H5可滑动,false-外部拦截h5事件,当前touchType为",touchType,"当前非move触发requestEvent状态为",touchType === TouchType.START,"当前stopTouchDocumentScrollState为",stopTouchDocumentScrollState)
|
|
294
294
|
e && e.stopPropagation();
|
|
295
295
|
console.log("对外提供阻止ios横滑方法,当前touchType为", touchType, "当前stopTouchDocumentScrollState为",stopTouchDocumentScrollState)
|
|
296
296
|
window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
|
|
297
297
|
method: 'callRouterModuleWithParams',
|
|
298
298
|
params: {
|
|
299
299
|
routerURL: 'router://JDShopModule/processShoph5SlideState',
|
|
300
300
|
routerParam: {
|
|
301
301
|
slideDirection: 'horizontal',
|
|
302
302
|
state: touchType,
|
|
303
303
|
},
|
|
304
304
|
callBackId: new Date().getTime(),
|
|
305
305
|
},
|
|
306
306
|
})
|
|
307
307
|
if (isH5AndJdShopView) {
|
|
308
308
|
return (
|
|
309
309
|
CHANNEL_TYPE[currentChannel] ||
|
|
310
310
|
CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
311
311
|
)
|
|
312
312
|
}
|
|
313
313
|
return null
|
|
314
314
|
isH5 && isJdApp && ['/app/home', '/app/classify', '/member/shopcard','/favorite/list', '/favorite/home'].includes(urlPathname)
|
|
315
315
|
isH5 && isJdApp && !['/app/home'].includes(urlPathname)
|
|
316
316
|
return isJdApp ? versionCompare(nowVersion, compareVersion) : -2
|
|
317
317
|
getSgmReadyPromise().then(() => {
|
|
318
318
|
if (
|
|
319
319
|
customObj.hasOwnProperty('code') &&
|
|
320
320
|
customObj.code.indexOf(NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG) !== -1
|
|
321
321
|
) {
|
|
322
322
|
const originCode = customObj.code.substring(
|
|
323
323
|
NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG.length,
|
|
324
324
|
customObj.code.length,
|
|
325
325
|
)
|
|
326
326
|
customObj['code'] = getSgmCustomCode(handleSgmCodeTaroVersion(originCode))
|
|
327
327
|
}
|
|
328
328
|
const getCustomObj = {
|
|
329
329
|
type: 1,
|
|
330
330
|
code: 'all',
|
|
331
331
|
cost1: 1,
|
|
332
332
|
...customObj
|
|
333
333
|
}
|
|
334
334
|
try {
|
|
335
335
|
window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
|
|
336
336
|
} catch (e) {
|
|
337
337
|
console.log("当前sgm上报异常, 原始数据为",JSON.stringify(customObj))
|
|
338
338
|
}
|
|
339
339
|
}).catch(() => {
|
|
340
340
|
console.error("当前页面sgm加载异常,无法进行异常上报, 原始数据为",JSON.stringify(customObj))
|
|
341
341
|
})
|
|
342
342
|
if(isJdAndAndroidDevice && typeof displayObj === 'object'){
|
|
343
343
|
const deviceRatio = window?.devicePixelRatio
|
|
344
344
|
Object.keys(displayObj).forEach(key => {
|
|
345
345
|
if(key === 'nativeHeaderHeight'){
|
|
346
346
|
displayObj[key] = Math.ceil(displayObj[key] / (deviceRatio * deviceRatio) - 2)
|
|
347
347
|
}else {
|
|
348
348
|
displayObj[key] = Math.ceil(displayObj[key] / deviceRatio)
|
|
349
349
|
}
|
|
350
350
|
})
|
|
351
351
|
}
|
|
352
352
|
return displayObj
|