@conecli/cone-render 0.8.38-beta.0 → 0.8.38
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/wxappApi.ts +1 -1
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/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/index.h5.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/open/api/index.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/common/jssdk.ts +0 -1
- package/dist/jumpEventReport/web.pc.ts +0 -1
- package/dist/wxapp/api/helper.js +0 -1
- package/dist/wxapp/components/launch-app/index.js +0 -1
- package/dist/wxapp/components/launch-app/index.json +0 -5
- package/dist/wxapp/components/launch-app/index.wxml +0 -0
- package/dist/wxapp/components/launch-app/index.wxss +0 -0
- package/dist/wxapp/components/subscribe-guider/helper.js +0 -1
- package/dist/wxapp/components/subscribe-guider/index.js +0 -1
- package/dist/wxapp/components/subscribe-guider/index.json +0 -5
- package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
- package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, {useRef, useEffect} from 'react'
|
|
2
1
|
isH5AndJdShopView,
|
|
3
2
|
isAndroidDevice,
|
|
4
3
|
isIosDevice,
|
|
5
4
|
isJdApp,
|
|
6
5
|
isWxMin,
|
|
7
6
|
isH5AndJdShopViewH5Scroll,
|
|
8
7
|
isH5,
|
|
9
8
|
const rootEleNode = isH5 && document ? document.querySelector('body') : null
|
|
10
9
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
11
10
|
const GetSlideAngle = (dx,dy) => {
|
|
12
11
|
return Math.atan2(dy,dx) * 180 / Math.PI;
|
|
13
12
|
}
|
|
14
13
|
const GetSlideDirection = (startX,startY,endX,endY) => {
|
|
15
14
|
const dy = startY - endY;
|
|
16
15
|
const dx = endX - startX;
|
|
17
16
|
let result = 0;
|
|
18
17
|
if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
|
|
19
18
|
return result;
|
|
20
19
|
}
|
|
21
20
|
const angle = GetSlideAngle(dx, dy);
|
|
22
21
|
if (angle >= -45 && angle < 45) {
|
|
23
22
|
result = 4;
|
|
24
23
|
}else if (angle >= 45 && angle < 135) {
|
|
25
24
|
result = 1;
|
|
26
25
|
}else if (angle >= -135 && angle < -45) {
|
|
27
26
|
result = 2;
|
|
28
27
|
}else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
|
|
29
28
|
result = 3;
|
|
30
29
|
}
|
|
31
30
|
return result;
|
|
32
31
|
}
|
|
33
32
|
needShowHighVersion && rootEleNode && rootEleNode.classList.add('over-hidden')
|
|
34
33
|
const touchEvent =
|
|
35
34
|
e?.originalEvent?.targetTouches[0] || e?.targetTouches[0]
|
|
36
35
|
const xDiff = Math.abs(
|
|
37
36
|
touchEvent.clientX - mLastClientPosRef.current.mLastClientX,
|
|
38
37
|
).toFixed(2)
|
|
39
38
|
const yDiff = Math.abs(
|
|
40
39
|
touchEvent.clientY - mLastClientPosRef.current.mLastClientY,
|
|
41
40
|
).toFixed(2)
|
|
42
41
|
if(isAndroidDevice) {
|
|
43
42
|
if (xDiff >= window.JDJshopViewInfo.androidTouchSlop) {
|
|
44
43
|
console.log(
|
|
45
44
|
'横向滚动触发',
|
|
46
45
|
xDiff,
|
|
47
46
|
touchEvent,
|
|
48
47
|
window.JDJshopViewInfo.androidTouchSlop,
|
|
49
48
|
)
|
|
50
49
|
} else if (yDiff > window.JDJshopViewInfo.androidTouchSlop) {
|
|
51
50
|
console.log(
|
|
52
51
|
'纵向滚动触发',
|
|
53
52
|
yDiff,
|
|
54
53
|
touchEvent,
|
|
55
54
|
window.JDJshopViewInfo.androidTouchSlop,
|
|
56
55
|
)
|
|
57
56
|
androidDeviceStopNativeScrollEvent(false)
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
if(needShowHighVersion) {
|
|
61
60
|
const direction = GetSlideDirection(mLastClientPosRef.current.mLastClientX, mLastClientPosRef.current.mLastClientY, touchEvent.clientX, touchEvent.clientY);
|
|
62
61
|
if(direction === 1 || direction === 2) {
|
|
63
62
|
rootEleNode && rootEleNode.classList.remove('over-hidden')
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
<ScrollView
|
|
67
66
|
scrollX
|
|
68
67
|
onTouchStart={changeTouchStart}
|
|
69
68
|
onTouchEnd={changeTouchEnd}
|
|
70
69
|
onTouchCancel={changeTouchEnd}
|
|
71
70
|
onTouchMove={changeTouchMove}
|
|
72
71
|
enhanced
|
|
73
72
|
showScrollbar={false}
|
|
74
73
|
style={style}
|
|
75
74
|
className={classNames(className, {
|
|
76
75
|
[customScrollViewStyle[
|
|
77
76
|
'd-custom-ios-h5-extend-border-radius'
|
|
78
77
|
]]: isIosDevice,
|
|
79
78
|
},'J_customScroll')}
|
|
80
79
|
{...otherProps}
|
|
81
80
|
>
|
|
82
81
|
{children}
|
|
83
82
|
</ScrollView>
|
|
83
|
+
import React, {useRef, useEffect} from 'react'
|
|
84
84
|
isH5AndJdShopView,
|
|
85
85
|
isAndroidDevice,
|
|
86
86
|
isIosDevice,
|
|
87
87
|
isJdApp,
|
|
88
88
|
isWxMin,
|
|
89
89
|
isH5AndJdShopViewH5Scroll,
|
|
90
90
|
isH5,
|
|
91
91
|
const rootEleNode = isH5 && document ? document.querySelector('body') : null
|
|
92
92
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
93
93
|
e && e.stopPropagation()
|
|
94
94
|
if(!verticalScrolling) {
|
|
95
95
|
needShowHighVersion && rootEleNode && rootEleNode.classList.add('over-hidden')
|
|
96
96
|
}
|
|
97
97
|
e && e.stopPropagation()
|
|
98
98
|
e && e.stopPropagation()
|
|
99
99
|
if(!verticalScrolling) {
|
|
100
100
|
needShowHighVersion && rootEleNode && rootEleNode.classList.add('over-hidden')
|
|
101
101
|
}
|
|
102
102
|
if(!verticalScrolling) {
|
|
103
103
|
needShowHighVersion && rootEleNode && rootEleNode.classList.remove('over-hidden')
|
|
104
104
|
}
|
|
105
105
|
<ScrollView
|
|
106
106
|
scrollX
|
|
107
107
|
onTouchStart={changeTouchStart}
|
|
108
108
|
onTouchEnd={changeTouchEnd}
|
|
109
109
|
onTouchCancel={changeTouchEnd}
|
|
110
110
|
onTouchMove={changeTouchMove}
|
|
111
111
|
enhanced
|
|
112
112
|
showScrollbar={false}
|
|
113
113
|
style={style}
|
|
114
114
|
className={classNames(className, {
|
|
115
115
|
[customScrollViewStyle[
|
|
116
116
|
'd-custom-ios-h5-extend-border-radius'
|
|
117
117
|
]]: isIosDevice,
|
|
118
118
|
},'J_customScroll')}
|
|
119
119
|
{...otherProps}
|
|
120
120
|
>
|
|
121
121
|
{children}
|
|
122
122
|
</ScrollView>
|
|
123
123
|
verticalScrolling: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
TaroEventType,
|
|
3
2
|
WEBVIEW_STATE,
|
|
4
3
|
M_H5_ROOT_ELE_NODE,
|
|
5
4
|
latestFromNativeMsgStorage,
|
|
6
5
|
getNativePageScrollRes,
|
|
7
6
|
props: ComponentInterFace.InOrOutViewObserverProps,
|
|
8
7
|
const {
|
|
9
8
|
children,
|
|
10
9
|
style,
|
|
11
10
|
inViewCallback,
|
|
12
11
|
outViewCallback,
|
|
13
12
|
threshold = 0,
|
|
14
13
|
} = props
|
|
15
14
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
16
15
|
const componentObserverRef = useRef<HTMLElement | null>(null)
|
|
17
16
|
const componentShowStateRef = useRef(false)
|
|
18
17
|
const needShowHighVersion = isAppClassifyPage || (isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true"))
|
|
19
18
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
|
|
20
19
|
if (isH5AndJdShopView && !needShowHighVersion) {
|
|
21
20
|
console.log('视频========属于app原生滚动')
|
|
22
21
|
useEffect(() => {
|
|
23
22
|
const latestRes =
|
|
24
23
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
25
24
|
dealPageScrollInfo(latestRes)
|
|
26
25
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
27
26
|
dealPageScrollInfo(res)
|
|
28
27
|
})
|
|
29
28
|
Taro.eventCenter.on(
|
|
30
29
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
31
30
|
(state) => {
|
|
32
31
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
33
32
|
},
|
|
34
33
|
)
|
|
35
34
|
return function cleanup() {
|
|
36
35
|
Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, (res) => {
|
|
37
36
|
dealPageScrollInfo(res)
|
|
38
37
|
})
|
|
39
38
|
Taro.eventCenter.off(
|
|
40
39
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
41
40
|
(state) => {
|
|
42
41
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
43
42
|
},
|
|
44
43
|
)
|
|
45
44
|
}
|
|
46
45
|
}, [])
|
|
47
46
|
useEffect(() => {
|
|
48
47
|
if (componentShowState) {
|
|
49
48
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
50
49
|
console.log('app=>in可视区域')
|
|
51
50
|
} else {
|
|
52
51
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
53
52
|
console.log('app=>out可视区域')
|
|
54
53
|
}
|
|
55
54
|
}, [componentShowState])
|
|
56
55
|
|
|
57
56
|
const handleInOrOutView = (type: boolean) => {
|
|
58
57
|
componentShowStateRef.current = type
|
|
59
58
|
setComponentShowState(type)
|
|
60
59
|
console.log('handleInOrOutView', type)
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
const dealPageScrollInfo = (res) => {
|
|
64
63
|
console.log('dealPageScrollInfo===', res)
|
|
65
64
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
66
65
|
if (
|
|
67
66
|
typeof displayHeight === 'undefined' ||
|
|
68
67
|
typeof offSetY === 'undefined'
|
|
69
68
|
)
|
|
70
69
|
return
|
|
71
70
|
console.log(
|
|
72
71
|
'处理后dealPageScrollInfo===displayHeight=offSetY',
|
|
73
72
|
displayHeight,
|
|
74
73
|
offSetY,
|
|
75
74
|
)
|
|
76
75
|
if (componentObserverRef.current) {
|
|
77
76
|
const eleClientRect =
|
|
78
77
|
componentObserverRef.current.getBoundingClientRect()
|
|
79
78
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
80
79
|
const eleHeight = Math.ceil(eleClientRect.height)
|
|
81
80
|
console.log(
|
|
82
81
|
'==========================eleOffsetTop, eleHeight',
|
|
83
82
|
eleOffsetTop,
|
|
84
83
|
eleHeight,
|
|
85
84
|
)
|
|
86
85
|
if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
|
|
87
86
|
const isOutView =
|
|
88
87
|
offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
|
|
89
88
|
displayHeight - (eleOffsetTop - offSetY) <
|
|
90
89
|
Math.ceil(eleHeight * threshold)
|
|
91
90
|
console.log(
|
|
92
91
|
'比较isOutView',
|
|
93
92
|
isOutView,
|
|
94
93
|
offSetY,
|
|
95
94
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
96
95
|
displayHeight - (eleOffsetTop - offSetY),
|
|
97
96
|
Math.ceil(eleHeight * threshold),
|
|
98
97
|
)
|
|
99
98
|
handleInOrOutView(!isOutView)
|
|
100
99
|
} else {
|
|
101
100
|
const isInView =
|
|
102
101
|
offSetY >
|
|
103
102
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
|
|
104
103
|
offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
|
|
105
104
|
console.log(
|
|
106
105
|
'比较isInView',
|
|
107
106
|
isInView,
|
|
108
107
|
offSetY,
|
|
109
108
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
|
|
110
109
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
111
110
|
)
|
|
112
111
|
handleInOrOutView(isInView)
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
return (
|
|
117
116
|
<View ref={componentObserverRef} style={style}>
|
|
118
117
|
{children}
|
|
119
118
|
</View>
|
|
120
119
|
)
|
|
121
120
|
} else {
|
|
122
121
|
console.log('视频========h5滚动')
|
|
123
122
|
const { ref, inView } = useInView({
|
|
124
123
|
threshold,
|
|
125
124
|
triggerOnce: false,
|
|
126
125
|
root: rootDom || null,
|
|
127
126
|
rootMargin: `0px 0px 0px 0px`,
|
|
128
127
|
})
|
|
129
128
|
useEffect(() => {
|
|
130
129
|
if (inView) {
|
|
131
130
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
132
131
|
console.log('其他h5=>in可视区域')
|
|
133
132
|
} else {
|
|
134
133
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
135
134
|
console.log('其他h5=>out可视区域')
|
|
136
135
|
}
|
|
137
136
|
}, [inView])
|
|
138
137
|
return (
|
|
139
138
|
<View ref={ref} style={style}>
|
|
140
139
|
{children}
|
|
141
140
|
</View>
|
|
142
141
|
)
|
|
143
142
|
}
|
|
144
143
|
children: null,
|
|
145
144
|
style: {},
|
|
146
145
|
className: '',
|
|
147
146
|
inViewCallback: null,
|
|
148
147
|
outViewCallback: null,
|
|
149
148
|
threshold: 0,
|
|
149
|
+
import Taro from '@tarojs/taro'
|
|
150
150
|
TaroEventType,
|
|
151
151
|
WEBVIEW_STATE,
|
|
152
152
|
M_H5_ROOT_ELE_NODE,
|
|
153
153
|
latestFromNativeMsgStorage,
|
|
154
154
|
getNativePageScrollRes,
|
|
155
155
|
props: ComponentInterFace.InOrOutViewObserverProps,
|
|
156
156
|
const {
|
|
157
157
|
children,
|
|
158
158
|
style,
|
|
159
159
|
inViewCallback,
|
|
160
160
|
outViewCallback,
|
|
161
161
|
threshold = 0,
|
|
162
162
|
} = props
|
|
163
163
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
164
164
|
const componentObserverRef = useRef<HTMLElement | null>(null)
|
|
165
165
|
const componentShowStateRef = useRef(false)
|
|
166
166
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
167
167
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
|
|
168
168
|
if (isH5AndJdShopView && !needShowHighVersion) {
|
|
169
169
|
useEffect(() => {
|
|
170
170
|
const latestRes =
|
|
171
171
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
172
172
|
dealPageScrollInfo(latestRes)
|
|
173
173
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
174
174
|
dealPageScrollInfo(res)
|
|
175
175
|
})
|
|
176
176
|
Taro.eventCenter.on(
|
|
177
177
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
178
178
|
(state) => {
|
|
179
179
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
180
180
|
},
|
|
181
181
|
)
|
|
182
182
|
return function cleanup() {
|
|
183
183
|
Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, (res) => {
|
|
184
184
|
dealPageScrollInfo(res)
|
|
185
185
|
})
|
|
186
186
|
Taro.eventCenter.off(
|
|
187
187
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
188
188
|
(state) => {
|
|
189
189
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
190
190
|
},
|
|
191
191
|
)
|
|
192
192
|
}
|
|
193
193
|
}, [])
|
|
194
194
|
useEffect(() => {
|
|
195
195
|
if (componentShowState) {
|
|
196
196
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
197
197
|
console.log('app=>in可视区域')
|
|
198
198
|
} else {
|
|
199
199
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
200
200
|
console.log('app=>out可视区域')
|
|
201
201
|
}
|
|
202
202
|
}, [componentShowState])
|
|
203
203
|
|
|
204
204
|
const handleInOrOutView = (type: boolean) => {
|
|
205
205
|
componentShowStateRef.current = type
|
|
206
206
|
setComponentShowState(type)
|
|
207
207
|
console.log('handleInOrOutView', type)
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
const dealPageScrollInfo = (res) => {
|
|
211
211
|
console.log('dealPageScrollInfo===', res)
|
|
212
212
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
213
213
|
if (
|
|
214
214
|
typeof displayHeight === 'undefined' ||
|
|
215
215
|
typeof offSetY === 'undefined'
|
|
216
216
|
)
|
|
217
217
|
return
|
|
218
218
|
console.log(
|
|
219
219
|
'处理后dealPageScrollInfo===displayHeight=offSetY',
|
|
220
220
|
displayHeight,
|
|
221
221
|
offSetY,
|
|
222
222
|
)
|
|
223
223
|
if (componentObserverRef.current) {
|
|
224
224
|
const eleClientRect =
|
|
225
225
|
componentObserverRef.current.getBoundingClientRect()
|
|
226
226
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
227
227
|
const eleHeight = Math.ceil(eleClientRect.height)
|
|
228
228
|
console.log(
|
|
229
229
|
'==========================eleOffsetTop, eleHeight',
|
|
230
230
|
eleOffsetTop,
|
|
231
231
|
eleHeight,
|
|
232
232
|
)
|
|
233
233
|
if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
|
|
234
234
|
const isOutView =
|
|
235
235
|
offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
|
|
236
236
|
displayHeight - (eleOffsetTop - offSetY) <
|
|
237
237
|
Math.ceil(eleHeight * threshold)
|
|
238
238
|
console.log(
|
|
239
239
|
'比较isOutView',
|
|
240
240
|
isOutView,
|
|
241
241
|
offSetY,
|
|
242
242
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
243
243
|
displayHeight - (eleOffsetTop - offSetY),
|
|
244
244
|
Math.ceil(eleHeight * threshold),
|
|
245
245
|
)
|
|
246
246
|
handleInOrOutView(!isOutView)
|
|
247
247
|
} else {
|
|
248
248
|
const isInView =
|
|
249
249
|
offSetY >
|
|
250
250
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
|
|
251
251
|
offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
|
|
252
252
|
console.log(
|
|
253
253
|
'比较isInView',
|
|
254
254
|
isInView,
|
|
255
255
|
offSetY,
|
|
256
256
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
|
|
257
257
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
258
258
|
)
|
|
259
259
|
handleInOrOutView(isInView)
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
return (
|
|
264
264
|
<View ref={componentObserverRef} style={style}>
|
|
265
265
|
{children}
|
|
266
266
|
</View>
|
|
267
267
|
)
|
|
268
268
|
} else {
|
|
269
269
|
const { ref, inView } = useInView({
|
|
270
270
|
threshold,
|
|
271
271
|
triggerOnce: false,
|
|
272
272
|
root: rootDom || null,
|
|
273
273
|
rootMargin: `0px 0px 0px 0px`,
|
|
274
274
|
})
|
|
275
275
|
useEffect(() => {
|
|
276
276
|
if (inView) {
|
|
277
277
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
278
278
|
console.log('其他h5=>in可视区域')
|
|
279
279
|
} else {
|
|
280
280
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
281
281
|
console.log('其他h5=>out可视区域')
|
|
282
282
|
}
|
|
283
283
|
}, [inView])
|
|
284
284
|
return (
|
|
285
285
|
<View ref={ref} style={style}>
|
|
286
286
|
{children}
|
|
287
287
|
</View>
|
|
288
288
|
)
|
|
289
289
|
}
|
|
290
290
|
children: null,
|
|
291
291
|
style: {},
|
|
292
292
|
className: '',
|
|
293
293
|
inViewCallback: null,
|
|
294
294
|
outViewCallback: null,
|
|
295
295
|
threshold: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
const { floorData, renderSourceType, builtInComponents = {} } = props
|
|
3
2
|
const isDevMode = renderSourceType === BUSINESS_TYPE.DECORATE
|
|
4
3
|
const floorModuleType: any = floorData?.floorExtInfo?.moduleFlag
|
|
5
4
|
const FloorContentItem =
|
|
6
5
|
(floorModuleType && builtInComponents[floorModuleType]) || null
|
|
7
6
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
8
7
|
|
|
9
8
|
const renderDecorateDefaultModule = () => {
|
|
10
9
|
return (
|
|
11
10
|
<View
|
|
12
11
|
style={{
|
|
13
12
|
lineHeight: '120px',
|
|
14
13
|
textAlign: 'center',
|
|
15
14
|
}}
|
|
16
15
|
>
|
|
17
16
|
当前模块是{floorData.moduleName}
|
|
18
17
|
</View>
|
|
19
18
|
)
|
|
20
19
|
}
|
|
21
20
|
if (floorModuleType && (RemoteLoadFloorList.includes(floorModuleType) || floorData?.floorExtInfo?.floorLoadWay === 2)) {
|
|
22
21
|
return (
|
|
23
22
|
<RemoteFloorItem {...props} dataDefines={dataDefines}></RemoteFloorItem>
|
|
24
23
|
)
|
|
25
24
|
} else {
|
|
26
25
|
return FloorContentItem ? (
|
|
27
26
|
<ErrorBoundary {...props}>
|
|
28
27
|
<FloorContentItem {...props} dataDefines={dataDefines} />
|
|
29
28
|
</ErrorBoundary>
|
|
30
29
|
) : isDevMode ? (
|
|
31
30
|
renderDecorateDefaultModule()
|
|
32
31
|
) : null
|
|
33
32
|
}
|
|
34
33
|
renderSourceType: BUSINESS_TYPE.ONLINE,
|
|
35
34
|
switch (moduleId) {
|
|
36
35
|
case 83158:
|
|
37
36
|
return 'freeLayout'
|
|
38
37
|
case 99654:
|
|
39
38
|
return 'activeText'
|
|
40
39
|
case 100382:
|
|
41
40
|
return 'superGoods'
|
|
42
41
|
}
|
|
43
42
|
floorList.map((item) => {
|
|
44
43
|
if (!item.floorExtInfo) {
|
|
45
44
|
return null
|
|
46
45
|
}
|
|
47
46
|
const moduleFlag = item.floorExtInfo.moduleFlag
|
|
48
47
|
if (!moduleFlag) {
|
|
49
48
|
const newModuleFlag = moduleId2ModuleFlag(item.moduleId)
|
|
50
49
|
if (newModuleFlag) {
|
|
51
50
|
item.floorExtInfo.moduleFlag = newModuleFlag
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
})
|
|
54
|
+
import React from 'react'
|
|
55
55
|
const { floorData, renderSourceType, builtInComponents = {} } = props
|
|
56
56
|
const isDevMode = renderSourceType === BUSINESS_TYPE.DECORATE
|
|
57
57
|
const floorModuleType: any = floorData?.floorExtInfo?.moduleFlag
|
|
58
58
|
const FloorContentItem =
|
|
59
59
|
(floorModuleType && builtInComponents[floorModuleType]) || null
|
|
60
60
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
61
61
|
|
|
62
62
|
const renderDecorateDefaultModule = () => {
|
|
63
63
|
return (
|
|
64
64
|
<View
|
|
65
65
|
style={{
|
|
66
66
|
lineHeight: '120px',
|
|
67
67
|
textAlign: 'center',
|
|
68
68
|
}}
|
|
69
69
|
>
|
|
70
70
|
当前模块是{floorData.moduleName}
|
|
71
71
|
</View>
|
|
72
72
|
)
|
|
73
73
|
}
|
|
74
74
|
if (floorModuleType && RemoteLoadFloorList.includes(floorModuleType)) {
|
|
75
75
|
return (
|
|
76
76
|
<RemoteFloorItem {...props} dataDefines={dataDefines}></RemoteFloorItem>
|
|
77
77
|
)
|
|
78
78
|
} else {
|
|
79
79
|
return FloorContentItem ? (
|
|
80
80
|
<ErrorBoundary {...props}>
|
|
81
81
|
<FloorContentItem {...props} dataDefines={dataDefines} />
|
|
82
82
|
</ErrorBoundary>
|
|
83
83
|
) : isDevMode ? (
|
|
84
84
|
renderDecorateDefaultModule()
|
|
85
85
|
) : null
|
|
86
86
|
}
|
|
87
87
|
renderSourceType: BUSINESS_TYPE.ONLINE,
|
|
88
88
|
switch (moduleId) {
|
|
89
89
|
case 83158:
|
|
90
90
|
return 'freeLayout'
|
|
91
91
|
case 99654:
|
|
92
92
|
return 'activeText'
|
|
93
93
|
case 100382:
|
|
94
94
|
return 'superGoods'
|
|
95
95
|
}
|
|
96
96
|
floorList.map((item) => {
|
|
97
97
|
if (!item.floorExtInfo) {
|
|
98
98
|
return null
|
|
99
99
|
}
|
|
100
100
|
const moduleFlag = item.floorExtInfo.moduleFlag
|
|
101
101
|
if (!moduleFlag) {
|
|
102
102
|
const newModuleFlag = moduleId2ModuleFlag(item.moduleId)
|
|
103
103
|
if (newModuleFlag) {
|
|
104
104
|
item.floorExtInfo.moduleFlag = newModuleFlag
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useCallback } from 'react'
|
|
2
1
|
const getRenderRealTimeKeyObj = isRealTimeRender ? {
|
|
3
2
|
key: Date.now()
|
|
4
3
|
} : {}
|
|
5
4
|
{floorData?.showCommonFloorHead === false ? null : <CommonFloorHead dataDefines={dataDefines} floorData={floorData} {...getRenderRealTimeKeyObj} />}
|
|
6
5
|
...getRenderRealTimeKeyObj
|
|
7
6
|
isRealTimeRender: false,
|
|
7
|
+
import React, { useCallback } from 'react'
|
|
8
8
|
{floorData?.showCommonFloorHead === false ? null : (
|
|
9
9
|
<CommonFloorHead dataDefines={dataDefines} floorData={floorData} />
|
|
10
10
|
)}
|