@conecli/cone-render 0.10.1-beta.4 → 0.10.1-beta.5
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.weapp.ts +1 -1
- package/dist/common/sgmCustomCode.ts +1 -1
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- 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 +3 -0
- 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/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/remoteFloorItem.tsx +1 -1
- package/dist/interface/common.ts +1 -1
- package/dist/interface/component.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/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -0
- package/dist/modules/ContainerFloorList/index.h5.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 +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/sgmCodeUtils.ts +1 -1
- package/dist/utils/taroRenderUtil.ts +1 -1
- package/dist/utils/utils.ts +1 -1
- package/package.json +24 -23
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
|
if (isJdApp) {
|
|
55
54
|
isIosDevice
|
|
56
55
|
? e && e.stopPropagation()
|
|
57
56
|
: androidDeviceStopNativeScrollEvent(state)
|
|
58
57
|
}
|
|
59
58
|
isJdApp &&
|
|
60
59
|
isAndroidDevice &&
|
|
61
60
|
window?.JdAndroid &&
|
|
62
61
|
window?.JdAndroid.requestEvent(state)
|
|
63
62
|
if (isH5AndJdShopView) {
|
|
64
63
|
return (
|
|
65
64
|
CHANNEL_TYPE[currentChannel] ||
|
|
66
65
|
CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
67
66
|
)
|
|
68
67
|
}
|
|
69
68
|
return null
|
|
70
69
|
isH5 && isJdApp && ['/app/home', '/app/classify', '/member/shopcard','/favorite/list', '/favorite/home'].includes(urlPathname)
|
|
71
70
|
isH5 && isJdApp && !['/app/home'].includes(urlPathname)
|
|
72
71
|
return isJdApp ? versionCompare(nowVersion, compareVersion) : -2
|
|
73
72
|
getSgmReadyPromise().then(() => {
|
|
74
73
|
if (
|
|
75
74
|
customObj.hasOwnProperty('code') &&
|
|
76
75
|
customObj.code.indexOf(NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG) !== -1
|
|
77
76
|
) {
|
|
78
77
|
const originCode = customObj.code.substring(
|
|
79
78
|
NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG.length,
|
|
80
79
|
customObj.code.length,
|
|
81
80
|
)
|
|
82
81
|
customObj['code'] = getSgmCustomCode(originCode)
|
|
83
82
|
}
|
|
84
83
|
const getCustomObj = {
|
|
85
84
|
type: 1,
|
|
86
85
|
code: 'all',
|
|
87
86
|
cost1: 1,
|
|
88
87
|
...customObj
|
|
89
88
|
}
|
|
90
89
|
try {
|
|
91
90
|
window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
|
|
92
91
|
} catch (e) {
|
|
93
92
|
console.log("当前sgm上报异常, 原始数据为",JSON.stringify(customObj))
|
|
94
93
|
}
|
|
95
94
|
}).catch(() => {
|
|
96
95
|
console.error("当前页面sgm加载异常,无法进行异常上报, 原始数据为",JSON.stringify(customObj))
|
|
97
96
|
})
|
|
98
97
|
if(isJdAndAndroidDevice && typeof displayObj === 'object'){
|
|
99
98
|
const deviceRatio = window?.devicePixelRatio
|
|
100
99
|
Object.keys(displayObj).forEach(key => {
|
|
101
100
|
if(key === 'nativeHeaderHeight'){
|
|
102
101
|
displayObj[key] = Math.ceil(displayObj[key] / (deviceRatio * deviceRatio) - 2)
|
|
103
102
|
}else {
|
|
104
103
|
displayObj[key] = Math.ceil(displayObj[key] / deviceRatio)
|
|
105
104
|
}
|
|
106
105
|
})
|
|
107
106
|
}
|
|
108
107
|
return displayObj
|
|
108
|
+
import {
|
|
109
109
|
isApp,
|
|
110
110
|
isIOS,
|
|
111
111
|
getAppVersion,
|
|
112
112
|
version,
|
|
113
113
|
getUUID,
|
|
114
114
|
getUrlQuery,
|
|
115
115
|
assign,
|
|
116
116
|
isString,
|
|
117
117
|
isObject,
|
|
118
118
|
serialize,
|
|
119
119
|
isAndroid,
|
|
120
120
|
versionCompare,
|
|
121
121
|
CHANNEL_TYPE,
|
|
122
122
|
JDShopViewBusinessPathType,
|
|
123
123
|
JDShopViewBusinessPathList,
|
|
124
124
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
125
125
|
SECTION_HOME_TAB_TYPE,
|
|
126
126
|
parseQueryUrlObj,
|
|
127
127
|
if (window?.__sgm__) {
|
|
128
128
|
resolve(true)
|
|
129
129
|
} else {
|
|
130
130
|
if (isSgmReadyError) {
|
|
131
131
|
console.log("当前sgm初始化失败")
|
|
132
132
|
reject(false)
|
|
133
133
|
} else {
|
|
134
134
|
ready('__sgm__', 2000).then(() => {
|
|
135
135
|
isSgmReadyError = false
|
|
136
136
|
console.log("当前sgm初始化成功")
|
|
137
137
|
resolve(true)
|
|
138
138
|
}).catch(() => {
|
|
139
139
|
isSgmReadyError = true
|
|
140
140
|
console.log("当前sgm初始化失败")
|
|
141
141
|
reject(false)
|
|
142
142
|
})
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
try {
|
|
146
146
|
return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
|
|
147
147
|
} catch (e) {
|
|
148
148
|
return {}
|
|
149
149
|
}
|
|
150
150
|
isWxMiniH5View && urlCookie['wxapp_type'] == '1'
|
|
151
151
|
if (isH5AdnJxMini) {
|
|
152
152
|
return 'jxxcx'
|
|
153
153
|
} else if (isTJApp) {
|
|
154
154
|
return 'tjapp'
|
|
155
155
|
} else if (isTjM) {
|
|
156
156
|
return 'tjm'
|
|
157
157
|
} else if (isTjJxM) {
|
|
158
158
|
return 'jxh5'
|
|
159
159
|
}
|
|
160
160
|
return ''
|
|
161
161
|
START: 'start',
|
|
162
162
|
MOVE: 'move',
|
|
163
163
|
END: 'end',
|
|
164
164
|
x: 0,
|
|
165
165
|
y: 0
|
|
166
166
|
const startX = startPos.x
|
|
167
167
|
const startY = startPos.y
|
|
168
168
|
const endX = touchEvent.clientX
|
|
169
169
|
const endY = touchEvent.clientY
|
|
170
170
|
const dy = startY - endY
|
|
171
171
|
const dx = endX - startX
|
|
172
172
|
let result = 0
|
|
173
173
|
if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
|
|
174
174
|
return result
|
|
175
175
|
}
|
|
176
176
|
const angle = Math.atan2(dy,dx) * 180 / Math.PI
|
|
177
177
|
if (angle >= -45 && angle < 45) {
|
|
178
178
|
result = 4
|
|
179
179
|
} else if (angle >= 45 && angle < 135) {
|
|
180
180
|
result = 1
|
|
181
181
|
} else if (angle >= -135 && angle < -45) {
|
|
182
182
|
result = 2
|
|
183
183
|
} else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
|
|
184
184
|
result = 3
|
|
185
185
|
}
|
|
186
186
|
return result
|
|
187
187
|
if (isJdApp && e) {
|
|
188
188
|
const touchEvent =
|
|
189
189
|
e?.originalEvent?.targetTouches[0] || e?.targetTouches[0]
|
|
190
190
|
let _touchState = touchType
|
|
191
191
|
let _getDirectionState = false
|
|
192
192
|
if(touchType === TouchType.START){
|
|
193
193
|
StopNativeScrollEventPos.x = touchEvent.clientX
|
|
194
194
|
StopNativeScrollEventPos.y = touchEvent.clientY
|
|
195
195
|
}else if(touchType === TouchType.MOVE){
|
|
196
196
|
_getDirectionState = [1,2].includes(touchMoveGetSlideDirection(StopNativeScrollEventPos,touchEvent))
|
|
197
197
|
if(_getDirectionState){
|
|
198
198
|
_touchState = TouchType.END
|
|
199
199
|
}
|
|
200
200
|
console.log("对外提供阻止横滑方法,当前touchType为move,设定1、2向上或向下方向,当前计算后的滑动是否为纵向", _getDirectionState)
|
|
201
201
|
}else if(touchType === TouchType.END){
|
|
202
202
|
StopNativeScrollEventPos.x = 0
|
|
203
203
|
StopNativeScrollEventPos.y = 0
|
|
204
204
|
}
|
|
205
205
|
isIosDevice
|
|
206
206
|
? iosDeviceStopNativeScrollEvent(e, _touchState, stopTouchDocumentScrollState)
|
|
207
207
|
: androidDeviceStopNativeScrollEvent(_touchState, stopTouchDocumentScrollState)
|
|
208
208
|
if(!isAppHomeForMarketPage && stopTouchDocumentScrollState && _touchState === TouchType.START){
|
|
209
209
|
rootEleNode && rootEleNode.classList.add('over-hidden')
|
|
210
210
|
}
|
|
211
211
|
if(_touchState === TouchType.MOVE && _getDirectionState){
|
|
212
212
|
rootEleNode && rootEleNode.classList.contains('over-hidden') && rootEleNode.classList.remove('over-hidden')
|
|
213
213
|
}else if (_touchState === TouchType.END) {
|
|
214
214
|
setTimeout(() => {
|
|
215
215
|
rootEleNode && rootEleNode.classList.contains('over-hidden') && rootEleNode.classList.remove('over-hidden')
|
|
216
216
|
},isAppHomeForMarketPage || _getDirectionState ? 0 : 200)
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
isJdApp &&
|
|
220
220
|
touchType !== TouchType.MOVE &&
|
|
221
221
|
isAndroidDevice &&
|
|
222
222
|
window?.JdAndroid &&
|
|
223
223
|
window?.JdAndroid.requestEvent(touchType === TouchType.START)
|
|
224
224
|
console.log("对外提供阻止安卓横滑方法,true-禁止外部事件H5可滑动,false-外部拦截h5事件,当前touchType为",touchType,"当前非move触发requestEvent状态为",touchType === TouchType.START,"当前stopTouchDocumentScrollState为",stopTouchDocumentScrollState)
|
|
225
225
|
e && e.stopPropagation();
|
|
226
226
|
console.log("对外提供阻止ios横滑方法,当前touchType为", touchType, "当前stopTouchDocumentScrollState为",stopTouchDocumentScrollState)
|
|
227
227
|
window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
|
|
228
228
|
method: 'callRouterModuleWithParams',
|
|
229
229
|
params: {
|
|
230
230
|
routerURL: 'router://JDShopModule/processShoph5SlideState',
|
|
231
231
|
routerParam: {
|
|
232
232
|
slideDirection: 'horizontal',
|
|
233
233
|
state: touchType,
|
|
234
234
|
},
|
|
235
235
|
callBackId: new Date().getTime(),
|
|
236
236
|
},
|
|
237
237
|
})
|
|
238
238
|
if (isH5AndJdShopView) {
|
|
239
239
|
return (
|
|
240
240
|
CHANNEL_TYPE[currentChannel] ||
|
|
241
241
|
CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
242
242
|
)
|
|
243
243
|
}
|
|
244
244
|
return null
|
|
245
245
|
isH5 && isJdApp && ['/app/home', '/app/classify', '/member/shopcard','/favorite/list', '/favorite/home'].includes(urlPathname)
|
|
246
246
|
isH5 && isJdApp && !['/app/home'].includes(urlPathname)
|
|
247
247
|
return isJdApp ? versionCompare(nowVersion, compareVersion) : -2
|
|
248
248
|
getSgmReadyPromise().then(() => {
|
|
249
249
|
if (
|
|
250
250
|
customObj.hasOwnProperty('code') &&
|
|
251
251
|
customObj.code.indexOf(NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG) !== -1
|
|
252
252
|
) {
|
|
253
253
|
const originCode = customObj.code.substring(
|
|
254
254
|
NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG.length,
|
|
255
255
|
customObj.code.length,
|
|
256
256
|
)
|
|
257
257
|
customObj['code'] = getSgmCustomCode(handleSgmCodeTaroVersion(originCode))
|
|
258
258
|
}
|
|
259
259
|
const getCustomObj = {
|
|
260
260
|
type: 1,
|
|
261
261
|
code: 'all',
|
|
262
262
|
cost1: 1,
|
|
263
263
|
...customObj
|
|
264
264
|
}
|
|
265
265
|
try {
|
|
266
266
|
window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
|
|
267
267
|
} catch (e) {
|
|
268
268
|
console.log("当前sgm上报异常, 原始数据为",JSON.stringify(customObj))
|
|
269
269
|
}
|
|
270
270
|
}).catch(() => {
|
|
271
271
|
console.error("当前页面sgm加载异常,无法进行异常上报, 原始数据为",JSON.stringify(customObj))
|
|
272
272
|
})
|
|
273
273
|
if(isJdAndAndroidDevice && typeof displayObj === 'object'){
|
|
274
274
|
const deviceRatio = window?.devicePixelRatio
|
|
275
275
|
Object.keys(displayObj).forEach(key => {
|
|
276
276
|
if(key === 'nativeHeaderHeight'){
|
|
277
277
|
displayObj[key] = Math.ceil(displayObj[key] / (deviceRatio * deviceRatio) - 2)
|
|
278
278
|
}else {
|
|
279
279
|
displayObj[key] = Math.ceil(displayObj[key] / deviceRatio)
|
|
280
280
|
}
|
|
281
281
|
})
|
|
282
282
|
}
|
|
283
283
|
return displayObj
|