@conecli/cone-render 0.10.1-beta.6 → 0.10.1-beta.8
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/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/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/base/CommonFloorHead/index.module.scss +126 -111
- package/dist/components/base/CommonFloorHead/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/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/InViewRender/index.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/debug/DebugLayout/index.module.scss +2 -2
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/interface/common.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.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.wxapp.ts +1 -1
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -53
- 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/shopMember.ts +1 -1
- package/dist/open/api/util.ts +1 -1
- package/dist/sass/app.h5.scss +273 -224
- 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 -1
- package/dist/service/requestServer.h5.ts +1 -1
- 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/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/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 -141
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
2
1
|
const { type, className, reportData, customReportDataKey, customReportDataFn, trackCallback, markPoint } = props
|
|
3
2
|
const isCustomReport = customReportDataKey && customReportDataFn
|
|
4
3
|
const isViewOnlineState =
|
|
5
4
|
taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE
|
|
6
5
|
const showRenderState = isCustomReport ? true : reportData
|
|
7
6
|
const inViewCallback = () => {
|
|
8
7
|
console.log('埋点收到进入可视区域的回调啦!', reportData)
|
|
9
8
|
if(!isCustomReport){
|
|
10
9
|
addReportData(reportData)
|
|
11
10
|
typeof trackCallback === 'function' && trackCallback(reportData)
|
|
12
11
|
}else {
|
|
13
12
|
typeof customReportDataFn === 'function' && customReportDataFn(customReportDataKey)
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
let chartPointClassName = ""
|
|
17
16
|
|
|
18
17
|
if(isChartH5 && markPoint && Array.isArray(reportData)){
|
|
19
18
|
const [floorData, mInfo] = reportData
|
|
20
19
|
if(floorData && mInfo && mInfo.hasOwnProperty('pos') ){
|
|
21
20
|
chartPointClassName = track.getFloorPointIndexClassName(floorData, mInfo.pos)
|
|
22
21
|
}
|
|
23
22
|
}else if(isCustomReport){
|
|
24
23
|
chartPointClassName = `J_custom_${customReportDataKey}`
|
|
25
24
|
}
|
|
26
25
|
return isViewOnlineState && showRenderState
|
|
27
26
|
? <InViewRender className={classNames(
|
|
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
|
className,
|
|
35
34
|
chartPointClassName
|
|
36
35
|
)} height={'100%'} inViewCallback={inViewCallback}></InViewRender>
|
|
37
36
|
: null
|
|
38
37
|
return useMemo(() => {
|
|
39
38
|
return <Exposure {...props} />
|
|
40
39
|
}, [])
|
|
41
40
|
reportData: null,
|
|
42
41
|
trackCallback: null,
|
|
43
42
|
type: TrackType.point,
|
|
44
43
|
markPoint: false
|
|
44
|
+
import React, { useMemo } from 'react';
|
|
45
45
|
const {
|
|
46
46
|
type,
|
|
47
47
|
className,
|
|
48
48
|
reportData,
|
|
49
49
|
customReportDataKey,
|
|
50
50
|
customReportDataFn,
|
|
51
51
|
trackCallback,
|
|
52
52
|
markPoint,
|
|
53
53
|
innerRef,
|
|
54
54
|
} = props;
|
|
55
55
|
const isCustomReport = customReportDataKey && customReportDataFn;
|
|
56
56
|
const isViewOnlineState = taroJdBaseInfo.info.pageInfo.dataType === BUSINESS_TYPE.ONLINE;
|
|
57
57
|
const showRenderState = isCustomReport ? true : reportData;
|
|
58
58
|
const inViewCallback = () => {
|
|
59
59
|
const getInsertFlowMapEle =
|
|
60
60
|
innerRef?.current?.querySelector('.d-report-exposure-point') || createDefaultFlowMapEle;
|
|
61
61
|
if (!isCustomReport) {
|
|
62
62
|
addReportData(reportData, getInsertFlowMapEle);
|
|
63
63
|
typeof trackCallback === 'function' && trackCallback(reportData);
|
|
64
64
|
} else {
|
|
65
65
|
if (typeof customReportDataFn === 'function') {
|
|
66
66
|
const getReportData = customReportDataFn(customReportDataKey);
|
|
67
67
|
getReportData &&
|
|
68
68
|
getReportData?.eventId &&
|
|
69
69
|
getReportData?.jsonParam &&
|
|
70
70
|
track.reportExposureEventLog({
|
|
71
71
|
...getReportData,
|
|
72
72
|
target: getInsertFlowMapEle,
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
let chartPointClassName = '';
|
|
78
78
|
|
|
79
79
|
if (isChartH5 && markPoint && Array.isArray(reportData)) {
|
|
80
80
|
const [floorData, mInfo] = reportData;
|
|
81
81
|
if (floorData && mInfo && mInfo.hasOwnProperty('pos')) {
|
|
82
82
|
chartPointClassName = track.getFloorPointIndexClassName(floorData, mInfo.pos);
|
|
83
83
|
}
|
|
84
84
|
} else if (isCustomReport) {
|
|
85
85
|
chartPointClassName = `J_custom_${customReportDataKey}`;
|
|
86
86
|
}
|
|
87
87
|
return isViewOnlineState && showRenderState ? (
|
|
88
88
|
<InViewRender
|
|
89
89
|
className={classNames(
|
|
90
90
|
'd-report-exposure-point',
|
|
91
91
|
{
|
|
92
92
|
[exposureStyle['d-report-point']]: type === TrackType.point,
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
[exposureStyle['d-report-floor']]: type === TrackType.floor,
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
'd-report-exposure-jd-point': isJdApp,
|
|
99
99
|
},
|
|
100
100
|
className,
|
|
101
101
|
chartPointClassName,
|
|
102
102
|
)}
|
|
103
103
|
height={'100%'}
|
|
104
104
|
inViewCallback={inViewCallback}
|
|
105
105
|
></InViewRender>
|
|
106
106
|
) : null;
|
|
107
107
|
return useMemo(() => {
|
|
108
108
|
return <Exposure {...props} />;
|
|
109
109
|
}, []);
|
|
110
110
|
reportData: null,
|
|
111
111
|
trackCallback: null,
|
|
112
112
|
type: TrackType.point,
|
|
113
113
|
markPoint: false,
|
|
@@ -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(
|
|
99
99
|
floorData,
|
|
100
100
|
mInfo,
|
|
101
101
|
etModelInfo,
|
|
102
102
|
true,
|
|
103
103
|
isIsvReportModule,
|
|
104
104
|
);
|
|
105
105
|
console.log(`${floorData?.floorExtInfo?.moduleFlag}===reportJson===`, reportJson);
|
|
106
106
|
const { floorIdx } = floorData;
|
|
107
107
|
if (!task[floorIdx]) {
|
|
108
108
|
task[floorIdx] = {
|
|
109
109
|
arr: [],
|
|
110
110
|
startWaitTime: 0,
|
|
111
111
|
timer: 0,
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
const floorTask = task[floorIdx];
|
|
115
115
|
if (floorTask.arr.length === 0) {
|
|
116
116
|
floorTask.startWaitTime = Date.now();
|
|
117
117
|
}
|
|
118
118
|
if (reportJson) {
|
|
119
119
|
floorTask.arr.push(reportJson);
|
|
120
120
|
clearTimeout(floorTask.timer);
|
|
121
121
|
floorTask.timer = setTimeout(() => {
|
|
122
122
|
check(floorTask);
|
|
123
123
|
}, 1000);
|
|
124
124
|
check(floorTask);
|
|
125
125
|
}
|
|
126
126
|
} catch (e) {
|
|
127
127
|
{
|
|
128
128
|
console.log('坑位曝光埋点出错啦', e);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
} else {
|
|
132
132
|
console.log(
|
|
133
133
|
'坑位曝光埋点原始数据参数缺失,期望是[floorData, mInfo, etModelInfo],实际是:',
|
|
134
134
|
data,
|
|
135
135
|
);
|
|
136
136
|
}
|
|
@@ -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 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,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
left: 0;
|
|
7
7
|
right: 0;
|
|
8
8
|
bottom: 0;
|
|
9
|
-
z-index:
|
|
9
|
+
z-index: 9999;
|
|
10
10
|
|
|
11
11
|
.debug-layout {
|
|
12
12
|
position: absolute;
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
.d-info {
|
|
59
59
|
position: relative;
|
|
60
60
|
cursor: pointer;
|
|
61
|
-
z-index:
|
|
61
|
+
z-index: 9999;
|
|
62
62
|
margin: 3PX 3PX;
|
|
63
63
|
width: 22PX;
|
|
64
64
|
height: 22PX;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
const {
|
|
3
2
|
floorData,
|
|
4
3
|
renderSourceType = BUSINESS_TYPE.ONLINE,
|
|
5
4
|
builtInComponents = {},
|
|
6
5
|
updateContainerFloorListDataFn,
|
|
7
6
|
} = props
|
|
8
7
|
const isDevMode = renderSourceType === BUSINESS_TYPE.DECORATE
|
|
9
8
|
const floorModuleType = floorData?.floorExtInfo?.moduleFlag
|
|
10
9
|
const FloorContentItem =
|
|
11
10
|
(floorModuleType && builtInComponents[floorModuleType]) || null
|
|
12
11
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
13
12
|
|
|
14
13
|
const renderDecorateDefaultModule = () => {
|
|
15
14
|
return (
|
|
16
15
|
<View
|
|
17
16
|
style={{
|
|
18
17
|
lineHeight: '120px',
|
|
19
18
|
textAlign: 'center',
|
|
20
19
|
}}
|
|
21
20
|
>
|
|
22
21
|
当前模块是{floorData.moduleName}
|
|
23
22
|
</View>
|
|
24
23
|
)
|
|
25
24
|
}
|
|
26
25
|
return FloorContentItem ? (
|
|
27
26
|
<ErrorBoundary {...props}>
|
|
28
27
|
<FloorContentItem {...props} dataDefines={dataDefines} />
|
|
29
28
|
</ErrorBoundary>
|
|
30
29
|
) : isDevMode ? (
|
|
31
30
|
renderDecorateDefaultModule()
|
|
32
31
|
) : null
|
|
33
32
|
switch (moduleId) {
|
|
34
33
|
case 83158:
|
|
35
34
|
return 'freeLayout'
|
|
36
35
|
case 99654:
|
|
37
36
|
return 'activeText'
|
|
38
37
|
case 100382:
|
|
39
38
|
return 'superGoods'
|
|
40
39
|
}
|
|
41
40
|
floorList.map((item) => {
|
|
42
41
|
if (!item.floorExtInfo) {
|
|
43
42
|
return null
|
|
44
43
|
}
|
|
45
44
|
const moduleFlag = item.floorExtInfo.moduleFlag
|
|
46
45
|
if (!moduleFlag) {
|
|
47
46
|
const newModuleFlag = moduleId2ModuleFlag(item.moduleId)
|
|
48
47
|
if (newModuleFlag) {
|
|
49
48
|
item.floorExtInfo.moduleFlag = newModuleFlag
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
})
|
|
52
|
+
import React from 'react'
|
|
53
53
|
const { floorData, renderSourceType, builtInComponents = {} } = props
|
|
54
54
|
const isDevMode = renderSourceType === BUSINESS_TYPE.DECORATE
|
|
55
55
|
const floorModuleType = floorData?.floorExtInfo?.moduleFlag
|
|
56
56
|
const FloorContentItem =
|
|
57
57
|
(floorModuleType && builtInComponents[floorModuleType]) || null
|
|
58
58
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
59
59
|
|
|
60
60
|
const renderDecorateDefaultModule = () => {
|
|
61
61
|
return (
|
|
62
62
|
<View
|
|
63
63
|
style={{
|
|
64
64
|
lineHeight: '120px',
|
|
65
65
|
textAlign: 'center',
|
|
66
66
|
}}
|
|
67
67
|
>
|
|
68
68
|
当前模块是{floorData.moduleName}
|
|
69
69
|
</View>
|
|
70
70
|
)
|
|
71
71
|
}
|
|
72
72
|
return FloorContentItem ? (
|
|
73
73
|
<ErrorBoundary {...props}>
|
|
74
74
|
<FloorContentItem {...props} dataDefines={dataDefines} />
|
|
75
75
|
</ErrorBoundary>
|
|
76
76
|
) : isDevMode ? (
|
|
77
77
|
renderDecorateDefaultModule()
|
|
78
78
|
) : null
|
|
79
79
|
renderSourceType: BUSINESS_TYPE.ONLINE,
|
|
80
80
|
switch (moduleId) {
|
|
81
81
|
case 83158:
|
|
82
82
|
return 'freeLayout'
|
|
83
83
|
case 99654:
|
|
84
84
|
return 'activeText'
|
|
85
85
|
case 100382:
|
|
86
86
|
return 'superGoods'
|
|
87
87
|
}
|
|
88
88
|
floorList.map((item) => {
|
|
89
89
|
if (!item.floorExtInfo) {
|
|
90
90
|
return null
|
|
91
91
|
}
|
|
92
92
|
const moduleFlag = item.floorExtInfo.moduleFlag
|
|
93
93
|
if (!moduleFlag) {
|
|
94
94
|
const newModuleFlag = moduleId2ModuleFlag(item.moduleId)
|
|
95
95
|
if (newModuleFlag) {
|
|
96
96
|
item.floorExtInfo.moduleFlag = newModuleFlag
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
})
|