@conecli/cone-render 0.8.20 → 0.8.21-shop-beta.3
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/isvStorage/index.h5.ts +1 -0
- package/dist/common/isvStorage/index.ts +1 -0
- package/dist/common/token/const.ts +1 -0
- package/dist/common/token/index.h5.ts +1 -0
- package/dist/common/token/index.ts +1 -0
- package/dist/common/token/token.jd.ts +1 -0
- package/dist/common/token/token.ts +1 -0
- package/dist/common/token/token.wxapp.ts +1 -0
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +1 -1
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/CustomVideo/const.ts +1 -0
- package/dist/components/base/CustomVideo/index.module.scss +40 -64
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +6 -2
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/const.ts +1 -0
- package/dist/components/base/ExposureSmart/index.h5.module.scss +18 -4
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.module.scss +20 -9
- package/dist/components/base/ExposureSmart/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
- package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
- package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
- package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +7 -1
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
- package/dist/components/base/Price/Base/index.module.scss +136 -0
- package/dist/components/base/Price/Base/index.tsx +1 -0
- package/dist/components/base/Price/Double/index.module.scss +158 -0
- package/dist/components/base/Price/Double/index.tsx +1 -0
- package/dist/components/base/Price/index.tsx +1 -1
- 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.jd.tsx +1 -0
- package/dist/components/floorItem.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -0
- 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/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/index.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/report.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 -0
- package/dist/jumpEventReport/web.jdjch.ts +1 -0
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +10 -1
- 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/index.ts +1 -1
- package/dist/open/api/jump/business.ts +1 -0
- package/dist/open/api/jump/index.ts +1 -0
- package/dist/open/api/jump/minPath.ts +1 -0
- package/dist/open/api/jump/side.ts +1 -0
- package/dist/open/api/jump/webUrl.ts +1 -0
- package/dist/open/api/jump copy.ts +1 -0
- package/dist/open/api/moduleUtil.ts +1 -1
- package/dist/open/api/request.ts +1 -0
- package/dist/open/api/shopMember.ts +1 -0
- package/dist/open/api/track.ts +1 -1
- package/dist/open/api/userToken.ts +1 -0
- package/dist/open/api/util.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- package/dist/service/bMallConst.ts +1 -0
- package/dist/service/bMallConst.weapp.ts +1 -0
- package/dist/service/fetchGateway.ts +1 -0
- package/dist/service/fetchJsonp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -0
- package/dist/service/http/colorSign.weapp.ts +1 -0
- package/dist/service/http/const.ts +1 -0
- package/dist/service/http/http.ts +1 -0
- package/dist/service/http/httpInterceptors.jd.ts +1 -0
- package/dist/service/http/httpInterceptors.ts +1 -0
- package/dist/service/http/index.ts +1 -0
- package/dist/service/requestServer.ts +1 -0
- 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/intersectionObserver.ts +1 -1
- package/dist/utils/jm-common.js +1 -1
- package/dist/utils/memberFormatUtils.js +1 -0
- package/dist/utils/priceUtils.js +1 -0
- package/dist/utils/ready.ts +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +9 -5
- package/dist/components/base/Price/index.module.scss +0 -136
- package/dist/open/api/jump.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
TaroEventType,
|
|
3
2
|
WEBVIEW_STATE,
|
|
4
3
|
M_H5_ROOT_ELE_NODE,
|
|
5
4
|
props: ComponentInterFace.InOrOutViewObserverProps,
|
|
6
5
|
const { children, inViewCallback, outViewCallback, threshold = 0 } = props
|
|
7
6
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
8
7
|
const componentObserverRef = useRef<HTMLElement | null>(null)
|
|
9
8
|
const componentShowStateRef = useRef(false)
|
|
10
9
|
if (isH5AndJdShopView) {
|
|
11
10
|
useEffect(() => {
|
|
12
11
|
const latestRes =
|
|
13
12
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
14
13
|
dealPageScrollInfo(latestRes)
|
|
15
14
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
16
15
|
dealPageScrollInfo(res)
|
|
17
16
|
})
|
|
18
17
|
Taro.eventCenter.on(
|
|
19
18
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
20
19
|
(state) => {
|
|
21
20
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
22
21
|
},
|
|
23
22
|
)
|
|
24
23
|
return function cleanup() {
|
|
25
24
|
Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, (res) => {
|
|
26
25
|
dealPageScrollInfo(res)
|
|
27
26
|
})
|
|
28
27
|
Taro.eventCenter.off(
|
|
29
28
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
30
29
|
(state) => {
|
|
31
30
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
32
31
|
},
|
|
33
32
|
)
|
|
34
33
|
}
|
|
35
34
|
}, [])
|
|
36
35
|
useEffect(() => {
|
|
37
36
|
if (componentShowState) {
|
|
38
37
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
39
38
|
console.log('app=>in可视区域')
|
|
40
39
|
} else {
|
|
41
40
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
42
41
|
console.log('app=>out可视区域')
|
|
43
42
|
}
|
|
44
43
|
}, [componentShowState])
|
|
45
44
|
|
|
46
45
|
const handleInOrOutView = (type: boolean) => {
|
|
47
46
|
componentShowStateRef.current = type
|
|
48
47
|
setComponentShowState(type)
|
|
49
48
|
console.log('handleInOrOutView', type)
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
const dealPageScrollInfo = (res) => {
|
|
53
52
|
console.log('dealPageScrollInfo===', res)
|
|
54
53
|
|
|
55
54
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
56
55
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
57
56
|
console.log(
|
|
58
57
|
'处理后dealPageScrollInfo===displayHeight=offSetY',
|
|
59
58
|
displayHeight,
|
|
60
59
|
offSetY,
|
|
61
60
|
)
|
|
62
61
|
if (componentObserverRef.current) {
|
|
63
62
|
const eleClientRect =
|
|
64
63
|
componentObserverRef.current.getBoundingClientRect()
|
|
65
64
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
66
65
|
const eleHeight = Math.ceil(eleClientRect.height)
|
|
67
66
|
console.log(
|
|
68
67
|
'==========================eleOffsetTop, eleHeight',
|
|
69
68
|
eleOffsetTop,
|
|
70
69
|
eleHeight,
|
|
71
70
|
)
|
|
72
71
|
if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
|
|
73
72
|
const isOutView =
|
|
74
73
|
offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
|
|
75
74
|
displayHeight - (eleOffsetTop - offSetY) <
|
|
76
75
|
Math.ceil(eleHeight * threshold)
|
|
77
76
|
|
|
78
77
|
console.log(
|
|
79
78
|
'比较isOutView',
|
|
80
79
|
isOutView,
|
|
81
80
|
offSetY,
|
|
82
81
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
83
82
|
displayHeight - (eleOffsetTop - offSetY),
|
|
84
83
|
Math.ceil(eleHeight * threshold),
|
|
85
84
|
)
|
|
86
85
|
handleInOrOutView(!isOutView)
|
|
87
86
|
} else {
|
|
88
87
|
const isInView =
|
|
89
88
|
offSetY >
|
|
90
89
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
|
|
91
90
|
offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
|
|
92
91
|
console.log(
|
|
93
92
|
'比较isInView',
|
|
94
93
|
isInView,
|
|
95
94
|
offSetY,
|
|
96
95
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
|
|
97
96
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
98
97
|
)
|
|
99
98
|
handleInOrOutView(isInView)
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
102
|
return <View ref={componentObserverRef}>{children}</View>
|
|
104
103
|
} else {
|
|
105
104
|
const rootDom = document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
|
|
106
105
|
const { ref, inView } = useInView({
|
|
107
106
|
threshold,
|
|
108
107
|
triggerOnce: false,
|
|
109
108
|
root: rootDom || null,
|
|
110
109
|
rootMargin: `0px 0px 0px 0px`,
|
|
111
110
|
})
|
|
112
111
|
useEffect(() => {
|
|
113
112
|
if (inView) {
|
|
114
113
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
115
114
|
console.log('其他h5=>in可视区域')
|
|
116
115
|
} else {
|
|
117
116
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
118
117
|
console.log('其他h5=>out可视区域')
|
|
119
118
|
}
|
|
120
119
|
}, [inView])
|
|
121
120
|
return <View ref={ref}>{children}</View>
|
|
122
121
|
}
|
|
123
122
|
children: null,
|
|
124
123
|
className: '',
|
|
125
124
|
inViewCallback: null,
|
|
126
125
|
outViewCallback: null,
|
|
127
126
|
threshold: 0,
|
|
127
|
+
import Taro from '@tarojs/taro'
|
|
128
128
|
TaroEventType,
|
|
129
129
|
WEBVIEW_STATE,
|
|
130
130
|
M_H5_ROOT_ELE_NODE,
|
|
131
131
|
latestFromNativeMsgStorage,
|
|
132
132
|
getNativePageScrollRes,
|
|
133
133
|
props: ComponentInterFace.InOrOutViewObserverProps,
|
|
134
134
|
const {
|
|
135
135
|
children,
|
|
136
136
|
style,
|
|
137
137
|
inViewCallback,
|
|
138
138
|
outViewCallback,
|
|
139
139
|
threshold = 0,
|
|
140
140
|
} = props
|
|
141
141
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
142
142
|
const componentObserverRef = useRef<HTMLElement | null>(null)
|
|
143
143
|
const componentShowStateRef = useRef(false)
|
|
144
144
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
145
145
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector(`${M_H5_ROOT_ELE_NODE}`)
|
|
146
146
|
if (isH5AndJdShopView && !needShowHighVersion) {
|
|
147
147
|
useEffect(() => {
|
|
148
148
|
const latestRes =
|
|
149
149
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
150
150
|
dealPageScrollInfo(latestRes)
|
|
151
151
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
152
152
|
dealPageScrollInfo(res)
|
|
153
153
|
})
|
|
154
154
|
Taro.eventCenter.on(
|
|
155
155
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
156
156
|
(state) => {
|
|
157
157
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
158
158
|
},
|
|
159
159
|
)
|
|
160
160
|
return function cleanup() {
|
|
161
161
|
Taro.eventCenter.off(TaroEventType.PAGE_SCROLL, (res) => {
|
|
162
162
|
dealPageScrollInfo(res)
|
|
163
163
|
})
|
|
164
164
|
Taro.eventCenter.off(
|
|
165
165
|
TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE,
|
|
166
166
|
(state) => {
|
|
167
167
|
state === WEBVIEW_STATE.NOT_VISIBLE && handleInOrOutView(false)
|
|
168
168
|
},
|
|
169
169
|
)
|
|
170
170
|
}
|
|
171
171
|
}, [])
|
|
172
172
|
useEffect(() => {
|
|
173
173
|
if (componentShowState) {
|
|
174
174
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
175
175
|
console.log('app=>in可视区域')
|
|
176
176
|
} else {
|
|
177
177
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
178
178
|
console.log('app=>out可视区域')
|
|
179
179
|
}
|
|
180
180
|
}, [componentShowState])
|
|
181
181
|
|
|
182
182
|
const handleInOrOutView = (type: boolean) => {
|
|
183
183
|
componentShowStateRef.current = type
|
|
184
184
|
setComponentShowState(type)
|
|
185
185
|
console.log('handleInOrOutView', type)
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
const dealPageScrollInfo = (res) => {
|
|
189
189
|
console.log('dealPageScrollInfo===', res)
|
|
190
190
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
191
191
|
if (
|
|
192
192
|
typeof displayHeight === 'undefined' ||
|
|
193
193
|
typeof offSetY === 'undefined'
|
|
194
194
|
)
|
|
195
195
|
return
|
|
196
196
|
console.log(
|
|
197
197
|
'处理后dealPageScrollInfo===displayHeight=offSetY',
|
|
198
198
|
displayHeight,
|
|
199
199
|
offSetY,
|
|
200
200
|
)
|
|
201
201
|
if (componentObserverRef.current) {
|
|
202
202
|
const eleClientRect =
|
|
203
203
|
componentObserverRef.current.getBoundingClientRect()
|
|
204
204
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
205
205
|
const eleHeight = Math.ceil(eleClientRect.height)
|
|
206
206
|
console.log(
|
|
207
207
|
'==========================eleOffsetTop, eleHeight',
|
|
208
208
|
eleOffsetTop,
|
|
209
209
|
eleHeight,
|
|
210
210
|
)
|
|
211
211
|
if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
|
|
212
212
|
const isOutView =
|
|
213
213
|
offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)) ||
|
|
214
214
|
displayHeight - (eleOffsetTop - offSetY) <
|
|
215
215
|
Math.ceil(eleHeight * threshold)
|
|
216
216
|
console.log(
|
|
217
217
|
'比较isOutView',
|
|
218
218
|
isOutView,
|
|
219
219
|
offSetY,
|
|
220
220
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
221
221
|
displayHeight - (eleOffsetTop - offSetY),
|
|
222
222
|
Math.ceil(eleHeight * threshold),
|
|
223
223
|
)
|
|
224
224
|
handleInOrOutView(!isOutView)
|
|
225
225
|
} else {
|
|
226
226
|
const isInView =
|
|
227
227
|
offSetY >
|
|
228
228
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold) &&
|
|
229
229
|
offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
|
|
230
230
|
console.log(
|
|
231
231
|
'比较isInView',
|
|
232
232
|
isInView,
|
|
233
233
|
offSetY,
|
|
234
234
|
eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold),
|
|
235
235
|
eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)),
|
|
236
236
|
)
|
|
237
237
|
handleInOrOutView(isInView)
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
return (
|
|
242
242
|
<View ref={componentObserverRef} style={style}>
|
|
243
243
|
{children}
|
|
244
244
|
</View>
|
|
245
245
|
)
|
|
246
246
|
} else {
|
|
247
247
|
const { ref, inView } = useInView({
|
|
248
248
|
threshold,
|
|
249
249
|
triggerOnce: false,
|
|
250
250
|
root: rootDom || null,
|
|
251
251
|
rootMargin: `0px 0px 0px 0px`,
|
|
252
252
|
})
|
|
253
253
|
useEffect(() => {
|
|
254
254
|
if (inView) {
|
|
255
255
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
256
256
|
console.log('其他h5=>in可视区域')
|
|
257
257
|
} else {
|
|
258
258
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
259
259
|
console.log('其他h5=>out可视区域')
|
|
260
260
|
}
|
|
261
261
|
}, [inView])
|
|
262
262
|
return (
|
|
263
263
|
<View ref={ref} style={style}>
|
|
264
264
|
{children}
|
|
265
265
|
</View>
|
|
266
266
|
)
|
|
267
267
|
}
|
|
268
268
|
children: null,
|
|
269
269
|
style: {},
|
|
270
270
|
className: '',
|
|
271
271
|
inViewCallback: null,
|
|
272
272
|
outViewCallback: null,
|
|
273
273
|
threshold: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
TaroEventType,
|
|
3
2
|
const {
|
|
4
3
|
children,
|
|
5
4
|
placeholder,
|
|
6
5
|
height,
|
|
7
6
|
inViewCallback
|
|
8
7
|
} = props
|
|
9
8
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
10
9
|
const [componentRenderShowState, setComponentRenderShowState] =
|
|
11
10
|
useState(false)
|
|
12
11
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
13
12
|
const componentShowStateRef = useRef(false)
|
|
14
13
|
if (isH5AndJdShopView) {
|
|
15
14
|
useEffect(() => {
|
|
16
15
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
17
16
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
18
17
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
19
18
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
20
19
|
})
|
|
21
20
|
}, [])
|
|
22
21
|
useEffect(() => {
|
|
23
22
|
if (componentShowState) {
|
|
24
23
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
25
24
|
console.log('InViewRender -- 店铺H5 展示啦!')
|
|
26
25
|
}
|
|
27
26
|
}, [componentShowState])
|
|
28
27
|
|
|
29
28
|
const dealPageScrollInfo = (res) => {
|
|
30
29
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
31
30
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
32
31
|
if (componentLazyRef.current) {
|
|
33
32
|
const eleClientRect =
|
|
34
33
|
componentLazyRef.current.getBoundingClientRect()
|
|
35
34
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
36
35
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
37
36
|
if (!componentShowStateRef.current) {
|
|
38
37
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
39
38
|
componentShowStateRef.current = true
|
|
40
39
|
setComponentShowState(true)
|
|
41
40
|
Taro.nextTick(() => {
|
|
42
41
|
setComponentRenderShowState(true)
|
|
43
42
|
})
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
return (
|
|
49
48
|
<View
|
|
50
49
|
ref={componentLazyRef}
|
|
51
50
|
className={classNames(
|
|
52
51
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
53
52
|
'd-app-floor-lazy-load',
|
|
54
53
|
)}
|
|
55
54
|
style={{
|
|
56
55
|
minHeight: `${componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
|
|
57
56
|
}`,
|
|
58
57
|
backgroundColor: componentRenderShowState
|
|
59
58
|
? 'transparent'
|
|
60
59
|
: '#ffffff',
|
|
61
60
|
}}
|
|
62
61
|
>
|
|
63
62
|
{componentShowState ? children : placeholder}
|
|
64
63
|
</View>
|
|
65
64
|
)
|
|
66
65
|
} else {
|
|
67
66
|
const rootDom = document.querySelector('#J_shopHomeRoot')
|
|
68
67
|
const { ref, inView } = useInView({
|
|
69
68
|
threshold: 0,
|
|
70
69
|
triggerOnce: true,
|
|
71
70
|
root: rootDom || null,
|
|
72
71
|
rootMargin: `0px 0px 0px 0px`,
|
|
73
72
|
})
|
|
74
73
|
useEffect(() => {
|
|
75
74
|
if (inView) {
|
|
76
75
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
77
76
|
console.log('InViewRender -- 其它H5 展示啦!')
|
|
78
77
|
}
|
|
79
78
|
}, [inView])
|
|
80
79
|
return (
|
|
81
80
|
<View
|
|
82
81
|
ref={ref}
|
|
83
82
|
style={{
|
|
84
83
|
minHeight: `${inView ? 'auto' : height + 'px'}`,
|
|
85
84
|
backgroundColor: 'transparent',
|
|
86
85
|
}}
|
|
87
86
|
>
|
|
88
87
|
{inView ? children : placeholder}
|
|
89
88
|
</View>
|
|
90
89
|
)
|
|
91
90
|
}
|
|
92
91
|
children: null,
|
|
93
92
|
placeholder: null,
|
|
94
93
|
height: 1,
|
|
95
94
|
className: '',
|
|
96
95
|
lazyNodeClassName: '',
|
|
97
96
|
inViewCallback: null,
|
|
97
|
+
import Taro from '@tarojs/taro'
|
|
98
98
|
TaroEventType,
|
|
99
99
|
const {
|
|
100
100
|
children,
|
|
101
101
|
placeholder,
|
|
102
102
|
height,
|
|
103
103
|
className,
|
|
104
104
|
inViewCallback
|
|
105
105
|
} = props
|
|
106
106
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
107
107
|
const [componentRenderShowState, setComponentRenderShowState] =
|
|
108
108
|
useState(false)
|
|
109
109
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
110
110
|
const componentShowStateRef = useRef(false)
|
|
111
111
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
112
112
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
|
|
113
113
|
if (isH5AndJdShopView && !needShowHighVersion) {
|
|
114
114
|
useEffect(() => {
|
|
115
115
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
116
116
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
117
117
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
118
118
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
119
119
|
})
|
|
120
120
|
}, [])
|
|
121
121
|
useEffect(() => {
|
|
122
122
|
if (componentShowState) {
|
|
123
123
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
124
124
|
console.log('InViewRender -- 店铺H5 展示啦!')
|
|
125
125
|
}
|
|
126
126
|
}, [componentShowState])
|
|
127
127
|
|
|
128
128
|
const dealPageScrollInfo = (res) => {
|
|
129
129
|
console.log(
|
|
130
130
|
'收到滚动信息和模块元素以及容器显示状态',
|
|
131
131
|
res,
|
|
132
132
|
typeof componentLazyRef.current,
|
|
133
133
|
componentShowStateRef.current,
|
|
134
134
|
)
|
|
135
135
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
136
136
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
137
137
|
if (componentLazyRef.current) {
|
|
138
138
|
const eleClientRect =
|
|
139
139
|
componentLazyRef.current.getBoundingClientRect()
|
|
140
140
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
141
141
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
142
142
|
if (!componentShowStateRef.current) {
|
|
143
143
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
144
144
|
componentShowStateRef.current = true
|
|
145
145
|
setComponentShowState(true)
|
|
146
146
|
Taro.nextTick(() => {
|
|
147
147
|
setComponentRenderShowState(true)
|
|
148
148
|
})
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
return (
|
|
154
154
|
<View
|
|
155
155
|
ref={componentLazyRef}
|
|
156
156
|
className={classNames(
|
|
157
157
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
158
158
|
'd-app-floor-lazy-load',
|
|
159
159
|
className
|
|
160
160
|
)}
|
|
161
161
|
style={{
|
|
162
162
|
minHeight: `${componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
|
|
163
163
|
}`,
|
|
164
164
|
backgroundColor: componentRenderShowState
|
|
165
165
|
? 'transparent'
|
|
166
166
|
: '#ffffff',
|
|
167
167
|
}}
|
|
168
168
|
>
|
|
169
169
|
{componentShowState ? children : placeholder}
|
|
170
170
|
</View>
|
|
171
171
|
)
|
|
172
172
|
}else {
|
|
173
173
|
const { ref, inView } = useInView({
|
|
174
174
|
threshold: 0.5,
|
|
175
175
|
triggerOnce: true,
|
|
176
176
|
root: rootDom || null,
|
|
177
177
|
rootMargin: `0px 0px 0px 0px`,
|
|
178
178
|
delay: 300,
|
|
179
179
|
})
|
|
180
180
|
useEffect(() => {
|
|
181
181
|
if (inView) {
|
|
182
182
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
183
183
|
console.log('InViewRender -- 其它H5 展示啦!')
|
|
184
184
|
}
|
|
185
185
|
}, [inView])
|
|
186
186
|
return (
|
|
187
187
|
<View
|
|
188
188
|
className={className}
|
|
189
189
|
ref={ref}
|
|
190
190
|
style={{
|
|
191
191
|
minHeight: inView ? 'auto' : typeof height === 'number' ? `${height}px` : height,
|
|
192
192
|
backgroundColor: 'transparent',
|
|
193
193
|
}}
|
|
194
194
|
>
|
|
195
195
|
{inView ? children : placeholder}
|
|
196
196
|
</View>
|
|
197
197
|
)
|
|
198
198
|
}
|
|
199
199
|
children: null,
|
|
200
200
|
placeholder: null,
|
|
201
201
|
height: 1,
|
|
202
202
|
className: '',
|
|
203
203
|
lazyNodeClassName: '',
|
|
204
204
|
inViewCallback: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
const { className, pointClassName, children, reportData, trackCallback, ...otherProps } =
|
|
1
3
|
props
|
|
2
4
|
const [floorData, mInfo] = reportData
|
|
3
5
|
const checkReportDataState = floorData && mInfo
|
|
4
6
|
|
|
5
7
|
checkReportDataState && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0)
|
|
6
8
|
return (
|
|
7
9
|
<View
|
|
8
10
|
ref={ref}
|
|
9
11
|
className={classNames(
|
|
10
12
|
itemViewExposureSmartStyle['d-item-point-layout'],
|
|
11
13
|
className,
|
|
12
14
|
)}
|
|
13
15
|
{...otherProps}
|
|
14
16
|
>
|
|
15
17
|
{children ? children : null}
|
|
16
18
|
{checkReportDataState && (
|
|
17
19
|
<ExposureSmart
|
|
18
20
|
className={classNames(pointClassName,{
|
|
19
21
|
[itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
|
|
20
22
|
})}
|
|
21
23
|
reportData={reportData}
|
|
22
24
|
trackCallback={trackCallback}
|
|
23
25
|
markPoint
|
|
24
26
|
/>
|
|
25
27
|
)}
|
|
26
28
|
</View>
|
|
27
29
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro, { useRouter } from '@tarojs/taro'
|
|
2
1
|
floorData = {},
|
|
3
2
|
const rootDom = document.querySelector('#J_shopHomeRoot')
|
|
4
3
|
root: rootDom,
|
|
5
4
|
rootMargin: `0px 0px ${window.innerHeight}px 0px`,
|
|
6
5
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
7
6
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
8
7
|
useEffect(() => {
|
|
9
8
|
if(componentShowState === true){
|
|
10
9
|
console.log('>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!')
|
|
11
10
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
12
11
|
nativePageRegisterMessage(
|
|
13
12
|
Message_Type.NATIVE_INJECT_JS_FILE,
|
|
14
13
|
{
|
|
15
14
|
data: {
|
|
16
15
|
"bundleUrl": [bundleUrl]
|
|
17
16
|
},
|
|
18
17
|
},
|
|
19
18
|
)
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
}, [componentShowState])
|
|
23
22
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
24
23
|
ref={ref}
|
|
24
|
+
import Taro, { useRouter } from '@tarojs/taro'
|
|
25
25
|
floorData = {},
|
|
26
26
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
27
27
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
|
|
28
28
|
root: rootDom,
|
|
29
29
|
rootMargin: `0px 0px ${window.innerHeight}px 0px`,
|
|
30
30
|
useEffect(() => {
|
|
31
31
|
if(needShowHighVersion) return
|
|
32
32
|
if (type === LazyType.FLOOR) {
|
|
33
33
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
34
34
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
35
35
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
36
36
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
37
37
|
})
|
|
38
38
|
}
|
|
39
39
|
}, [])
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
if((!needShowHighVersion && componentShowState === true) ||
|
|
42
42
|
(needShowHighVersion && inView && isH5AndJdShopView)
|
|
43
43
|
) {
|
|
44
44
|
console.log('>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!')
|
|
45
45
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
46
46
|
nativePageRegisterMessage(
|
|
47
47
|
Message_Type.NATIVE_INJECT_JS_FILE,
|
|
48
48
|
{
|
|
49
49
|
data: {
|
|
50
50
|
"bundleUrl": [bundleUrl]
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
)
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}, [componentShowState,inView])
|
|
57
57
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
58
58
|
ref={ref}
|