@conecli/cone-render 0.8.20-shop.51 → 0.8.20-shop.52
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/components/base/ExposureSmart/const.ts +1 -0
- package/dist/components/base/ExposureSmart/index.h5.module.scss +18 -4
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.module.scss +20 -9
- package/dist/components/base/ExposureSmart/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
- package/dist/components/base/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/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/web/report.ts +1 -1
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/open/api/track.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- package/dist/utils/intersectionObserver.ts +1 -1
- package/package.json +1 -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,8 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
//坑位曝光
|
|
3
|
+
.d-report-point {
|
|
4
|
+
position: absolute;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
6
9
|
opacity: 0;
|
|
7
10
|
pointer-events: none;
|
|
11
|
+
z-index: -1;
|
|
12
|
+
}
|
|
13
|
+
//楼层曝光
|
|
14
|
+
.d-report-floor {
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
right: 0;
|
|
19
|
+
height: 1px;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
z-index: -1;
|
|
8
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
2
1
|
const inViewCallback = () => {
|
|
3
2
|
console.log('埋点收到进入可视区域的回到啦!', reportData)
|
|
4
3
|
addReportData(reportData)
|
|
5
4
|
}
|
|
6
5
|
let chartPointClassName = ""
|
|
7
6
|
|
|
8
7
|
if(isChartH5 && markPoint && Array.isArray(reportData)){
|
|
9
8
|
const [floorData, mInfo, etModelInfo] = reportData
|
|
10
9
|
if(floorData && mInfo && mInfo.hasOwnProperty('pos') && etModelInfo ){
|
|
11
10
|
chartPointClassName = track.getFloorPointIndexClassName(floorData, mInfo.pos)
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
exposureStyle.root,
|
|
15
14
|
className,
|
|
16
15
|
chartPointClassName
|
|
17
16
|
)} height={'100%'} inViewCallback={inViewCallback}></InViewRender>
|
|
18
17
|
markPoint: false
|
|
18
|
+
import React, { useMemo } from 'react'
|
|
19
19
|
const { type, className, reportData, trackCallback, markPoint } = props
|
|
20
20
|
const isViewOnlineState =
|
|
21
21
|
taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
|
|
22
22
|
const inViewCallback = () => {
|
|
23
23
|
console.log('埋点收到进入可视区域的回到啦!', reportData)
|
|
24
24
|
addReportData(reportData)
|
|
25
25
|
typeof trackCallback === 'function' && trackCallback(reportData)
|
|
26
26
|
}
|
|
27
27
|
let chartPointClassName = ""
|
|
28
28
|
|
|
29
29
|
if(isChartH5 && markPoint && Array.isArray(reportData)){
|
|
30
30
|
const [floorData, mInfo] = reportData
|
|
31
31
|
if(floorData && mInfo && mInfo.hasOwnProperty('pos') ){
|
|
32
32
|
chartPointClassName = track.getFloorPointIndexClassName(floorData, mInfo.pos)
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
return isViewOnlineState && reportData
|
|
36
36
|
? <InViewRender className={classNames(
|
|
37
37
|
{
|
|
38
38
|
[exposureStyle['d-report-point']]: type === TrackType.point,
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
[exposureStyle['d-report-floor']]: type === TrackType.floor,
|
|
42
42
|
},
|
|
43
43
|
className,
|
|
44
44
|
chartPointClassName
|
|
45
45
|
)} height={'100%'} inViewCallback={inViewCallback}></InViewRender>
|
|
46
46
|
: null
|
|
47
47
|
return useMemo(() => {
|
|
48
48
|
return <Exposure {...props} />
|
|
49
49
|
}, [])
|
|
50
50
|
reportData: null,
|
|
51
51
|
trackCallback: null,
|
|
52
52
|
type: TrackType.point,
|
|
53
53
|
markPoint: false
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
//坑位曝光
|
|
3
|
+
.d-report-point {
|
|
4
|
+
position: absolute;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
opacity: 0;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
z-index: -1;
|
|
12
|
+
}
|
|
13
|
+
//楼层曝光
|
|
14
|
+
.d-report-floor {
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
right: 0;
|
|
19
|
+
height: 1px;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
z-index: -1;
|
|
11
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
2
2
|
const { type, className, reportData, trackCallback } = props
|
|
3
3
|
const checkReportData = Array.isArray(reportData)
|
|
4
4
|
const [floorData, mInfo] = checkReportData ? reportData : []
|
|
5
5
|
const getFloorPointClassName = `J_floor_${floorData?.uid}_index_${mInfo?.pos}`
|
|
6
6
|
if (
|
|
7
7
|
!taroJdBaseInfo.info.pageInfo.floorExposureInfo[
|
|
8
8
|
getFloorPointClassName
|
|
9
9
|
]
|
|
10
10
|
){
|
|
11
11
|
const createIntersectionObserver = new intersectionObserver({
|
|
12
12
|
selector: `#J_floor_${floorData?.uid} >>> .${getFloorPointClassName}`,
|
|
13
13
|
context: this,
|
|
14
14
|
onFinal: (res) => {
|
|
15
15
|
taroJdBaseInfo.info.pageInfo.floorExposureInfo[
|
|
16
16
|
getFloorPointClassName
|
|
17
17
|
] = true
|
|
18
18
|
console.log('小程序曝光埋点收到进入可视区域啦!', getFloorPointClassName, reportData, res)
|
|
19
19
|
addReportData(reportData)
|
|
20
20
|
typeof trackCallback === 'function' && trackCallback(reportData)
|
|
21
21
|
createIntersectionObserver.disconnect()
|
|
22
22
|
},
|
|
23
23
|
})
|
|
24
24
|
createIntersectionObserver.connect()
|
|
25
25
|
}
|
|
26
26
|
floorData &&
|
|
27
27
|
mInfo && (
|
|
28
28
|
{
|
|
29
29
|
[exposureStyle['d-report-point']]: type === TrackType.point,
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
[exposureStyle['d-report-floor']]: type === TrackType.floor,
|
|
33
33
|
},
|
|
34
34
|
getFloorPointClassName,
|
|
35
35
|
reportData: null,
|
|
36
36
|
trackCallback: null,
|
|
37
37
|
type: TrackType.point,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import track from '../../../open/api/track'
|
|
2
1
|
const {arr : arrTask, startWaitTime} = floorTask
|
|
3
2
|
const isTimeout = startWaitTime != 0 && (Date.now() - startWaitTime >= 1000)
|
|
4
3
|
const isOverMax = arrTask.length >= 10
|
|
5
4
|
const hasData = arrTask.length > 0
|
|
6
5
|
if(hasData && (isTimeout || isOverMax)){
|
|
7
6
|
const reduceData = connactData(arrTask)
|
|
8
7
|
track.reportExposureEventLog(reduceData)
|
|
9
8
|
floorTask.arr = []
|
|
10
9
|
floorTask.startWaitTime = 0
|
|
11
10
|
clearTimeout(floorTask.timer)
|
|
12
11
|
}
|
|
13
12
|
const initData = JSON.parse(JSON.stringify(arr[0]))
|
|
14
13
|
if(initData.jsonParam.etModelInfo) {
|
|
15
14
|
initData.jsonParam.logBaseInfo = []
|
|
16
15
|
initData.jsonParam.etModelInfo.lstms = []
|
|
17
16
|
return arr.reduce((acc, cur) => {
|
|
18
17
|
acc.jsonParam.logBaseInfo.push(cur.jsonParam.logBaseInfo)
|
|
19
18
|
return acc
|
|
20
19
|
}, initData)
|
|
21
20
|
} else {
|
|
22
21
|
return arr.reduce((acc) => {
|
|
23
22
|
return acc
|
|
24
23
|
})
|
|
25
24
|
}
|
|
26
25
|
if(!Array.isArray(data)){
|
|
27
26
|
console.log('坑位曝光埋点原始数据参类型错误,期望是数组,实际是:', data)
|
|
28
27
|
return
|
|
29
28
|
}
|
|
30
29
|
const [floorData, mInfo, etModelInfo] = data
|
|
31
30
|
if(floorData && mInfo && etModelInfo){
|
|
32
31
|
try {
|
|
33
32
|
const reportJson = track.getIsvExposureInfo(floorData, mInfo, etModelInfo)
|
|
34
33
|
console.log('reportJson',reportJson)
|
|
35
34
|
const { floorIdx } = floorData
|
|
36
35
|
if(!task[floorIdx]){
|
|
37
36
|
task[floorIdx] = {
|
|
38
37
|
arr: [],
|
|
39
38
|
startWaitTime: 0,
|
|
40
39
|
timer : 0
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
const floorTask = task[floorIdx]
|
|
44
43
|
if(floorTask.arr.length === 0){
|
|
45
44
|
floorTask.startWaitTime = Date.now()
|
|
46
45
|
}
|
|
47
46
|
if(reportJson){
|
|
48
47
|
floorTask.arr.push(reportJson)
|
|
49
48
|
clearTimeout(floorTask.timer)
|
|
50
49
|
floorTask.timer = setTimeout(() => {
|
|
51
50
|
check(floorTask)
|
|
52
51
|
}, 1000)
|
|
53
52
|
check(floorTask)
|
|
54
53
|
}
|
|
55
54
|
}catch (e) {
|
|
56
55
|
{
|
|
57
56
|
console.log('坑位曝光埋点出错啦',e)
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
}else{
|
|
61
60
|
console.log('坑位曝光埋点原始数据参数缺失,期望是[floorData, mInfo, etModelInfo],实际是:', data)
|
|
62
61
|
}
|
|
62
|
+
import track from '../../../open/api/track'
|
|
63
63
|
const {arr : arrTask, startWaitTime} = floorTask
|
|
64
64
|
const isTimeout = startWaitTime != 0 && (Date.now() - startWaitTime >= 1000)
|
|
65
65
|
const arrTaskNum = arrTask.length;
|
|
66
66
|
const isOverMax = arrTaskNum >= 10
|
|
67
67
|
const hasData = arrTaskNum > 0
|
|
68
68
|
if(hasData && (isTimeout || isOverMax)){
|
|
69
69
|
const reduceData = connactData(arrTask)
|
|
70
70
|
track.reportExposureEventLog(reduceData)
|
|
71
71
|
floorTask.arr = []
|
|
72
72
|
floorTask.startWaitTime = 0
|
|
73
73
|
clearTimeout(floorTask.timer)
|
|
74
74
|
}
|
|
75
75
|
const initData = JSON.parse(JSON.stringify(arr[0]))
|
|
76
76
|
if(initData.jsonParam.etModelInfo) {
|
|
77
77
|
initData.jsonParam.logBaseInfo = []
|
|
78
78
|
initData.jsonParam.etModelInfo.lstms = []
|
|
79
79
|
return arr.reduce((acc, cur) => {
|
|
80
80
|
acc.jsonParam.logBaseInfo.push(cur.jsonParam.logBaseInfo)
|
|
81
81
|
return acc
|
|
82
82
|
}, initData)
|
|
83
83
|
} else {
|
|
84
84
|
return arr.reduce((acc) => {
|
|
85
85
|
return acc
|
|
86
86
|
})
|
|
87
87
|
}
|
|
88
88
|
if(!Array.isArray(data)){
|
|
89
89
|
console.log('坑位曝光埋点原始数据参类型错误,期望是数组,实际是:', data)
|
|
90
90
|
return
|
|
91
91
|
}
|
|
92
92
|
const [floorData, mInfo, etModelInfo] = data
|
|
93
93
|
if(floorData && mInfo && etModelInfo){
|
|
94
94
|
const isIsvReportModule = isvReportModuleTypeList.includes(floorData?.floorExtInfo?.moduleFlag)
|
|
95
95
|
try {
|
|
96
96
|
const reportJson = track.getExposureInfo(floorData, mInfo, etModelInfo,true, isIsvReportModule)
|
|
97
97
|
console.log(`${floorData?.floorExtInfo?.moduleFlag}===reportJson===`,reportJson)
|
|
98
98
|
const { floorIdx } = floorData
|
|
99
99
|
if(!task[floorIdx]){
|
|
100
100
|
task[floorIdx] = {
|
|
101
101
|
arr: [],
|
|
102
102
|
startWaitTime: 0,
|
|
103
103
|
timer : 0
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
const floorTask = task[floorIdx]
|
|
107
107
|
if(floorTask.arr.length === 0){
|
|
108
108
|
floorTask.startWaitTime = Date.now()
|
|
109
109
|
}
|
|
110
110
|
if(reportJson){
|
|
111
111
|
floorTask.arr.push(reportJson)
|
|
112
112
|
clearTimeout(floorTask.timer)
|
|
113
113
|
floorTask.timer = setTimeout(() => {
|
|
114
114
|
check(floorTask)
|
|
115
115
|
}, 1000)
|
|
116
116
|
check(floorTask)
|
|
117
117
|
}
|
|
118
118
|
}catch (e) {
|
|
119
119
|
{
|
|
120
120
|
console.log('坑位曝光埋点出错啦',e)
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}else{
|
|
124
124
|
console.log('坑位曝光埋点原始数据参数缺失,期望是[floorData, mInfo, etModelInfo],实际是:', data)
|
|
125
125
|
}
|
|
@@ -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
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
34
33
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
35
34
|
if (componentLazyRef.current) {
|
|
36
35
|
const eleClientRect =
|
|
37
36
|
componentLazyRef.current.getBoundingClientRect()
|
|
38
37
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
39
38
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
40
39
|
if (!componentShowStateRef.current) {
|
|
41
40
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
42
41
|
componentShowStateRef.current = true
|
|
43
42
|
setComponentShowState(true)
|
|
44
43
|
Taro.nextTick(() => {
|
|
45
44
|
setComponentRenderShowState(true)
|
|
46
45
|
})
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
return (
|
|
52
51
|
<View
|
|
53
52
|
ref={componentLazyRef}
|
|
54
53
|
className={classNames(
|
|
55
54
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
56
55
|
'd-app-floor-lazy-load',
|
|
57
56
|
className
|
|
58
57
|
)}
|
|
59
58
|
style={{
|
|
60
59
|
minHeight: `${componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
|
|
61
60
|
}`,
|
|
62
61
|
backgroundColor: componentRenderShowState
|
|
63
62
|
? 'transparent'
|
|
64
63
|
: '#ffffff',
|
|
65
64
|
}}
|
|
66
65
|
>
|
|
67
66
|
{componentShowState ? children : placeholder}
|
|
68
67
|
</View>
|
|
69
68
|
)
|
|
70
69
|
}else {
|
|
71
70
|
const { ref, inView } = useInView({
|
|
72
71
|
threshold: 0,
|
|
73
72
|
triggerOnce: true,
|
|
74
73
|
root: rootDom || null,
|
|
75
74
|
rootMargin: `0px 0px 0px 0px`,
|
|
76
75
|
})
|
|
77
76
|
useEffect(() => {
|
|
78
77
|
if (inView) {
|
|
79
78
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
80
79
|
console.log('InViewRender -- 其它H5 展示啦!')
|
|
81
80
|
}
|
|
82
81
|
}, [inView])
|
|
83
82
|
return (
|
|
84
83
|
<View
|
|
85
84
|
className={className}
|
|
86
85
|
ref={ref}
|
|
87
86
|
style={{
|
|
88
87
|
minHeight: inView ? 'auto' : typeof height === 'number' ? `${height}px` : height,
|
|
89
88
|
backgroundColor: 'transparent',
|
|
90
89
|
}}
|
|
91
90
|
>
|
|
92
91
|
{inView ? children : placeholder}
|
|
93
92
|
</View>
|
|
94
93
|
)
|
|
95
94
|
}
|
|
96
95
|
children: null,
|
|
97
96
|
placeholder: null,
|
|
98
97
|
height: 1,
|
|
99
98
|
className: '',
|
|
100
99
|
lazyNodeClassName: '',
|
|
101
100
|
inViewCallback: null,
|
|
101
|
+
import Taro from '@tarojs/taro'
|
|
102
102
|
TaroEventType,
|
|
103
103
|
const {
|
|
104
104
|
children,
|
|
105
105
|
placeholder,
|
|
106
106
|
height,
|
|
107
107
|
className,
|
|
108
108
|
inViewCallback
|
|
109
109
|
} = props
|
|
110
110
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
111
111
|
const [componentRenderShowState, setComponentRenderShowState] =
|
|
112
112
|
useState(false)
|
|
113
113
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
114
114
|
const componentShowStateRef = useRef(false)
|
|
115
115
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
116
116
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
|
|
117
117
|
if (isH5AndJdShopView && !needShowHighVersion) {
|
|
118
118
|
useEffect(() => {
|
|
119
119
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
120
120
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
121
121
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
122
122
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
123
123
|
})
|
|
124
124
|
}, [])
|
|
125
125
|
useEffect(() => {
|
|
126
126
|
if (componentShowState) {
|
|
127
127
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
128
128
|
console.log('InViewRender -- 店铺H5 展示啦!')
|
|
129
129
|
}
|
|
130
130
|
}, [componentShowState])
|
|
131
131
|
|
|
132
132
|
const dealPageScrollInfo = (res) => {
|
|
133
133
|
console.log(
|
|
134
134
|
'收到滚动信息和模块元素以及容器显示状态',
|
|
135
135
|
res,
|
|
136
136
|
typeof componentLazyRef.current,
|
|
137
137
|
componentShowStateRef.current,
|
|
138
138
|
)
|
|
139
139
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
140
140
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
141
141
|
if (componentLazyRef.current) {
|
|
142
142
|
const eleClientRect =
|
|
143
143
|
componentLazyRef.current.getBoundingClientRect()
|
|
144
144
|
const getContainerHeightOffSetY = displayHeight + offSetY
|
|
145
145
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
146
146
|
if (!componentShowStateRef.current) {
|
|
147
147
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
148
148
|
componentShowStateRef.current = true
|
|
149
149
|
setComponentShowState(true)
|
|
150
150
|
Taro.nextTick(() => {
|
|
151
151
|
setComponentRenderShowState(true)
|
|
152
152
|
})
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
return (
|
|
158
158
|
<View
|
|
159
159
|
ref={componentLazyRef}
|
|
160
160
|
className={classNames(
|
|
161
161
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
162
162
|
'd-app-floor-lazy-load',
|
|
163
163
|
className
|
|
164
164
|
)}
|
|
165
165
|
style={{
|
|
166
166
|
minHeight: `${componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
|
|
167
167
|
}`,
|
|
168
168
|
backgroundColor: componentRenderShowState
|
|
169
169
|
? 'transparent'
|
|
170
170
|
: '#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
|
console.log('InViewRender -- 其它H5 展示啦!')
|
|
188
188
|
}
|
|
189
189
|
}, [inView])
|
|
190
190
|
return (
|
|
191
191
|
<View
|
|
192
192
|
className={className}
|
|
193
193
|
ref={ref}
|
|
194
194
|
style={{
|
|
195
195
|
minHeight: inView ? 'auto' : typeof height === 'number' ? `${height}px` : height,
|
|
196
196
|
backgroundColor: 'transparent',
|
|
197
197
|
}}
|
|
198
198
|
>
|
|
199
199
|
{inView ? children : placeholder}
|
|
200
200
|
</View>
|
|
201
201
|
)
|
|
202
202
|
}
|
|
203
203
|
children: null,
|
|
204
204
|
placeholder: null,
|
|
205
205
|
height: 1,
|
|
206
206
|
className: '',
|
|
207
207
|
lazyNodeClassName: '',
|
|
208
208
|
inViewCallback: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
const { className, pointClassName, children, reportData, trackCallback, ...otherProps } =
|
|
1
3
|
props
|
|
2
4
|
const [floorData, mInfo] = reportData
|
|
3
5
|
const checkReportDataState = floorData && mInfo
|
|
4
6
|
|
|
5
7
|
checkReportDataState && !mInfo.hasOwnProperty('pos') && (mInfo.pos = 0)
|
|
6
8
|
return (
|
|
7
9
|
<View
|
|
8
10
|
ref={ref}
|
|
9
11
|
className={classNames(
|
|
10
12
|
itemViewExposureSmartStyle['d-item-point-layout'],
|
|
11
13
|
className,
|
|
12
14
|
)}
|
|
13
15
|
{...otherProps}
|
|
14
16
|
>
|
|
15
17
|
{children ? children : null}
|
|
16
18
|
{checkReportDataState && (
|
|
17
19
|
<ExposureSmart
|
|
18
20
|
className={classNames(pointClassName,{
|
|
19
21
|
[itemViewExposureSmartStyle['d-item-chart-point']]: isChartH5,
|
|
20
22
|
})}
|
|
21
23
|
reportData={reportData}
|
|
22
24
|
trackCallback={trackCallback}
|
|
23
25
|
markPoint
|
|
24
26
|
/>
|
|
25
27
|
)}
|
|
26
28
|
</View>
|
|
27
29
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro, { useRouter } from '@tarojs/taro'
|
|
2
1
|
floorData = {},
|
|
3
2
|
const 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
|
floorData = {},
|
|
37
37
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
38
38
|
const rootDom = isH5AndJdShopView && needShowHighVersion ? null : document.querySelector('#J_shopHomeRoot')
|
|
39
39
|
root: rootDom,
|
|
40
40
|
rootMargin: `0px 0px ${window.innerHeight}px 0px`,
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
if(needShowHighVersion) return
|
|
43
43
|
if (type === LazyType.FLOOR) {
|
|
44
44
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
45
45
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
46
46
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
47
47
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
48
48
|
})
|
|
49
49
|
}
|
|
50
50
|
}, [])
|
|
51
51
|
useEffect(() => {
|
|
52
52
|
if((!needShowHighVersion && componentShowState === true) ||
|
|
53
53
|
(needShowHighVersion && inView && isH5AndJdShopView)
|
|
54
54
|
) {
|
|
55
55
|
console.log('>>>>>>>>>>>>>>>>>>> 楼层【id=' + containerId + '】已经渲染!')
|
|
56
56
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
57
57
|
nativePageRegisterMessage(
|
|
58
58
|
Message_Type.NATIVE_INJECT_JS_FILE,
|
|
59
59
|
{
|
|
60
60
|
data: {
|
|
61
61
|
"bundleUrl": [bundleUrl]
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
)
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}, [componentShowState,inView])
|
|
68
68
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
69
69
|
ref={ref}
|