@conecli/cone-render 0.8.38 → 0.8.40
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/README.md +7 -1
- package/dist/api/index.ts +1 -1
- package/dist/common/const.ts +1 -1
- package/dist/common/environmentType.ts +1 -0
- 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/jdplayerSdk.ts +1 -0
- package/dist/common/jssdk.ts +1 -0
- package/dist/common/pageType.ts +1 -0
- package/dist/common/sgmCustomCode.ts +1 -0
- package/dist/common/token/index.h5.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/common/token/token.ts +1 -1
- package/dist/common/wxappApi.jd.ts +1 -0
- package/dist/common/wxappApi.ts +1 -1
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CountDown/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.module.scss +7 -0
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +5 -0
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/Exposure/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- 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/ItemViewExposureSmart/index.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/const.ts +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.module.scss +20 -20
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/MobileCommonHeader/index.module.scss +9 -0
- package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +4 -0
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/components/base/Price/index.tsx +1 -1
- package/dist/components/base/Skeleton/index.tsx +1 -1
- package/dist/components/decorate/DecorateFloorModule/index.module.scss +21 -2
- package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
- package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
- package/dist/components/floorItem.jd.tsx +1 -1
- package/dist/components/floorItem.tsx +1 -1
- package/dist/components/floorItem.weapp.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/interface/utils.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.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/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 -1
- package/dist/jumpEventReport/web.jdjch.ts +1 -1
- package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
- package/dist/jumpEventReport/web.pc.ts +1 -0
- package/dist/jumpEventReport/web.tjapp.ts +1 -0
- package/dist/jumpEventReport/web.tjm.ts +1 -0
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/modules/ContainerFloorList/index.h5.module.scss +17 -1
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/environment.ts +1 -1
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/jump copy.ts +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/open/api/track.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 +39 -3
- package/dist/sass/base.scss +12 -0
- package/dist/service/fetchGateway.ts +1 -1
- package/dist/service/http/const.ts +1 -1
- package/dist/service/requestServer.ts +1 -1
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
- package/dist/utils/draExceptionAndProfile.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/jm-common.js +1 -1
- package/dist/utils/sgmCodeUtils.ts +1 -0
- package/dist/utils/taroRenderUtil.ts +1 -0
- package/dist/utils/utils.ts +1 -1
- package/dist/wxapp/api/helper.js +1 -0
- package/dist/wxapp/components/launch-app/index.js +1 -0
- package/dist/wxapp/components/launch-app/index.json +5 -0
- 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 +1 -0
- package/dist/wxapp/components/subscribe-guider/index.js +1 -0
- package/dist/wxapp/components/subscribe-guider/index.json +5 -0
- package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
- package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
- package/package.json +2 -1
- package/dist/components/base/Skeleton/old.tsx +0 -1
- package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
|
@@ -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
|
className,
|
|
8
7
|
inViewCallback
|
|
9
8
|
} = props
|
|
10
9
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
11
10
|
const [componentRenderShowState, setComponentRenderShowState] =
|
|
12
11
|
useState(false)
|
|
13
12
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
14
13
|
const componentShowStateRef = useRef(false)
|
|
15
14
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
16
15
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
|
|
17
16
|
if (isH5AndJdShopView && !needShowHighVersion) {
|
|
18
17
|
useEffect(() => {
|
|
19
18
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
20
19
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
21
20
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
22
21
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
23
22
|
})
|
|
24
23
|
}, [])
|
|
25
24
|
useEffect(() => {
|
|
26
25
|
if (componentShowState) {
|
|
27
26
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
28
27
|
console.log('InViewRender -- 店铺H5 展示啦!')
|
|
29
28
|
}
|
|
30
29
|
}, [componentShowState])
|
|
31
30
|
|
|
32
31
|
const dealPageScrollInfo = (res) => {
|
|
33
32
|
console.log(
|
|
34
33
|
'收到滚动信息和模块元素以及容器显示状态',
|
|
35
34
|
res,
|
|
36
35
|
typeof componentLazyRef.current,
|
|
37
36
|
componentShowStateRef.current,
|
|
38
37
|
)
|
|
39
38
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
40
39
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
41
40
|
if (componentLazyRef.current) {
|
|
42
41
|
const eleClientRect =
|
|
43
42
|
componentLazyRef.current.getBoundingClientRect()
|
|
44
43
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
45
44
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
46
45
|
if (!componentShowStateRef.current) {
|
|
47
46
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
48
47
|
componentShowStateRef.current = true
|
|
49
48
|
setComponentShowState(true)
|
|
50
49
|
Taro.nextTick(() => {
|
|
51
50
|
setComponentRenderShowState(true)
|
|
52
51
|
})
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
return (
|
|
58
57
|
<View
|
|
59
58
|
ref={componentLazyRef}
|
|
60
59
|
className={classNames(
|
|
61
60
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
62
61
|
'd-app-floor-lazy-load',
|
|
63
62
|
className
|
|
64
63
|
)}
|
|
65
64
|
style={{
|
|
66
65
|
minHeight: `${componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
|
|
67
66
|
}`,
|
|
68
67
|
backgroundColor: componentRenderShowState
|
|
69
68
|
? 'transparent'
|
|
70
69
|
: '#ffffff',
|
|
71
70
|
}}
|
|
72
71
|
>
|
|
73
72
|
{componentShowState ? children : placeholder}
|
|
74
73
|
</View>
|
|
75
74
|
)
|
|
76
75
|
}else {
|
|
77
76
|
const { ref, inView } = useInView({
|
|
78
77
|
threshold: 0.5,
|
|
79
78
|
triggerOnce: true,
|
|
80
79
|
root: rootDom || null,
|
|
81
80
|
rootMargin: `0px 0px 0px 0px`,
|
|
82
81
|
delay: 300,
|
|
83
82
|
})
|
|
84
83
|
useEffect(() => {
|
|
85
84
|
if (inView) {
|
|
86
85
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
87
86
|
console.log('InViewRender -- 其它H5 展示啦!')
|
|
88
87
|
}
|
|
89
88
|
}, [inView])
|
|
90
89
|
return (
|
|
91
90
|
<View
|
|
92
91
|
className={className}
|
|
93
92
|
ref={ref}
|
|
94
93
|
style={{
|
|
95
94
|
minHeight: inView ? 'auto' : typeof height === 'number' ? `${height}px` : height,
|
|
96
95
|
backgroundColor: 'transparent',
|
|
97
96
|
}}
|
|
98
97
|
>
|
|
99
98
|
{inView ? children : placeholder}
|
|
100
99
|
</View>
|
|
101
100
|
)
|
|
102
101
|
}
|
|
103
102
|
children: null,
|
|
104
103
|
placeholder: null,
|
|
105
104
|
height: 1,
|
|
106
105
|
className: '',
|
|
107
106
|
lazyNodeClassName: '',
|
|
108
107
|
inViewCallback: null,
|
|
108
|
+
import Taro from '@tarojs/taro'
|
|
109
109
|
getNativePageScrollRes,
|
|
110
110
|
latestFromNativeMsgStorage,
|
|
111
111
|
const { children, placeholder, height, className, inViewCallback } = props
|
|
112
112
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
113
113
|
const [componentRenderShowState, setComponentRenderShowState] = useState(
|
|
114
114
|
false,
|
|
115
115
|
)
|
|
116
116
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
117
117
|
const componentShowStateRef = useRef(false)
|
|
118
118
|
const needShowHighVersion =
|
|
119
119
|
isH5AndJdShopViewH5Scroll &&
|
|
120
120
|
!(
|
|
121
121
|
global.info.queryInfo?.downgraded &&
|
|
122
122
|
global.info.queryInfo.downgraded === 'true'
|
|
123
123
|
)
|
|
124
124
|
const rootDom =
|
|
125
125
|
isH5AndJdShopView && needShowHighVersion
|
|
126
126
|
? null
|
|
127
127
|
: document.querySelector('#J_shopHomeRoot')
|
|
128
128
|
if (isH5AndJdShopView && !needShowHighVersion && !isAppStowShop) {
|
|
129
129
|
useEffect(() => {
|
|
130
130
|
const latestRes =
|
|
131
131
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
132
132
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
133
133
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
|
|
134
134
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
135
135
|
})
|
|
136
136
|
}, [])
|
|
137
137
|
useEffect(() => {
|
|
138
138
|
if (componentShowState) {
|
|
139
139
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
140
140
|
}
|
|
141
141
|
}, [componentShowState])
|
|
142
142
|
|
|
143
143
|
const dealPageScrollInfo = res => {
|
|
144
144
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
145
145
|
if (
|
|
146
146
|
typeof displayHeight === 'undefined' ||
|
|
147
147
|
typeof offSetY === 'undefined'
|
|
148
148
|
)
|
|
149
149
|
return
|
|
150
150
|
if (componentLazyRef.current) {
|
|
151
151
|
const eleClientRect = componentLazyRef.current.getBoundingClientRect()
|
|
152
152
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
153
153
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
154
154
|
if (!componentShowStateRef.current) {
|
|
155
155
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
156
156
|
componentShowStateRef.current = true
|
|
157
157
|
setComponentShowState(true)
|
|
158
158
|
Taro.nextTick(() => {
|
|
159
159
|
setComponentRenderShowState(true)
|
|
160
160
|
})
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
return (
|
|
166
166
|
<View
|
|
167
167
|
ref={componentLazyRef}
|
|
168
168
|
className={classNames(
|
|
169
169
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
170
170
|
'd-app-floor-lazy-load',
|
|
171
171
|
className,
|
|
172
172
|
)}
|
|
173
173
|
style={{
|
|
174
174
|
minHeight: `${
|
|
175
175
|
componentRenderShowState
|
|
176
176
|
? 'auto'
|
|
177
177
|
: height + (typeof height === 'number' ? 'px' : '')
|
|
178
178
|
}`,
|
|
179
179
|
backgroundColor: componentRenderShowState ? 'transparent' : '#ffffff',
|
|
180
180
|
}}
|
|
181
181
|
>
|
|
182
182
|
{componentShowState ? children : placeholder}
|
|
183
183
|
</View>
|
|
184
184
|
)
|
|
185
185
|
} else {
|
|
186
186
|
const { ref, inView } = useInView({
|
|
187
187
|
threshold: 0.5,
|
|
188
188
|
triggerOnce: true,
|
|
189
189
|
root: rootDom || null,
|
|
190
190
|
rootMargin: `0px 0px 0px 0px`,
|
|
191
191
|
delay: 300,
|
|
192
192
|
})
|
|
193
193
|
useEffect(() => {
|
|
194
194
|
if (inView) {
|
|
195
195
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
196
196
|
}
|
|
197
197
|
}, [inView])
|
|
198
198
|
return (
|
|
199
199
|
<View
|
|
200
200
|
className={className}
|
|
201
201
|
ref={ref}
|
|
202
202
|
style={{
|
|
203
203
|
minHeight: inView
|
|
204
204
|
? 'auto'
|
|
205
205
|
: typeof height === 'number'
|
|
206
206
|
? `${height}px`
|
|
207
207
|
: height,
|
|
208
208
|
backgroundColor: 'transparent',
|
|
209
209
|
}}
|
|
210
210
|
>
|
|
211
211
|
{inView ? children : placeholder}
|
|
212
212
|
</View>
|
|
213
213
|
)
|
|
214
214
|
}
|
|
215
215
|
children: null,
|
|
216
216
|
placeholder: null,
|
|
217
217
|
height: 1,
|
|
218
218
|
className: '',
|
|
219
219
|
lazyNodeClassName: '',
|
|
220
220
|
inViewCallback: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
const { className, pointClassName, children, reportData, trackCallback, ...otherProps } =
|
|
3
2
|
props
|
|
4
3
|
const [floorData, mInfo] = reportData
|
|
5
4
|
const checkReportDataState = floorData && mInfo
|
|
6
5
|
|
|
7
6
|
checkReportDataState && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0)
|
|
8
7
|
return (
|
|
9
8
|
<View
|
|
10
9
|
ref={ref}
|
|
11
10
|
className={classNames(
|
|
12
11
|
itemViewExposureSmartStyle['d-item-point-layout'],
|
|
13
12
|
className,
|
|
14
13
|
)}
|
|
15
14
|
{...otherProps}
|
|
16
15
|
>
|
|
17
16
|
{children ? children : null}
|
|
18
17
|
{checkReportDataState && (
|
|
19
18
|
<ExposureSmart
|
|
20
19
|
className={classNames(pointClassName,{
|
|
21
20
|
[itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
|
|
22
21
|
})}
|
|
23
22
|
reportData={reportData}
|
|
24
23
|
trackCallback={trackCallback}
|
|
25
24
|
markPoint
|
|
26
25
|
/>
|
|
27
26
|
)}
|
|
28
27
|
</View>
|
|
29
28
|
)
|
|
29
|
+
import React from 'react'
|
|
30
30
|
const { className, pointClassName, children, reportData, customReportDataKey,customReportDataFn, trackCallback, ...otherProps } =
|
|
31
31
|
props
|
|
32
32
|
const isCustomReport = customReportDataKey && customReportDataFn
|
|
33
33
|
const checkReportData = Array.isArray(reportData)
|
|
34
34
|
const [floorData, mInfo] = checkReportData ? reportData : []
|
|
35
35
|
const checkReportDataState = isCustomReport ? true : floorData && mInfo
|
|
36
36
|
|
|
37
37
|
floorData && mInfo && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0)
|
|
38
38
|
return (
|
|
39
39
|
<View
|
|
40
40
|
ref={ref}
|
|
41
41
|
className={classNames(
|
|
42
42
|
itemViewExposureSmartStyle['d-item-point-layout'],
|
|
43
43
|
className,
|
|
44
44
|
)}
|
|
45
45
|
{...otherProps}
|
|
46
46
|
>
|
|
47
47
|
{children ? children : null}
|
|
48
48
|
{checkReportDataState && (
|
|
49
49
|
<ExposureSmart
|
|
50
50
|
className={classNames(pointClassName,{
|
|
51
51
|
[itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
|
|
52
52
|
})}
|
|
53
53
|
reportData={reportData}
|
|
54
54
|
trackCallback={trackCallback}
|
|
55
55
|
customReportDataFn={customReportDataFn}
|
|
56
56
|
customReportDataKey={customReportDataKey}
|
|
57
57
|
markPoint
|
|
58
58
|
/>
|
|
59
59
|
)}
|
|
60
60
|
</View>
|
|
61
61
|
)
|
|
62
62
|
reportData: [],
|
|
63
63
|
customReportDataKey: null,
|
|
64
64
|
customReportDataFn: null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro, { useRouter } from '@tarojs/taro'
|
|
2
1
|
floorData = {},
|
|
3
2
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
4
3
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
|
|
5
4
|
root: rootDom,
|
|
6
5
|
rootMargin: `0px 0px ${window.innerHeight}px 0px`,
|
|
7
6
|
useEffect(() => {
|
|
8
7
|
if(needShowHighVersion) return
|
|
9
8
|
if (type === LazyType.FLOOR) {
|
|
10
9
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
11
10
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
12
11
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
13
12
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
14
13
|
})
|
|
15
14
|
}
|
|
16
15
|
}, [])
|
|
17
16
|
useEffect(() => {
|
|
18
17
|
if((!needShowHighVersion && componentShowState === true) ||
|
|
19
18
|
(needShowHighVersion && inView && isH5AndJdShopView)
|
|
20
19
|
) {
|
|
21
20
|
console.log('>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!')
|
|
22
21
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
23
22
|
nativePageRegisterMessage(
|
|
24
23
|
Message_Type.NATIVE_INJECT_JS_FILE,
|
|
25
24
|
{
|
|
26
25
|
data: {
|
|
27
26
|
"bundleUrl": [bundleUrl]
|
|
28
27
|
},
|
|
29
28
|
},
|
|
30
29
|
)
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
}, [componentShowState,inView])
|
|
34
33
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
35
34
|
ref={ref}
|
|
35
|
+
import Taro, { useRouter } from '@tarojs/taro'
|
|
36
36
|
SECTION_HOME_TAB_TYPE,
|
|
37
37
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
38
38
|
TaroEventType,
|
|
39
39
|
const {
|
|
40
40
|
children,
|
|
41
41
|
containerId,
|
|
42
42
|
type,
|
|
43
43
|
placeholder,
|
|
44
44
|
height,
|
|
45
45
|
floorData = {},
|
|
46
46
|
sectionType,
|
|
47
47
|
lazyNodeClassName,
|
|
48
48
|
} = props
|
|
49
49
|
const getRouterInfo = useRouter()
|
|
50
50
|
const getQueryData = getRouterInfo?.params || {}
|
|
51
51
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
52
52
|
const [componentRenderShowState, setComponentRenderShowState] =
|
|
53
53
|
useState(false)
|
|
54
54
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
55
55
|
const componentShowStateRef = useRef(false)
|
|
56
56
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
57
57
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
|
|
58
58
|
const { ref, inView } = useInView({
|
|
59
59
|
threshold: 0,
|
|
60
60
|
triggerOnce: true,
|
|
61
61
|
root: rootDom,
|
|
62
62
|
rootMargin: `0px 0px ${window.innerHeight}px 0px`,
|
|
63
63
|
})
|
|
64
64
|
useEffect(() => {
|
|
65
65
|
if(needShowHighVersion || !isH5AndJdShopView) return
|
|
66
66
|
if (type === LazyType.FLOOR) {
|
|
67
67
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
68
68
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
69
69
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
70
70
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
71
71
|
})
|
|
72
72
|
}
|
|
73
73
|
}, [])
|
|
74
74
|
useEffect(() => {
|
|
75
75
|
if((!needShowHighVersion && componentShowState === true) ||
|
|
76
76
|
(needShowHighVersion && inView && isH5AndJdShopView)
|
|
77
77
|
) {
|
|
78
78
|
console.log('>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!')
|
|
79
79
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
80
80
|
const modularPackResultObj = typeof modularPackResult === 'string' ? JSON.parse(modularPackResult) : modularPackResult
|
|
81
81
|
if (modularPackResultObj && modularPackResultObj.bundleUrl) {
|
|
82
82
|
const { bundleUrl } = modularPackResultObj
|
|
83
83
|
nativePageRegisterMessage(
|
|
84
84
|
Message_Type.NATIVE_INJECT_JS_FILE,
|
|
85
85
|
{
|
|
86
86
|
data: {
|
|
87
87
|
"bundleUrl": [bundleUrl]
|
|
88
88
|
},
|
|
89
89
|
},
|
|
90
90
|
)
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}, [componentShowState,inView])
|
|
94
94
|
|
|
95
95
|
const dealPageScrollInfo = (res) => {
|
|
96
96
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
97
97
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') {
|
|
98
98
|
const shopId = floorData?.floorExtInfo?.shopId
|
|
99
99
|
if(!lazyLayoutLoadErrorShopId[`${shopId}`]) {
|
|
100
100
|
const opt = {
|
|
101
101
|
msg: `店铺楼层懒加载失败。楼层顺序-floorIdx: ${floorData?.floorIdx}。`,
|
|
102
102
|
uid: floorData?.uid,
|
|
103
103
|
floorIdx: floorData?.floorIdx,
|
|
104
104
|
shopId: shopId,
|
|
105
105
|
moduleId: floorData?.moduleId,
|
|
106
106
|
moduleName: floorData?.moduleName,
|
|
107
107
|
middleTemplateId: floorData?.middleTemplateId,
|
|
108
108
|
modularPackResult: typeof floorData?.floorExtInfo?.modularPackResult == 'string' ? JSON.parse(floorData?.floorExtInfo?.modularPackResult) : floorData?.floorExtInfo?.modularPackResult,
|
|
109
109
|
}
|
|
110
110
|
sgmCustomReport({
|
|
111
111
|
code: 'lazyLayoutLoadError',
|
|
112
112
|
msg: opt,
|
|
113
113
|
})
|
|
114
114
|
lazyLayoutLoadErrorShopId[`${shopId}`] = true
|
|
115
115
|
}
|
|
116
116
|
return
|
|
117
117
|
}
|
|
118
118
|
if (componentLazyRef.current) {
|
|
119
119
|
const eleClientRect =
|
|
120
120
|
componentLazyRef.current.getBoundingClientRect()
|
|
121
121
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
122
122
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
123
123
|
const eleOffsetHeight = Math.ceil(eleClientRect.height)
|
|
124
124
|
const eleOffsetTopHeight = eleOffsetTop + eleOffsetHeight
|
|
125
125
|
if (!componentShowStateRef.current) {
|
|
126
126
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
127
127
|
componentShowStateRef.current = true
|
|
128
128
|
setComponentShowState(true)
|
|
129
129
|
Taro.nextTick(() => {
|
|
130
130
|
setComponentRenderShowState(true)
|
|
131
131
|
})
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
return isH5AndJdShopView && !needShowHighVersion ? (
|
|
137
137
|
<div
|
|
138
138
|
id={`${containerId}_lazy`}
|
|
139
139
|
ref={componentLazyRef}
|
|
140
140
|
className={classNames(
|
|
141
141
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
142
142
|
'd-app-floor-lazy-load',
|
|
143
143
|
)}
|
|
144
144
|
style={{
|
|
145
145
|
minHeight: `${
|
|
146
146
|
componentRenderShowState ? 'auto' : height + 'px'
|
|
147
147
|
}`,
|
|
148
148
|
backgroundColor: componentRenderShowState
|
|
149
149
|
? 'transparent'
|
|
150
150
|
: '#ffffff',
|
|
151
151
|
}}
|
|
152
152
|
>
|
|
153
153
|
{componentShowState ? children : placeholder}
|
|
154
154
|
</div>
|
|
155
155
|
) : (
|
|
156
156
|
<div
|
|
157
157
|
id={`${containerId}_lazy`}
|
|
158
158
|
className={classNames(
|
|
159
159
|
lazyLayoutLoadStyle['d-mobile-floor-lazy-layout-load'],
|
|
160
160
|
'd-mobile-floor-lazy-load',
|
|
161
161
|
lazyNodeClassName,
|
|
162
162
|
)}
|
|
163
163
|
ref={ref}
|
|
164
164
|
style={{
|
|
165
165
|
minHeight: `${inView ? 'auto' : height + 'px'}`,
|
|
166
166
|
backgroundColor: inView ? 'transparent' : '#ffffff',
|
|
167
167
|
}}
|
|
168
168
|
>
|
|
169
169
|
{}
|
|
170
170
|
{inView ? children : placeholder}
|
|
171
171
|
</div>
|
|
172
172
|
)
|
|
173
173
|
sectionType:
|
|
174
174
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
|
|
175
175
|
type: LazyType.FLOOR,
|
|
176
176
|
children: null,
|
|
177
177
|
placeholder: null,
|
|
178
178
|
height: 200,
|
|
179
179
|
className: '',
|
|
180
180
|
lazyNodeClassName: '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
2
2
|
SECTION_HOME_TAB_TYPE,
|
|
3
3
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
4
4
|
const {
|
|
5
5
|
children,
|
|
6
6
|
containerId,
|
|
7
7
|
type,
|
|
8
8
|
placeholder,
|
|
9
9
|
height,
|
|
10
10
|
sectionType,
|
|
11
11
|
lazyNodeClassName,
|
|
12
12
|
} = props
|
|
13
13
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
14
14
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
15
15
|
const lazyLayoutLoadFloor =
|
|
16
16
|
'lazy-layout-load-floor' + Math.floor(Math.random() * 10000000)
|
|
17
17
|
useEffect(() => {
|
|
18
18
|
Taro.nextTick(() => {
|
|
19
19
|
const createIntersectionObserver = new intersectionObserver({
|
|
20
20
|
selector: `.${lazyLayoutLoadFloor}`,
|
|
21
21
|
context: this,
|
|
22
22
|
onFinal: () => {
|
|
23
23
|
setComponentShowState(true)
|
|
24
24
|
createIntersectionObserver.disconnect()
|
|
25
25
|
},
|
|
26
26
|
})
|
|
27
27
|
createIntersectionObserver.connect()
|
|
28
28
|
})
|
|
29
29
|
}, [])
|
|
30
30
|
return type === LazyType.IMAGE ? (
|
|
31
31
|
children
|
|
32
32
|
) : (
|
|
33
33
|
<View
|
|
34
34
|
id={`${containerId}_lazy`}
|
|
35
35
|
ref={componentLazyRef}
|
|
36
36
|
className={classNames(
|
|
37
37
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
38
38
|
'd-app-floor-lazy-load',
|
|
39
39
|
lazyLayoutLoadFloor,
|
|
40
40
|
)}
|
|
41
41
|
style={{
|
|
42
42
|
minHeight: `${componentShowState ? 'auto' : height + 'px'}`,
|
|
43
43
|
backgroundColor: componentShowState ? 'transparent' : '#ffffff',
|
|
44
44
|
}}
|
|
45
45
|
>
|
|
46
46
|
{componentShowState ? children : placeholder}
|
|
47
47
|
</View>
|
|
48
48
|
)
|
|
49
49
|
sectionType:
|
|
50
50
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
|
|
51
51
|
type: LazyType.FLOOR,
|
|
52
52
|
children: null,
|
|
53
53
|
placeholder: null,
|
|
54
54
|
height: 200,
|
|
55
55
|
className: '',
|
|
56
56
|
lazyNodeClassName: '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const NetWorkTypeQuality = {
|
|
1
|
+
export const NetWorkTypeQuality = {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
|
|
2
2
|
.d-lazy-image,
|
|
3
3
|
.d-app-lazy-image {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
//background: #F8F8F8 url("../../resoure/jd_logo_bg.png") center center/50% no-repeat;
|
|
5
|
+
background: #fff
|
|
6
|
+
url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAAeCAMAAABT0xOcAAAAe1BMVEUAAADx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fELy0NOAAAAKHRSTlMApwmfFtYm9rWveHDm70yJHYJaD2k8IeIr6pY2X0HHfsGRZDHdu1XNmO+CqgAAAu9JREFUSMfNlNmymzAQRAchkCUhdrMZbLze/v8vjIRMKN8kRR7ykFNeVIPV9Ewj039P1TR8+eILjL7RdLFFJUO8QMS7ZmyDJvZ0nDYGY+aKKDSJpY3OwWX6uFUEY/peCNEbY4Rp6AABixFYkLQRAK3VOmAjUrawMt1GrfWtXD7rlFF3uiA6HV/p0TF1tBECEVskYe+7qqW08mqT1jruneu21/72JfHoSZ7faj2bJu6mOlgEa3qjEXKeL/ACV1s5YSbqYP6stXUeX2FZnV3wuBSZqnVWqDNCIvaFRzZIiGAIw+CS/1brQCslgOQdUBoW10C2EFJei7AkygOlAnmGeMprJq/NjhZpAIrepOpOte2Oq9EXjupIMVoiXduQ9rTo7KsODhxJYaAGuJPjgRvdkRD1KP9CawRwettyF5SbVLZ49ZbuMJxGW93XisXPKA/oXNMDEReJT6N0OfZ2V4RqX4tFQPbOQbntwrl8oXCOQmu2hVosSr6j5QcW+uvukZJP37CWzL7tQs2lH8B53Nd6eq192N/72mdfa52XhdXPx6zcXKYgikLXbaNP66M27edoAO2X+RkQ9tVRhoWC6IZkCZAbHHa1SgDHNdHDsbrLr0ojKTkfDWp6+WPh1APakMAXbVrb6B/Mn+311zlETJZOCJYChttWxedUIyvyi9bLt+J4IPcLvVYypBNaDG5TguCzmct3rUkAPSdHJRLyDEjXQ6Un3GZQBamxaU09gJg+/r+4gqV0uzixXjBfLnDzixrjhDJGNoDXXqvK76OEJaO3L1bx/FQOCSxqcfJVUWiXCydEPowHeIqaZnf3wmvNRsBiC28ttEnS+1oy+lNtOMVAzayZCwsQ5ESNREgvKKuNjjI/ewNHr9Y4N5Is98llx2U8iOQXcKczhDwAM6ObayaanfWDDwhJcMvpU8ucr6+cPji5a8+UEVMCMNo97tLm0MU2uoMmi850yrc8s8Khyzuj7+Q6U7GPMCt8mOtGljP6l/wAUcBZ6lceL/8AAAAASUVORK5CYII=')
|
|
7
|
+
center center no-repeat;
|
|
8
|
+
&.d-lazy-sku-image {
|
|
9
|
+
background-image: url('https://img14.360buyimg.com/imagetools/jfs/t1/222907/25/7012/5824/61c4797cEbcd17c7f/6c76fc71e4fdb5a5.png');
|
|
10
|
+
background-size: cover;
|
|
11
|
+
}
|
|
12
|
+
&.d-load-completed {
|
|
13
|
+
background: none;
|
|
14
|
+
}
|
|
15
|
+
img {
|
|
16
|
+
display: block;
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
&.d-hide-image-error {
|
|
20
|
+
img {
|
|
21
|
+
opacity: 0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
24
|
}
|