@conecli/cone-render 0.8.20-shop.21 → 0.8.20-shop.211
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/assets/icon_blue_info.svg +1 -0
- 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.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.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/common.ts +1 -0
- package/dist/components/base/CustomVideo/index.module.scss +1 -1
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +16 -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/const.ts +1 -0
- package/dist/components/base/ExposureSmart/index.h5.module.scss +30 -6
- 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/LazyLayoutLoad/index.weapp.tsx +1 -1
- package/dist/components/base/LazyLoadImage/const.ts +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.module.scss +24 -20
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/MobileCommonHeader/index.module.scss +17 -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 +125 -69
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/Base/index.module.scss +12 -0
- package/dist/components/base/Price/Base/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.module.scss +32 -0
- 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/debug/DebugLayout/index.module.scss +67 -0
- package/dist/components/debug/DebugLayout/index.tsx +1 -0
- package/dist/components/debug/DebugLayout/utils.ts +1 -0
- package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
- 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 -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/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.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 -0
- 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/language/en_US.json +178 -0
- package/dist/language/zh_CN.json +178 -0
- package/dist/language/zh_HK.json +178 -0
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -27
- 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/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/request.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 +289 -212
- package/dist/sass/base.scss +195 -137
- package/dist/service/bMallConst.ts +1 -1
- 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/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/intersectionObserver.ts +1 -1
- package/dist/utils/jm-common.js +1 -1
- package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
- package/dist/utils/jumpExtMapUtil.ts +1 -0
- package/dist/utils/sColor.js +1 -0
- 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/common/address_api/address_api_v2.js +1 -0
- package/dist/wxapp/common/user_info.js +1 -1
- 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 +148 -115
- package/dist/components/base/Skeleton/old.tsx +0 -1
- package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
- package/dist/open/api/jump.ts +0 -1
- package/dist/utils/memberFormatUtils.js +0 -1
- /package/dist/service/{bMallConst.wxapp.ts → bMallConst.weapp.ts} +0 -0
- /package/dist/service/http/{colorSign.wxapp.ts → colorSign.weapp.ts} +0 -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
|
getNativePageScrollRes,
|
|
99
99
|
latestFromNativeMsgStorage,
|
|
100
100
|
const { children, placeholder, height, className, inViewCallback } = props
|
|
101
101
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
102
102
|
const [componentRenderShowState, setComponentRenderShowState] = useState(
|
|
103
103
|
false,
|
|
104
104
|
)
|
|
105
105
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
106
106
|
const componentShowStateRef = useRef(false)
|
|
107
107
|
const needShowHighVersion =
|
|
108
108
|
isH5AndJdShopViewH5Scroll &&
|
|
109
109
|
!(
|
|
110
110
|
global.info.queryInfo?.downgraded &&
|
|
111
111
|
global.info.queryInfo.downgraded === 'true'
|
|
112
112
|
)
|
|
113
113
|
const rootDom =
|
|
114
114
|
isH5AndJdShopView && needShowHighVersion
|
|
115
115
|
? null
|
|
116
116
|
: document.querySelector('#J_shopHomeRoot')
|
|
117
117
|
if (isH5AndJdShopView && !needShowHighVersion && !isAppStowShop) {
|
|
118
118
|
useEffect(() => {
|
|
119
119
|
const latestRes =
|
|
120
120
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
121
121
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
122
122
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, res => {
|
|
123
123
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
124
124
|
})
|
|
125
125
|
}, [])
|
|
126
126
|
useEffect(() => {
|
|
127
127
|
if (componentShowState) {
|
|
128
128
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
129
129
|
}
|
|
130
130
|
}, [componentShowState])
|
|
131
131
|
|
|
132
132
|
const dealPageScrollInfo = res => {
|
|
133
133
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
134
134
|
if (
|
|
135
135
|
typeof displayHeight === 'undefined' ||
|
|
136
136
|
typeof offSetY === 'undefined'
|
|
137
137
|
)
|
|
138
138
|
return
|
|
139
139
|
if (componentLazyRef.current) {
|
|
140
140
|
const eleClientRect = componentLazyRef.current.getBoundingClientRect()
|
|
141
141
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
142
142
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
143
143
|
if (!componentShowStateRef.current) {
|
|
144
144
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
145
145
|
componentShowStateRef.current = true
|
|
146
146
|
setComponentShowState(true)
|
|
147
147
|
Taro.nextTick(() => {
|
|
148
148
|
setComponentRenderShowState(true)
|
|
149
149
|
})
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
return (
|
|
155
155
|
<View
|
|
156
156
|
ref={componentLazyRef}
|
|
157
157
|
className={classNames(
|
|
158
158
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
159
159
|
'd-app-floor-lazy-load',
|
|
160
160
|
className,
|
|
161
161
|
)}
|
|
162
162
|
style={{
|
|
163
163
|
minHeight: `${
|
|
164
164
|
componentRenderShowState
|
|
165
165
|
? 'auto'
|
|
166
166
|
: height + (typeof height === 'number' ? 'px' : '')
|
|
167
167
|
}`,
|
|
168
168
|
backgroundColor: componentRenderShowState ? 'transparent' : '#ffffff',
|
|
169
169
|
}}
|
|
170
170
|
>
|
|
171
171
|
{componentShowState ? children : placeholder}
|
|
172
172
|
</View>
|
|
173
173
|
)
|
|
174
174
|
} else {
|
|
175
175
|
const { ref, inView } = useInView({
|
|
176
176
|
threshold: 0.5,
|
|
177
177
|
triggerOnce: true,
|
|
178
178
|
root: rootDom || null,
|
|
179
179
|
rootMargin: `0px 0px 0px 0px`,
|
|
180
180
|
delay: 300,
|
|
181
181
|
})
|
|
182
182
|
useEffect(() => {
|
|
183
183
|
if (inView) {
|
|
184
184
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
185
185
|
}
|
|
186
186
|
}, [inView])
|
|
187
187
|
return (
|
|
188
188
|
<View
|
|
189
189
|
className={className}
|
|
190
190
|
ref={ref}
|
|
191
191
|
style={{
|
|
192
192
|
minHeight: inView
|
|
193
193
|
? 'auto'
|
|
194
194
|
: typeof height === 'number'
|
|
195
195
|
? `${height}px`
|
|
196
196
|
: height,
|
|
197
197
|
backgroundColor: 'transparent',
|
|
198
198
|
}}
|
|
199
199
|
>
|
|
200
200
|
{inView ? children : placeholder}
|
|
201
201
|
</View>
|
|
202
202
|
)
|
|
203
203
|
}
|
|
204
204
|
children: null,
|
|
205
205
|
placeholder: null,
|
|
206
206
|
height: 1,
|
|
207
207
|
className: '',
|
|
208
208
|
lazyNodeClassName: '',
|
|
209
209
|
inViewCallback: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
const {
|
|
1
3
|
className,
|
|
2
4
|
pointClassName,
|
|
3
5
|
children,
|
|
4
6
|
reportData,
|
|
5
7
|
customReportDataKey,
|
|
6
8
|
customReportDataFn,
|
|
7
9
|
trackCallback,
|
|
8
10
|
...otherProps
|
|
9
11
|
} = props;
|
|
10
12
|
const itemViewExposureRef = useRef(null);
|
|
11
13
|
const isCustomReport = customReportDataKey && customReportDataFn;
|
|
12
14
|
const checkReportData = Array.isArray(reportData);
|
|
13
15
|
const [floorData, mInfo] = checkReportData ? reportData : [];
|
|
14
16
|
const checkReportDataState = isCustomReport ? true : floorData && mInfo;
|
|
15
17
|
|
|
16
18
|
floorData && mInfo && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0);
|
|
17
19
|
return (
|
|
18
20
|
<View
|
|
19
21
|
ref={itemViewExposureRef}
|
|
20
22
|
className={classNames(itemViewExposureSmartStyle['d-item-point-layout'], className)}
|
|
21
23
|
{...otherProps}
|
|
22
24
|
>
|
|
23
25
|
{children ? children : null}
|
|
24
26
|
{checkReportDataState && (
|
|
25
27
|
<ExposureSmart
|
|
26
28
|
className={classNames(pointClassName, {
|
|
27
29
|
[itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
|
|
28
30
|
})}
|
|
29
31
|
innerRef={itemViewExposureRef}
|
|
30
32
|
reportData={reportData}
|
|
31
33
|
trackCallback={trackCallback}
|
|
32
34
|
customReportDataFn={customReportDataFn}
|
|
33
35
|
customReportDataKey={customReportDataKey}
|
|
34
36
|
markPoint
|
|
35
37
|
/>
|
|
36
38
|
)}
|
|
37
39
|
</View>
|
|
38
40
|
);
|
|
39
41
|
reportData: [],
|
|
40
42
|
customReportDataKey: null,
|
|
41
43
|
customReportDataFn: null,
|
|
42
44
|
customReportDataForMapFn: null,
|
|
@@ -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
|
SECTION_HOME_TAB_TYPE,
|
|
26
26
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
27
27
|
TaroEventType,
|
|
28
28
|
const {
|
|
29
29
|
children,
|
|
30
30
|
containerId,
|
|
31
31
|
type,
|
|
32
32
|
placeholder,
|
|
33
33
|
height,
|
|
34
34
|
floorData = {},
|
|
35
35
|
sectionType,
|
|
36
36
|
lazyNodeClassName,
|
|
37
37
|
} = props
|
|
38
38
|
const getRouterInfo = useRouter()
|
|
39
39
|
const getQueryData = getRouterInfo?.params || {}
|
|
40
40
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
41
41
|
const [componentRenderShowState, setComponentRenderShowState] =
|
|
42
42
|
useState(false)
|
|
43
43
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
44
44
|
const componentShowStateRef = useRef(false)
|
|
45
45
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
46
46
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
|
|
47
47
|
const { ref, inView } = useInView({
|
|
48
48
|
threshold: 0,
|
|
49
49
|
triggerOnce: true,
|
|
50
50
|
root: rootDom,
|
|
51
51
|
rootMargin: `0px 0px ${window.innerHeight}px 0px`,
|
|
52
52
|
})
|
|
53
53
|
useEffect(() => {
|
|
54
54
|
if(needShowHighVersion || !isH5AndJdShopView) return
|
|
55
55
|
if (type === LazyType.FLOOR) {
|
|
56
56
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
57
57
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes,false)
|
|
58
58
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
59
59
|
!componentShowStateRef.current && dealPageScrollInfo(res,true)
|
|
60
60
|
})
|
|
61
61
|
}
|
|
62
62
|
}, [])
|
|
63
63
|
useEffect(() => {
|
|
64
64
|
if((!needShowHighVersion && componentShowState === true) ||
|
|
65
65
|
(needShowHighVersion && inView && isH5AndJdShopView)
|
|
66
66
|
) {
|
|
67
67
|
console.log('>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!')
|
|
68
68
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
69
69
|
const modularPackResultObj = typeof modularPackResult === 'string' ? JSON.parse(modularPackResult) : modularPackResult
|
|
70
70
|
if (modularPackResultObj && modularPackResultObj.bundleUrl) {
|
|
71
71
|
const { bundleUrl } = modularPackResultObj
|
|
72
72
|
nativePageRegisterMessage(
|
|
73
73
|
Message_Type.NATIVE_INJECT_JS_FILE,
|
|
74
74
|
{
|
|
75
75
|
data: {
|
|
76
76
|
"bundleUrl": [bundleUrl]
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
79
|
)
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}, [componentShowState,inView])
|
|
83
83
|
|
|
84
84
|
const dealPageScrollInfo = (res,pageScrollTrigger) => {
|
|
85
85
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
86
86
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') {
|
|
87
87
|
const shopId = floorData?.floorExtInfo?.shopId
|
|
88
88
|
if(!lazyLayoutLoadErrorShopId[`${shopId}`] && pageScrollTrigger) {
|
|
89
89
|
const opt = {
|
|
90
90
|
msg: `店铺楼层懒加载失败。楼层顺序-floorIdx: ${floorData?.floorIdx}。`,
|
|
91
91
|
uid: floorData?.uid,
|
|
92
92
|
floorIdx: floorData?.floorIdx,
|
|
93
93
|
shopId: shopId,
|
|
94
94
|
moduleId: floorData?.moduleId,
|
|
95
95
|
moduleName: floorData?.moduleName,
|
|
96
96
|
middleTemplateId: floorData?.middleTemplateId
|
|
97
97
|
}
|
|
98
98
|
sgmCustomReport({
|
|
99
99
|
code: getSgmCustomCode(SgmCustomCode.FLOORLAZYLOAD_DATA),
|
|
100
100
|
msg: opt,
|
|
101
101
|
})
|
|
102
102
|
lazyLayoutLoadErrorShopId[`${shopId}`] = true
|
|
103
103
|
}
|
|
104
104
|
return
|
|
105
105
|
}
|
|
106
106
|
if (componentLazyRef.current) {
|
|
107
107
|
const eleClientRect =
|
|
108
108
|
componentLazyRef.current.getBoundingClientRect()
|
|
109
109
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
110
110
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
111
111
|
const eleOffsetHeight = Math.ceil(eleClientRect.height)
|
|
112
112
|
const eleOffsetTopHeight = eleOffsetTop + eleOffsetHeight
|
|
113
113
|
if (!componentShowStateRef.current) {
|
|
114
114
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
115
115
|
componentShowStateRef.current = true
|
|
116
116
|
setComponentShowState(true)
|
|
117
117
|
Taro.nextTick(() => {
|
|
118
118
|
setComponentRenderShowState(true)
|
|
119
119
|
})
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
return isH5AndJdShopView && !needShowHighVersion ? (
|
|
125
125
|
<div
|
|
126
126
|
id={`${containerId}_lazy`}
|
|
127
127
|
ref={componentLazyRef}
|
|
128
128
|
className={classNames(
|
|
129
129
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
130
130
|
'd-app-floor-lazy-load',
|
|
131
131
|
)}
|
|
132
132
|
style={{
|
|
133
133
|
minHeight: `${
|
|
134
134
|
componentRenderShowState ? 'auto' : height + 'px'
|
|
135
135
|
}`,
|
|
136
136
|
backgroundColor: componentRenderShowState
|
|
137
137
|
? 'transparent'
|
|
138
138
|
: '#ffffff',
|
|
139
139
|
}}
|
|
140
140
|
>
|
|
141
141
|
{componentShowState ? children : placeholder}
|
|
142
142
|
</div>
|
|
143
143
|
) : (
|
|
144
144
|
<div
|
|
145
145
|
id={`${containerId}_lazy`}
|
|
146
146
|
className={classNames(
|
|
147
147
|
lazyLayoutLoadStyle['d-mobile-floor-lazy-layout-load'],
|
|
148
148
|
'd-mobile-floor-lazy-load',
|
|
149
149
|
lazyNodeClassName,
|
|
150
150
|
)}
|
|
151
151
|
ref={ref}
|
|
152
152
|
style={{
|
|
153
153
|
minHeight: `${inView ? 'auto' : height + 'px'}`,
|
|
154
154
|
backgroundColor: inView ? 'transparent' : '#ffffff',
|
|
155
155
|
}}
|
|
156
156
|
>
|
|
157
157
|
{}
|
|
158
158
|
{inView ? children : placeholder}
|
|
159
159
|
</div>
|
|
160
160
|
)
|
|
161
161
|
sectionType:
|
|
162
162
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
|
|
163
163
|
type: LazyType.FLOOR,
|
|
164
164
|
children: null,
|
|
165
165
|
placeholder: null,
|
|
166
166
|
height: 200,
|
|
167
167
|
className: '',
|
|
168
168
|
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,28 @@
|
|
|
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
|
+
// 暂时注释修复taro中Image组件已高度为准,宽度需要自适应的样式处理,需要调研和埋点上报看下有没有这种使用场景 20241122
|
|
16
|
+
//&[mode="heightFix"] > img{
|
|
17
|
+
// width: auto;
|
|
18
|
+
//}
|
|
19
|
+
img {
|
|
20
|
+
display: block;
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
&.d-hide-image-error {
|
|
24
|
+
img {
|
|
25
|
+
opacity: 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
24
28
|
}
|