@conecli/cone-render 0.9.1-shop2.3 → 0.9.1-shop2.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/common/const.ts +1 -1
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/common/jssdk.ts +1 -0
- package/dist/common/pageType.ts +1 -0
- package/dist/common/token/index.h5.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/components/base/CustomScrollView/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/InViewRender/index.tsx +1 -1
- package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
- package/dist/components/base/LazyLoadImage/const.ts +1 -1
- 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/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/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/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.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.wxapp.ts +1 -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/track.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- 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/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/utils.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
2
1
|
const { type, className, reportData, trackCallback, markPoint } = props
|
|
3
2
|
const isViewOnlineState =
|
|
4
3
|
taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
|
|
5
4
|
const inViewCallback = () => {
|
|
6
5
|
console.log('埋点收到进入可视区域的回到啦!', reportData)
|
|
7
6
|
addReportData(reportData)
|
|
8
7
|
typeof trackCallback === 'function' && trackCallback(reportData)
|
|
9
8
|
}
|
|
10
9
|
let chartPointClassName = ""
|
|
11
10
|
|
|
12
11
|
if(isChartH5 && markPoint && Array.isArray(reportData)){
|
|
13
12
|
const [floorData, mInfo] = reportData
|
|
14
13
|
if(floorData && mInfo && mInfo.hasOwnProperty('pos') ){
|
|
15
14
|
chartPointClassName = track.getFloorPointIndexClassName(floorData, mInfo.pos)
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
return isViewOnlineState && reportData
|
|
19
18
|
? <InViewRender className={classNames(
|
|
20
19
|
{
|
|
21
20
|
[exposureStyle['d-report-point']]: type === TrackType.point,
|
|
22
21
|
},
|
|
23
22
|
{
|
|
24
23
|
[exposureStyle['d-report-floor']]: type === TrackType.floor,
|
|
25
24
|
},
|
|
26
25
|
className,
|
|
27
26
|
chartPointClassName
|
|
28
27
|
)} height={'100%'} inViewCallback={inViewCallback}></InViewRender>
|
|
29
28
|
: null
|
|
30
29
|
return useMemo(() => {
|
|
31
30
|
return <Exposure {...props} />
|
|
32
31
|
}, [])
|
|
33
32
|
reportData: null,
|
|
34
33
|
trackCallback: null,
|
|
35
34
|
type: TrackType.point,
|
|
36
35
|
markPoint: false
|
|
36
|
+
import React, { useMemo } from 'react'
|
|
37
37
|
const { type, className, reportData, customReportDataKey, customReportDataFn, trackCallback, markPoint } = props
|
|
38
38
|
const isCustomReport = customReportDataKey && customReportDataFn
|
|
39
39
|
const isViewOnlineState =
|
|
40
40
|
taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
|
|
41
41
|
const showRenderState = isCustomReport ? true : reportData
|
|
42
42
|
const inViewCallback = () => {
|
|
43
43
|
console.log('埋点收到进入可视区域的回调啦!', reportData)
|
|
44
44
|
if(!isCustomReport){
|
|
45
45
|
addReportData(reportData)
|
|
46
46
|
typeof trackCallback === 'function' && trackCallback(reportData)
|
|
47
47
|
}else {
|
|
48
48
|
typeof customReportDataFn === 'function' && customReportDataFn(customReportDataKey)
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
let chartPointClassName = ""
|
|
52
52
|
|
|
53
53
|
if(isChartH5 && markPoint && Array.isArray(reportData)){
|
|
54
54
|
const [floorData, mInfo] = reportData
|
|
55
55
|
if(floorData && mInfo && mInfo.hasOwnProperty('pos') ){
|
|
56
56
|
chartPointClassName = track.getFloorPointIndexClassName(floorData, mInfo.pos)
|
|
57
57
|
}
|
|
58
58
|
}else if(isCustomReport){
|
|
59
59
|
chartPointClassName = `J_custom_${customReportDataKey}`
|
|
60
60
|
}
|
|
61
61
|
return isViewOnlineState && showRenderState
|
|
62
62
|
? <InViewRender className={classNames(
|
|
63
63
|
{
|
|
64
64
|
[exposureStyle['d-report-point']]: type === TrackType.point,
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
[exposureStyle['d-report-floor']]: type === TrackType.floor,
|
|
68
68
|
},
|
|
69
69
|
className,
|
|
70
70
|
chartPointClassName
|
|
71
71
|
)} height={'100%'} inViewCallback={inViewCallback}></InViewRender>
|
|
72
72
|
: null
|
|
73
73
|
return useMemo(() => {
|
|
74
74
|
return <Exposure {...props} />
|
|
75
75
|
}, [])
|
|
76
76
|
reportData: null,
|
|
77
77
|
trackCallback: null,
|
|
78
78
|
type: TrackType.point,
|
|
79
79
|
markPoint: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
const { type, className, reportData, trackCallback } = props
|
|
3
2
|
const checkReportData = Array.isArray(reportData)
|
|
4
3
|
const [floorData, mInfo] = checkReportData ? reportData : []
|
|
5
4
|
const getFloorPointClassName = `J_floor_${floorData?.uid}_index_${mInfo?.pos}`
|
|
6
5
|
if (
|
|
7
6
|
!taroJdBaseInfo.info.pageInfo.floorExposureInfo[
|
|
8
7
|
getFloorPointClassName
|
|
9
8
|
]
|
|
10
9
|
){
|
|
11
10
|
const createIntersectionObserver = new intersectionObserver({
|
|
12
11
|
selector: `#J_floor_${floorData?.uid} >>> .${getFloorPointClassName}`,
|
|
13
12
|
context: this,
|
|
14
13
|
onFinal: (res) => {
|
|
15
14
|
taroJdBaseInfo.info.pageInfo.floorExposureInfo[
|
|
16
15
|
getFloorPointClassName
|
|
17
16
|
] = true
|
|
18
17
|
console.log('小程序曝光埋点收到进入可视区域啦!', getFloorPointClassName, reportData, res)
|
|
19
18
|
addReportData(reportData)
|
|
20
19
|
typeof trackCallback === 'function' && trackCallback(reportData)
|
|
21
20
|
createIntersectionObserver.disconnect()
|
|
22
21
|
},
|
|
23
22
|
})
|
|
24
23
|
createIntersectionObserver.connect()
|
|
25
24
|
}
|
|
26
25
|
floorData &&
|
|
27
26
|
mInfo && (
|
|
28
27
|
{
|
|
29
28
|
[exposureStyle['d-report-point']]: type === TrackType.point,
|
|
30
29
|
},
|
|
31
30
|
{
|
|
32
31
|
[exposureStyle['d-report-floor']]: type === TrackType.floor,
|
|
33
32
|
},
|
|
34
33
|
getFloorPointClassName,
|
|
35
34
|
reportData: null,
|
|
36
35
|
trackCallback: null,
|
|
37
36
|
type: TrackType.point,
|
|
37
|
+
import Taro from '@tarojs/taro'
|
|
38
38
|
const { type, className, reportData, customReportDataKey, customReportDataFn, trackCallback } = props
|
|
39
39
|
const isCustomReport = customReportDataKey && customReportDataFn
|
|
40
40
|
const checkReportData = Array.isArray(reportData)
|
|
41
41
|
const [floorData, mInfo] = checkReportData ? reportData : []
|
|
42
42
|
const showRenderState = isCustomReport ? true : floorData && mInfo
|
|
43
43
|
const getFloorPointClassName = isCustomReport ? `J_custom_${customReportDataKey}` : `J_floor_${floorData?.uid}_index_${mInfo?.pos}`
|
|
44
44
|
useEffect(() => {
|
|
45
45
|
if (
|
|
46
46
|
!taroJdBaseInfo.info.pageInfo.floorExposureInfo[
|
|
47
47
|
getFloorPointClassName
|
|
48
48
|
]
|
|
49
49
|
){
|
|
50
50
|
const createIntersectionObserver = new intersectionObserver({
|
|
51
51
|
selector: getTaroSelector,
|
|
52
52
|
context: this,
|
|
53
53
|
onFinal: (res) => {
|
|
54
54
|
taroJdBaseInfo.info.pageInfo.floorExposureInfo[
|
|
55
55
|
getFloorPointClassName
|
|
56
56
|
] = true
|
|
57
57
|
console.log('小程序曝光埋点收到进入可视区域啦!', getFloorPointClassName, reportData, res)
|
|
58
58
|
if(!isCustomReport){
|
|
59
59
|
addReportData(reportData)
|
|
60
60
|
typeof trackCallback === 'function' && trackCallback(reportData)
|
|
61
61
|
}else {
|
|
62
62
|
typeof customReportDataFn === 'function' && customReportDataFn(customReportDataKey)
|
|
63
63
|
}
|
|
64
64
|
createIntersectionObserver.disconnect()
|
|
65
65
|
},
|
|
66
66
|
})
|
|
67
67
|
createIntersectionObserver.connect()
|
|
68
68
|
}
|
|
69
69
|
{
|
|
70
70
|
[exposureStyle['d-report-point']]: type === TrackType.point,
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
73
|
[exposureStyle['d-report-floor']]: type === TrackType.floor,
|
|
74
74
|
},
|
|
75
75
|
getFloorPointClassName,
|
|
76
76
|
reportData: null,
|
|
77
77
|
trackCallback: null,
|
|
78
78
|
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 arrTaskNum = arrTask.length;
|
|
5
4
|
const isOverMax = arrTaskNum >= 10
|
|
6
5
|
const hasData = arrTaskNum > 0
|
|
7
6
|
if(hasData && (isTimeout || isOverMax)){
|
|
8
7
|
const reduceData = connactData(arrTask)
|
|
9
8
|
track.reportExposureEventLog(reduceData)
|
|
10
9
|
floorTask.arr = []
|
|
11
10
|
floorTask.startWaitTime = 0
|
|
12
11
|
clearTimeout(floorTask.timer)
|
|
13
12
|
}
|
|
14
13
|
const initData = JSON.parse(JSON.stringify(arr[0]))
|
|
15
14
|
if(initData.jsonParam.etModelInfo) {
|
|
16
15
|
initData.jsonParam.logBaseInfo = []
|
|
17
16
|
initData.jsonParam.etModelInfo.lstms = []
|
|
18
17
|
return arr.reduce((acc, cur) => {
|
|
19
18
|
acc.jsonParam.logBaseInfo.push(cur.jsonParam.logBaseInfo)
|
|
20
19
|
return acc
|
|
21
20
|
}, initData)
|
|
22
21
|
} else {
|
|
23
22
|
return arr.reduce((acc) => {
|
|
24
23
|
return acc
|
|
25
24
|
})
|
|
26
25
|
}
|
|
27
26
|
if(!Array.isArray(data)){
|
|
28
27
|
console.log('坑位曝光埋点原始数据参类型错误,期望是数组,实际是:', data)
|
|
29
28
|
return
|
|
30
29
|
}
|
|
31
30
|
const [floorData, mInfo, etModelInfo] = data
|
|
32
31
|
if(floorData && mInfo && etModelInfo){
|
|
33
32
|
const isIsvReportModule = isvReportModuleTypeList.includes(floorData?.floorExtInfo?.moduleFlag)
|
|
34
33
|
try {
|
|
35
34
|
const reportJson = track.getExposureInfo(floorData, mInfo, etModelInfo,true, isIsvReportModule)
|
|
36
35
|
console.log(`${floorData?.floorExtInfo?.moduleFlag}===reportJson===`,reportJson)
|
|
37
36
|
const { floorIdx } = floorData
|
|
38
37
|
if(!task[floorIdx]){
|
|
39
38
|
task[floorIdx] = {
|
|
40
39
|
arr: [],
|
|
41
40
|
startWaitTime: 0,
|
|
42
41
|
timer : 0
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
const floorTask = task[floorIdx]
|
|
46
45
|
if(floorTask.arr.length === 0){
|
|
47
46
|
floorTask.startWaitTime = Date.now()
|
|
48
47
|
}
|
|
49
48
|
if(reportJson){
|
|
50
49
|
floorTask.arr.push(reportJson)
|
|
51
50
|
clearTimeout(floorTask.timer)
|
|
52
51
|
floorTask.timer = setTimeout(() => {
|
|
53
52
|
check(floorTask)
|
|
54
53
|
}, 1000)
|
|
55
54
|
check(floorTask)
|
|
56
55
|
}
|
|
57
56
|
}catch (e) {
|
|
58
57
|
{
|
|
59
58
|
console.log('坑位曝光埋点出错啦',e)
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
}else{
|
|
63
62
|
console.log('坑位曝光埋点原始数据参数缺失,期望是[floorData, mInfo, etModelInfo],实际是:', data)
|
|
64
63
|
}
|
|
64
|
+
import track from '../../../open/api/track'
|
|
65
65
|
const {arr : arrTask, startWaitTime} = floorTask
|
|
66
66
|
const isTimeout = startWaitTime != 0 && (Date.now() - startWaitTime >= 1000)
|
|
67
67
|
const arrTaskNum = arrTask.length;
|
|
68
68
|
const isOverMax = arrTaskNum >= 10
|
|
69
69
|
const hasData = arrTaskNum > 0
|
|
70
70
|
if(hasData && (isTimeout || isOverMax)){
|
|
71
71
|
const reduceData = connactData(arrTask)
|
|
72
72
|
track.reportExposureEventLog(reduceData)
|
|
73
73
|
floorTask.arr = []
|
|
74
74
|
floorTask.startWaitTime = 0
|
|
75
75
|
clearTimeout(floorTask.timer)
|
|
76
76
|
}
|
|
77
77
|
const initData = JSON.parse(JSON.stringify(arr[0]))
|
|
78
78
|
if(initData.jsonParam.etModelInfo) {
|
|
79
79
|
initData.jsonParam.logBaseInfo = []
|
|
80
80
|
initData.jsonParam.etModelInfo.lstms = []
|
|
81
81
|
return arr.reduce((acc, cur) => {
|
|
82
82
|
acc.jsonParam.logBaseInfo.push(cur.jsonParam.logBaseInfo)
|
|
83
83
|
return acc
|
|
84
84
|
}, initData)
|
|
85
85
|
} else {
|
|
86
86
|
return arr.reduce((acc) => {
|
|
87
87
|
return acc
|
|
88
88
|
})
|
|
89
89
|
}
|
|
90
90
|
if(!Array.isArray(data)){
|
|
91
91
|
console.log('坑位曝光埋点原始数据参类型错误,期望是数组,实际是:', data)
|
|
92
92
|
return
|
|
93
93
|
}
|
|
94
94
|
const [floorData, mInfo, etModelInfo] = data
|
|
95
95
|
if(floorData && mInfo && etModelInfo){
|
|
96
96
|
const isIsvReportModule = isvReportModuleTypeList.includes(floorData?.floorExtInfo?.moduleFlag)
|
|
97
97
|
try {
|
|
98
98
|
const reportJson = track.getExposureInfo(floorData, mInfo, etModelInfo,true, isIsvReportModule)
|
|
99
99
|
console.log(`${floorData?.floorExtInfo?.moduleFlag}===reportJson===`,reportJson)
|
|
100
100
|
const { floorIdx } = floorData
|
|
101
101
|
if(!task[floorIdx]){
|
|
102
102
|
task[floorIdx] = {
|
|
103
103
|
arr: [],
|
|
104
104
|
startWaitTime: 0,
|
|
105
105
|
timer : 0
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
const floorTask = task[floorIdx]
|
|
109
109
|
if(floorTask.arr.length === 0){
|
|
110
110
|
floorTask.startWaitTime = Date.now()
|
|
111
111
|
}
|
|
112
112
|
if(reportJson){
|
|
113
113
|
floorTask.arr.push(reportJson)
|
|
114
114
|
clearTimeout(floorTask.timer)
|
|
115
115
|
floorTask.timer = setTimeout(() => {
|
|
116
116
|
check(floorTask)
|
|
117
117
|
}, 1000)
|
|
118
118
|
check(floorTask)
|
|
119
119
|
}
|
|
120
120
|
}catch (e) {
|
|
121
121
|
{
|
|
122
122
|
console.log('坑位曝光埋点出错啦',e)
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
}else{
|
|
126
126
|
console.log('坑位曝光埋点原始数据参数缺失,期望是[floorData, mInfo, etModelInfo],实际是:', data)
|
|
127
127
|
}
|
|
@@ -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) {
|
|
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
|
-
export const NetWorkTypeQuality = {
|
|
1
|
+
export const NetWorkTypeQuality = {
|