@conecli/cone-render 0.10.1-isv2.1 → 0.10.1-isv2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.ts +1 -1
- package/dist/common/const.ts +1 -1
- package/dist/common/environmentType.ts +1 -1
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/common/jssdk.ts +1 -1
- package/dist/common/pageType.ts +1 -1
- package/dist/common/sgmCustomCode.ts +1 -1
- package/dist/common/token/index.h5.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/common/wxappApi.ts +1 -1
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CountDown/index.module.scss +49 -44
- package/dist/components/base/CountDown/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/CustomVideo/common.ts +1 -0
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +11 -0
- package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
- package/dist/components/base/ExposureSmart/index.h5.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 +2 -2
- 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/index.h5.module.scss +11 -3
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.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/base/Price/Base/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.module.scss +8 -0
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/components/debug/DebugLayout/index.module.scss +2 -2
- 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.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/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/index.jd.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web/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 -1
- package/dist/jumpEventReport/web.pc.ts +1 -1
- package/dist/jumpEventReport/web.tjapp.ts +1 -1
- package/dist/jumpEventReport/web.tjm.ts +1 -1
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -52
- 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/environment.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 +275 -221
- package/dist/sass/base.scss +183 -137
- package/dist/service/fetchGateway.ts +1 -1
- package/dist/service/fetchGateway.weapp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -1
- package/dist/service/http/const.ts +1 -1
- package/dist/service/http/h5Http.ts +1 -0
- package/dist/service/http/index.h5.ts +1 -0
- package/dist/service/requestServer.h5.ts +1 -0
- package/dist/service/requestServer.ts +1 -1
- package/dist/service/requestServer.weapp.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/jumpExtMapUtil.h5.ts +1 -0
- package/dist/utils/jumpExtMapUtil.ts +1 -0
- package/dist/utils/log.ts +1 -0
- package/dist/utils/sColor.js +1 -0
- package/dist/utils/sgmCodeUtils.ts +1 -1
- package/dist/utils/taroRenderUtil.ts +1 -1
- package/dist/utils/utils.ts +1 -1
- package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
- package/dist/wxapp/common/user_info.js +1 -1
- package/package.json +158 -135
- package/dist/utils/memberFormatUtils.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
getNativePageScrollRes,
|
|
3
2
|
latestFromNativeMsgStorage,
|
|
4
3
|
const { children, placeholder, height, className, inViewCallback } = props
|
|
5
4
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
6
5
|
const [componentRenderShowState, setComponentRenderShowState] = useState(
|
|
7
6
|
false,
|
|
8
7
|
)
|
|
9
8
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
10
9
|
const componentShowStateRef = useRef(false)
|
|
11
10
|
const needShowHighVersion =
|
|
12
11
|
isH5AndJdShopViewH5Scroll &&
|
|
13
12
|
!(
|
|
14
13
|
global.info.queryInfo?.downgraded &&
|
|
15
14
|
global.info.queryInfo.downgraded === 'true'
|
|
16
15
|
)
|
|
17
16
|
const rootDom =
|
|
18
17
|
isH5AndJdShopView && needShowHighVersion
|
|
19
18
|
? null
|
|
20
19
|
: document.querySelector('#J_shopHomeRoot')
|
|
21
20
|
if (isH5AndJdShopView && !needShowHighVersion && !isAppStowShop) {
|
|
22
21
|
useEffect(() => {
|
|
23
22
|
const latestRes =
|
|
24
23
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
25
24
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
26
25
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
|
|
27
26
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
28
27
|
})
|
|
29
28
|
}, [])
|
|
30
29
|
useEffect(() => {
|
|
31
30
|
if (componentShowState) {
|
|
32
31
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
33
32
|
}
|
|
34
33
|
}, [componentShowState])
|
|
35
34
|
|
|
36
35
|
const dealPageScrollInfo = res => {
|
|
37
36
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
38
37
|
if (
|
|
39
38
|
typeof displayHeight === 'undefined' ||
|
|
40
39
|
typeof offSetY === 'undefined'
|
|
41
40
|
)
|
|
42
41
|
return
|
|
43
42
|
if (componentLazyRef.current) {
|
|
44
43
|
const eleClientRect = componentLazyRef.current.getBoundingClientRect()
|
|
45
44
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
46
45
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
47
46
|
if (!componentShowStateRef.current) {
|
|
48
47
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
49
48
|
componentShowStateRef.current = true
|
|
50
49
|
setComponentShowState(true)
|
|
51
50
|
Taro.nextTick(() => {
|
|
52
51
|
setComponentRenderShowState(true)
|
|
53
52
|
})
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
return (
|
|
59
58
|
<View
|
|
60
59
|
ref={componentLazyRef}
|
|
61
60
|
className={classNames(
|
|
62
61
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
63
62
|
'd-app-floor-lazy-load',
|
|
64
63
|
className,
|
|
65
64
|
)}
|
|
66
65
|
style={{
|
|
67
66
|
minHeight: `${
|
|
68
67
|
componentRenderShowState
|
|
69
68
|
? 'auto'
|
|
70
69
|
: height + (typeof height === 'number' ? 'px' : '')
|
|
71
70
|
}`,
|
|
72
71
|
backgroundColor: componentRenderShowState ? 'transparent' : '#ffffff',
|
|
73
72
|
}}
|
|
74
73
|
>
|
|
75
74
|
{componentShowState ? children : placeholder}
|
|
76
75
|
</View>
|
|
77
76
|
)
|
|
78
77
|
} else {
|
|
79
78
|
const { ref, inView } = useInView({
|
|
80
79
|
threshold: 0.5,
|
|
81
80
|
triggerOnce: true,
|
|
82
81
|
root: rootDom || null,
|
|
83
82
|
rootMargin: `0px 0px 0px 0px`,
|
|
84
83
|
delay: 300,
|
|
85
84
|
})
|
|
86
85
|
useEffect(() => {
|
|
87
86
|
if (inView) {
|
|
88
87
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
89
88
|
}
|
|
90
89
|
}, [inView])
|
|
91
90
|
return (
|
|
92
91
|
<View
|
|
93
92
|
className={className}
|
|
94
93
|
ref={ref}
|
|
95
94
|
style={{
|
|
96
95
|
minHeight: inView
|
|
97
96
|
? 'auto'
|
|
98
97
|
: typeof height === 'number'
|
|
99
98
|
? `${height}px`
|
|
100
99
|
: height,
|
|
101
100
|
backgroundColor: 'transparent',
|
|
102
101
|
}}
|
|
103
102
|
>
|
|
104
103
|
{inView ? children : placeholder}
|
|
105
104
|
</View>
|
|
106
105
|
)
|
|
107
106
|
}
|
|
108
107
|
children: null,
|
|
109
108
|
placeholder: null,
|
|
110
109
|
height: 1,
|
|
111
110
|
className: '',
|
|
112
111
|
lazyNodeClassName: '',
|
|
113
112
|
inViewCallback: null,
|
|
113
|
+
import Taro from '@tarojs/taro';
|
|
114
114
|
getNativePageScrollRes,
|
|
115
115
|
latestFromNativeMsgStorage,
|
|
116
116
|
const { children, placeholder, height, className, inViewCallback } = props;
|
|
117
117
|
const [componentShowState, setComponentShowState] = useState(false);
|
|
118
118
|
const [componentRenderShowState, setComponentRenderShowState] = useState(false);
|
|
119
119
|
const componentLazyRef = useRef<HTMLElement | null>(null);
|
|
120
120
|
const componentShowStateRef = useRef(false);
|
|
121
121
|
const needShowHighVersion =
|
|
122
122
|
isH5AndJdShopViewH5Scroll &&
|
|
123
123
|
!(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === 'true');
|
|
124
124
|
const rootDom =
|
|
125
125
|
isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot');
|
|
126
126
|
if (isH5AndJdShopView && !needShowHighVersion && !isAppStowShop) {
|
|
127
127
|
useEffect(() => {
|
|
128
128
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {};
|
|
129
129
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes);
|
|
130
130
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
131
131
|
!componentShowStateRef.current && dealPageScrollInfo(res);
|
|
132
132
|
});
|
|
133
133
|
}, []);
|
|
134
134
|
useEffect(() => {
|
|
135
135
|
if (componentShowState) {
|
|
136
136
|
typeof inViewCallback === 'function' && inViewCallback();
|
|
137
137
|
}
|
|
138
138
|
}, [componentShowState]);
|
|
139
139
|
|
|
140
140
|
const dealPageScrollInfo = (res) => {
|
|
141
141
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {};
|
|
142
142
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return;
|
|
143
143
|
if (componentLazyRef.current) {
|
|
144
144
|
const eleClientRect = componentLazyRef.current.getBoundingClientRect();
|
|
145
145
|
const getContainerHeightOffSetY = displayHeight + offSetY;
|
|
146
146
|
const eleOffsetTop = Math.ceil(eleClientRect.top);
|
|
147
147
|
if (!componentShowStateRef.current) {
|
|
148
148
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
149
149
|
componentShowStateRef.current = true;
|
|
150
150
|
setComponentShowState(true);
|
|
151
151
|
Taro.nextTick(() => {
|
|
152
152
|
setComponentRenderShowState(true);
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
return (
|
|
159
159
|
<View
|
|
160
160
|
ref={componentLazyRef}
|
|
161
161
|
className={classNames(
|
|
162
162
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
163
163
|
'd-app-floor-lazy-load',
|
|
164
164
|
className,
|
|
165
165
|
)}
|
|
166
166
|
style={{
|
|
167
167
|
minHeight: `${
|
|
168
168
|
componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
|
|
169
169
|
}`,
|
|
170
170
|
backgroundColor: componentRenderShowState ? 'transparent' : '#ffffff',
|
|
171
171
|
}}
|
|
172
172
|
>
|
|
173
173
|
{componentShowState ? children : placeholder}
|
|
174
174
|
</View>
|
|
175
175
|
);
|
|
176
176
|
} else {
|
|
177
177
|
const { ref, inView } = useInView({
|
|
178
178
|
threshold: 0.5,
|
|
179
179
|
triggerOnce: true,
|
|
180
180
|
root: rootDom || null,
|
|
181
181
|
rootMargin: `0px 0px 0px 0px`,
|
|
182
182
|
delay: 300,
|
|
183
183
|
});
|
|
184
184
|
useEffect(() => {
|
|
185
185
|
if (inView) {
|
|
186
186
|
typeof inViewCallback === 'function' && inViewCallback();
|
|
187
187
|
}
|
|
188
188
|
}, [inView]);
|
|
189
189
|
return (
|
|
190
190
|
<div
|
|
191
191
|
className={className}
|
|
192
192
|
ref={ref}
|
|
193
193
|
style={{
|
|
194
194
|
minHeight: inView ? 'auto' : typeof height === 'number' ? `${height}px` : height,
|
|
195
195
|
backgroundColor: 'transparent',
|
|
196
196
|
}}
|
|
197
197
|
>
|
|
198
198
|
{inView ? children : placeholder}
|
|
199
199
|
</div>
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
202
|
children: null,
|
|
203
203
|
placeholder: null,
|
|
204
204
|
height: 1,
|
|
205
205
|
className: '',
|
|
206
206
|
lazyNodeClassName: '',
|
|
207
207
|
inViewCallback: null,
|
|
@@ -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
|
sectionType = SECTION_HOME_TAB_NAME_TYPE[
|
|
6
6
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
7
7
|
],
|
|
8
8
|
type = LazyType.FLOOR,
|
|
9
9
|
children = null,
|
|
10
10
|
placeholder = null,
|
|
11
11
|
height = 200,
|
|
12
12
|
className = '',
|
|
13
13
|
lazyNodeClassName = '',
|
|
14
14
|
containerId,
|
|
15
15
|
} = props
|
|
16
16
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
17
17
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
18
18
|
const lazyLayoutLoadFloor =
|
|
19
19
|
'lazy-layout-load-floor' + Math.floor(Math.random() * 10000000)
|
|
20
20
|
useEffect(() => {
|
|
21
21
|
Taro.nextTick(() => {
|
|
22
22
|
const createIntersectionObserver = new intersectionObserver({
|
|
23
23
|
selector: `.${lazyLayoutLoadFloor}`,
|
|
24
24
|
context: this,
|
|
25
25
|
onFinal: () => {
|
|
26
26
|
setComponentShowState(true)
|
|
27
27
|
createIntersectionObserver.disconnect()
|
|
28
28
|
},
|
|
29
29
|
})
|
|
30
30
|
createIntersectionObserver.connect()
|
|
31
31
|
})
|
|
32
32
|
}, [])
|
|
33
33
|
return type === LazyType.IMAGE ? (
|
|
34
34
|
children
|
|
35
35
|
) : (
|
|
36
36
|
<View
|
|
37
37
|
id={`${containerId}_lazy`}
|
|
38
38
|
ref={componentLazyRef}
|
|
39
39
|
className={classNames(
|
|
40
40
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
41
41
|
'd-app-floor-lazy-load',
|
|
42
42
|
lazyLayoutLoadFloor,
|
|
43
43
|
)}
|
|
44
44
|
style={{
|
|
45
45
|
minHeight: `${componentShowState ? 'auto' : height + 'px'}`,
|
|
46
46
|
backgroundColor: componentShowState ? 'transparent' : '#ffffff',
|
|
47
47
|
}}
|
|
48
48
|
>
|
|
49
49
|
{componentShowState ? children : placeholder}
|
|
50
50
|
</View>
|
|
51
51
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
const { className, pointClassName, children, reportData, customReportDataKey,customReportDataFn, trackCallback, ...otherProps } =
|
|
3
2
|
props
|
|
4
3
|
const isCustomReport = customReportDataKey && customReportDataFn
|
|
5
4
|
const checkReportData = Array.isArray(reportData)
|
|
6
5
|
const [floorData, mInfo] = checkReportData ? reportData : []
|
|
7
6
|
const checkReportDataState = isCustomReport ? true : floorData && mInfo
|
|
8
7
|
|
|
9
8
|
floorData && mInfo && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0)
|
|
10
9
|
return (
|
|
11
10
|
<View
|
|
12
11
|
ref={ref}
|
|
13
12
|
className={classNames(
|
|
14
13
|
itemViewExposureSmartStyle['d-item-point-layout'],
|
|
15
14
|
className,
|
|
16
15
|
)}
|
|
17
16
|
{...otherProps}
|
|
18
17
|
>
|
|
19
18
|
{children ? children : null}
|
|
20
19
|
{checkReportDataState && (
|
|
21
20
|
<ExposureSmart
|
|
22
21
|
className={classNames(pointClassName,{
|
|
23
22
|
[itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
|
|
24
23
|
})}
|
|
25
24
|
reportData={reportData}
|
|
26
25
|
trackCallback={trackCallback}
|
|
27
26
|
customReportDataFn={customReportDataFn}
|
|
28
27
|
customReportDataKey={customReportDataKey}
|
|
29
28
|
markPoint
|
|
30
29
|
/>
|
|
31
30
|
)}
|
|
32
31
|
</View>
|
|
33
32
|
)
|
|
34
33
|
reportData: [],
|
|
35
34
|
customReportDataKey: null,
|
|
36
35
|
customReportDataFn: null
|
|
36
|
+
import React, { useRef } from 'react';
|
|
37
37
|
const {
|
|
38
38
|
className,
|
|
39
39
|
pointClassName,
|
|
40
40
|
children,
|
|
41
41
|
reportData,
|
|
42
42
|
customReportDataKey,
|
|
43
43
|
customReportDataFn,
|
|
44
44
|
trackCallback,
|
|
45
45
|
...otherProps
|
|
46
46
|
} = props;
|
|
47
47
|
const itemViewExposureRef = useRef(null);
|
|
48
48
|
const isCustomReport = customReportDataKey && customReportDataFn;
|
|
49
49
|
const checkReportData = Array.isArray(reportData);
|
|
50
50
|
const [floorData, mInfo] = checkReportData ? reportData : [];
|
|
51
51
|
const checkReportDataState = isCustomReport ? true : floorData && mInfo;
|
|
52
52
|
|
|
53
53
|
floorData && mInfo && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0);
|
|
54
54
|
return (
|
|
55
55
|
<View
|
|
56
56
|
ref={itemViewExposureRef}
|
|
57
57
|
className={classNames(itemViewExposureSmartStyle['d-item-point-layout'], className)}
|
|
58
58
|
{...otherProps}
|
|
59
59
|
>
|
|
60
60
|
{children ? children : null}
|
|
61
61
|
{checkReportDataState && (
|
|
62
62
|
<ExposureSmart
|
|
63
63
|
className={classNames(pointClassName, {
|
|
64
64
|
[itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
|
|
65
65
|
})}
|
|
66
66
|
innerRef={itemViewExposureRef}
|
|
67
67
|
reportData={reportData}
|
|
68
68
|
trackCallback={trackCallback}
|
|
69
69
|
customReportDataFn={customReportDataFn}
|
|
70
70
|
customReportDataKey={customReportDataKey}
|
|
71
71
|
markPoint
|
|
72
72
|
/>
|
|
73
73
|
)}
|
|
74
74
|
</View>
|
|
75
75
|
);
|
|
76
76
|
reportData: [],
|
|
77
77
|
customReportDataKey: null,
|
|
78
78
|
customReportDataFn: null,
|
|
79
79
|
customReportDataForMapFn: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro, { useRouter } from '@tarojs/taro'
|
|
2
1
|
isH5AndJdShopView,
|
|
3
2
|
isH5AndJdShopViewH5Scroll,
|
|
4
3
|
sgmCustomReport,
|
|
5
4
|
getSgmCustomCode,
|
|
6
5
|
SECTION_HOME_TAB_TYPE,
|
|
7
6
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
8
7
|
TaroEventType,
|
|
9
8
|
latestFromNativeMsgStorage,
|
|
10
9
|
nativePageRegisterMessage,
|
|
11
10
|
Message_Type,
|
|
12
11
|
getNativePageScrollRes,
|
|
13
12
|
const {
|
|
14
13
|
children,
|
|
15
14
|
containerId,
|
|
16
15
|
type,
|
|
17
16
|
placeholder,
|
|
18
17
|
height,
|
|
19
18
|
floorData = {},
|
|
20
19
|
sectionType,
|
|
21
20
|
lazyNodeClassName,
|
|
22
21
|
} = props
|
|
23
22
|
const getRouterInfo = useRouter()
|
|
24
23
|
const getQueryData = getRouterInfo?.params || {}
|
|
25
24
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
26
25
|
const [componentRenderShowState, setComponentRenderShowState] = useState(
|
|
27
26
|
false,
|
|
28
27
|
)
|
|
29
28
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
30
29
|
const componentShowStateRef = useRef(false)
|
|
31
30
|
const needShowHighVersion =
|
|
32
31
|
isH5AndJdShopViewH5Scroll &&
|
|
33
32
|
!(
|
|
34
33
|
global.info.queryInfo?.downgraded &&
|
|
35
34
|
global.info.queryInfo.downgraded === 'true'
|
|
36
35
|
)
|
|
37
36
|
const rootDom =
|
|
38
37
|
isH5AndJdShopView && needShowHighVersion
|
|
39
38
|
? null
|
|
40
39
|
: document.querySelector('#J_shopHomeRoot')
|
|
41
40
|
const { ref, inView } = useInView({
|
|
42
41
|
threshold: 0,
|
|
43
42
|
triggerOnce: true,
|
|
44
43
|
root: rootDom,
|
|
45
44
|
rootMargin: `0px 0px ${window.innerHeight}px 0px`,
|
|
46
45
|
})
|
|
47
46
|
useEffect(() => {
|
|
48
47
|
if (needShowHighVersion || !isH5AndJdShopView) return
|
|
49
48
|
if (type === LazyType.FLOOR) {
|
|
50
49
|
const latestRes =
|
|
51
50
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
52
51
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes, false)
|
|
53
52
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
|
|
54
53
|
!componentShowStateRef.current && dealPageScrollInfo(res, true)
|
|
55
54
|
})
|
|
56
55
|
}
|
|
57
56
|
}, [])
|
|
58
57
|
useEffect(() => {
|
|
59
58
|
if (
|
|
60
59
|
(!needShowHighVersion && componentShowState === true) ||
|
|
61
60
|
(needShowHighVersion && inView && isH5AndJdShopView)
|
|
62
61
|
) {
|
|
63
62
|
console.log(
|
|
64
63
|
'>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!',
|
|
65
64
|
)
|
|
66
65
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
67
66
|
const modularPackResultObj =
|
|
68
67
|
typeof modularPackResult === 'string'
|
|
69
68
|
? JSON.parse(modularPackResult)
|
|
70
69
|
: modularPackResult
|
|
71
70
|
if (modularPackResultObj && modularPackResultObj.bundleUrl) {
|
|
72
71
|
const { bundleUrl } = modularPackResultObj
|
|
73
72
|
nativePageRegisterMessage(Message_Type.NATIVE_INJECT_JS_FILE, {
|
|
74
73
|
data: {
|
|
75
74
|
bundleUrl: [bundleUrl],
|
|
76
75
|
},
|
|
77
76
|
})
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
}, [componentShowState, inView])
|
|
81
80
|
|
|
82
81
|
const dealPageScrollInfo = (res, pageScrollTrigger) => {
|
|
83
82
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
84
83
|
if (
|
|
85
84
|
typeof displayHeight === 'undefined' ||
|
|
86
85
|
typeof offSetY === 'undefined'
|
|
87
86
|
) {
|
|
88
87
|
const shopId = floorData?.floorExtInfo?.shopId
|
|
89
88
|
if (!lazyLayoutLoadErrorShopId[`${shopId}`] && pageScrollTrigger) {
|
|
90
89
|
const opt = {
|
|
91
90
|
msg: `店铺楼层懒加载失败。楼层顺序-floorIdx: ${floorData?.floorIdx}。`,
|
|
92
91
|
uid: floorData?.uid,
|
|
93
92
|
floorIdx: floorData?.floorIdx,
|
|
94
93
|
shopId: shopId,
|
|
95
94
|
moduleId: floorData?.moduleId,
|
|
96
95
|
moduleName: floorData?.moduleName,
|
|
97
96
|
middleTemplateId: floorData?.middleTemplateId,
|
|
98
97
|
modularPackResult:
|
|
99
98
|
typeof floorData?.floorExtInfo?.modularPackResult == 'string'
|
|
100
99
|
? JSON.parse(floorData?.floorExtInfo?.modularPackResult)
|
|
101
100
|
: floorData?.floorExtInfo?.modularPackResult,
|
|
102
101
|
}
|
|
103
102
|
sgmCustomReport({
|
|
104
103
|
code: getSgmCustomCode(SgmCustomCode.FLOORLAZYLOAD_DATA),
|
|
105
104
|
msg: opt,
|
|
106
105
|
})
|
|
107
106
|
lazyLayoutLoadErrorShopId[`${shopId}`] = true
|
|
108
107
|
}
|
|
109
108
|
return
|
|
110
109
|
}
|
|
111
110
|
if (componentLazyRef.current) {
|
|
112
111
|
const eleClientRect = componentLazyRef.current.getBoundingClientRect()
|
|
113
112
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
114
113
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
115
114
|
const eleOffsetHeight = Math.ceil(eleClientRect.height)
|
|
116
115
|
const eleOffsetTopHeight = eleOffsetTop + eleOffsetHeight
|
|
117
116
|
if (!componentShowStateRef.current) {
|
|
118
117
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
119
118
|
componentShowStateRef.current = true
|
|
120
119
|
setComponentShowState(true)
|
|
121
120
|
Taro.nextTick(() => {
|
|
122
121
|
setComponentRenderShowState(true)
|
|
123
122
|
})
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
127
|
return isH5AndJdShopView && !needShowHighVersion ? (
|
|
129
128
|
<div
|
|
130
129
|
id={`${containerId}_lazy`}
|
|
131
130
|
ref={componentLazyRef}
|
|
132
131
|
className={classNames(
|
|
133
132
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
134
133
|
'd-app-floor-lazy-load',
|
|
135
134
|
)}
|
|
136
135
|
style={{
|
|
137
136
|
minHeight: `${componentRenderShowState ? 'auto' : height + 'px'}`,
|
|
138
137
|
backgroundColor: componentRenderShowState ? 'transparent' : '#ffffff',
|
|
139
138
|
}}
|
|
140
139
|
>
|
|
141
140
|
{componentShowState ? children : placeholder}
|
|
142
141
|
</div>
|
|
143
142
|
) : (
|
|
144
143
|
<div
|
|
145
144
|
id={`${containerId}_lazy`}
|
|
146
145
|
className={classNames(
|
|
147
146
|
lazyLayoutLoadStyle['d-mobile-floor-lazy-layout-load'],
|
|
148
147
|
'd-mobile-floor-lazy-load',
|
|
149
148
|
lazyNodeClassName,
|
|
150
149
|
)}
|
|
151
150
|
ref={ref}
|
|
152
151
|
style={{
|
|
153
152
|
minHeight: `${inView ? 'auto' : height + 'px'}`,
|
|
154
153
|
backgroundColor: inView ? 'transparent' : '#ffffff',
|
|
155
154
|
}}
|
|
156
155
|
>
|
|
157
156
|
{inView ? children : placeholder}
|
|
158
157
|
</div>
|
|
159
158
|
)
|
|
160
159
|
sectionType:
|
|
161
160
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
|
|
162
161
|
type: LazyType.FLOOR,
|
|
163
162
|
children: null,
|
|
164
163
|
placeholder: null,
|
|
165
164
|
height: 200,
|
|
166
165
|
className: '',
|
|
167
166
|
lazyNodeClassName: '',
|
|
167
|
+
import Taro, { useRouter } from '@tarojs/taro'
|
|
168
168
|
isH5AndJdShopView,
|
|
169
169
|
isH5AndJdShopViewH5Scroll,
|
|
170
170
|
sgmCustomReport,
|
|
171
171
|
getSgmCustomCode,
|
|
172
172
|
SECTION_HOME_TAB_TYPE,
|
|
173
173
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
174
174
|
TaroEventType,
|
|
175
175
|
latestFromNativeMsgStorage,
|
|
176
176
|
nativePageRegisterMessage,
|
|
177
177
|
Message_Type,
|
|
178
178
|
getNativePageScrollRes,
|
|
179
179
|
const {
|
|
180
180
|
sectionType = SECTION_HOME_TAB_NAME_TYPE[
|
|
181
181
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
182
182
|
],
|
|
183
183
|
type = LazyType.FLOOR,
|
|
184
184
|
children = null,
|
|
185
185
|
placeholder = null,
|
|
186
186
|
height = 200,
|
|
187
187
|
className = '',
|
|
188
188
|
lazyNodeClassName = '',
|
|
189
189
|
containerId,
|
|
190
190
|
floorData = {},
|
|
191
191
|
} = props
|
|
192
192
|
const getRouterInfo = useRouter()
|
|
193
193
|
const getQueryData = getRouterInfo?.params || {}
|
|
194
194
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
195
195
|
const [componentRenderShowState, setComponentRenderShowState] =
|
|
196
196
|
useState(false)
|
|
197
197
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
198
198
|
const componentShowStateRef = useRef(false)
|
|
199
199
|
const needShowHighVersion =
|
|
200
200
|
isH5AndJdShopViewH5Scroll &&
|
|
201
201
|
!(
|
|
202
202
|
global.info.queryInfo?.downgraded &&
|
|
203
203
|
global.info.queryInfo.downgraded === 'true'
|
|
204
204
|
)
|
|
205
205
|
const rootDom =
|
|
206
206
|
isH5AndJdShopView && needShowHighVersion
|
|
207
207
|
? null
|
|
208
208
|
: document.querySelector('#J_shopHomeRoot')
|
|
209
209
|
const { ref, inView } = useInView({
|
|
210
210
|
threshold: 0,
|
|
211
211
|
triggerOnce: true,
|
|
212
212
|
root: rootDom,
|
|
213
213
|
rootMargin: `0px 0px ${window.innerHeight}px 0px`,
|
|
214
214
|
})
|
|
215
215
|
useEffect(() => {
|
|
216
216
|
if (needShowHighVersion || !isH5AndJdShopView) return
|
|
217
217
|
if (type === LazyType.FLOOR) {
|
|
218
218
|
const latestRes =
|
|
219
219
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
220
220
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes, false)
|
|
221
221
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
222
222
|
!componentShowStateRef.current && dealPageScrollInfo(res, true)
|
|
223
223
|
})
|
|
224
224
|
}
|
|
225
225
|
}, [])
|
|
226
226
|
useEffect(() => {
|
|
227
227
|
if (
|
|
228
228
|
(!needShowHighVersion && componentShowState === true) ||
|
|
229
229
|
(needShowHighVersion && inView && isH5AndJdShopView)
|
|
230
230
|
) {
|
|
231
231
|
console.log(
|
|
232
232
|
'>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!',
|
|
233
233
|
)
|
|
234
234
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
235
235
|
const modularPackResultObj =
|
|
236
236
|
typeof modularPackResult === 'string'
|
|
237
237
|
? JSON.parse(modularPackResult)
|
|
238
238
|
: modularPackResult
|
|
239
239
|
if (modularPackResultObj && modularPackResultObj.bundleUrl) {
|
|
240
240
|
const { bundleUrl } = modularPackResultObj
|
|
241
241
|
nativePageRegisterMessage(Message_Type.NATIVE_INJECT_JS_FILE, {
|
|
242
242
|
data: {
|
|
243
243
|
bundleUrl: [bundleUrl],
|
|
244
244
|
},
|
|
245
245
|
})
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}, [componentShowState, inView])
|
|
249
249
|
|
|
250
250
|
const dealPageScrollInfo = (res, pageScrollTrigger) => {
|
|
251
251
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
252
252
|
if (
|
|
253
253
|
typeof displayHeight === 'undefined' ||
|
|
254
254
|
typeof offSetY === 'undefined'
|
|
255
255
|
) {
|
|
256
256
|
const shopId = floorData?.floorExtInfo?.shopId
|
|
257
257
|
if (!lazyLayoutLoadErrorShopId[`${shopId}`] && pageScrollTrigger) {
|
|
258
258
|
const opt = {
|
|
259
259
|
msg: `店铺楼层懒加载失败。楼层顺序-floorIdx: ${floorData?.floorIdx}。`,
|
|
260
260
|
uid: floorData?.uid,
|
|
261
261
|
floorIdx: floorData?.floorIdx,
|
|
262
262
|
shopId: shopId,
|
|
263
263
|
moduleId: floorData?.moduleId,
|
|
264
264
|
moduleName: floorData?.moduleName,
|
|
265
265
|
middleTemplateId: floorData?.middleTemplateId,
|
|
266
266
|
}
|
|
267
267
|
sgmCustomReport({
|
|
268
268
|
code: getSgmCustomCode(SgmCustomCode.FLOORLAZYLOAD_DATA),
|
|
269
269
|
msg: opt,
|
|
270
270
|
})
|
|
271
271
|
lazyLayoutLoadErrorShopId[`${shopId}`] = true
|
|
272
272
|
}
|
|
273
273
|
return
|
|
274
274
|
}
|
|
275
275
|
if (componentLazyRef.current) {
|
|
276
276
|
const eleClientRect = componentLazyRef.current.getBoundingClientRect()
|
|
277
277
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
278
278
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
279
279
|
const eleOffsetHeight = Math.ceil(eleClientRect.height)
|
|
280
280
|
const eleOffsetTopHeight = eleOffsetTop + eleOffsetHeight
|
|
281
281
|
if (!componentShowStateRef.current) {
|
|
282
282
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
283
283
|
componentShowStateRef.current = true
|
|
284
284
|
setComponentShowState(true)
|
|
285
285
|
Taro.nextTick(() => {
|
|
286
286
|
setComponentRenderShowState(true)
|
|
287
287
|
})
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
return isH5AndJdShopView && !needShowHighVersion ? (
|
|
293
293
|
<div
|
|
294
294
|
id={`${containerId}_lazy`}
|
|
295
295
|
ref={componentLazyRef}
|
|
296
296
|
className={classNames(
|
|
297
297
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
298
298
|
'd-app-floor-lazy-load',
|
|
299
299
|
)}
|
|
300
300
|
style={{
|
|
301
301
|
minHeight: `${componentRenderShowState ? 'auto' : height + 'px'}`,
|
|
302
302
|
backgroundColor: componentRenderShowState ? 'transparent' : '#ffffff',
|
|
303
303
|
}}
|
|
304
304
|
>
|
|
305
305
|
{componentShowState ? children : placeholder}
|
|
306
306
|
</div>
|
|
307
307
|
) : (
|
|
308
308
|
<div
|
|
309
309
|
id={`${containerId}_lazy`}
|
|
310
310
|
className={classNames(
|
|
311
311
|
lazyLayoutLoadStyle['d-mobile-floor-lazy-layout-load'],
|
|
312
312
|
'd-mobile-floor-lazy-load',
|
|
313
313
|
lazyNodeClassName,
|
|
314
314
|
)}
|
|
315
315
|
ref={ref}
|
|
316
316
|
style={{
|
|
317
317
|
minHeight: `${inView ? 'auto' : height + 'px'}`,
|
|
318
318
|
backgroundColor: inView ? 'transparent' : '#ffffff',
|
|
319
319
|
}}
|
|
320
320
|
>
|
|
321
321
|
{inView ? children : placeholder}
|
|
322
322
|
</div>
|
|
323
323
|
)
|