@conecli/cone-render 0.10.1-shop3.71 → 0.10.1-shop3.73
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/floorItem.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/libs/openShopBridge.js +43 -1
- package/dist/libs/openShopBridge.min.js +1 -1
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
const {
|
|
3
2
|
floorData,
|
|
4
3
|
renderSourceType = BUSINESS_TYPE.ONLINE,
|
|
5
4
|
builtInComponents = {},
|
|
6
5
|
} = props
|
|
7
6
|
const isDevMode = renderSourceType === BUSINESS_TYPE.DECORATE
|
|
8
7
|
const specificModuleFlag = ['mHeaderVideo']
|
|
9
8
|
const frontEndSpecificModuleFlag = ['header_mVideo']
|
|
10
9
|
const luxuryContainerPosition = 'luxuryFixed'
|
|
11
10
|
const floorPosition = floorData?.floorPosition
|
|
12
11
|
let floorModuleType: any = floorData?.floorExtInfo?.moduleFlag
|
|
13
12
|
specificModuleFlag.includes(floorModuleType) &&
|
|
14
13
|
floorPosition === luxuryContainerPosition &&
|
|
15
14
|
(floorModuleType = frontEndSpecificModuleFlag)
|
|
16
15
|
const FloorContentItem =
|
|
17
16
|
(floorModuleType && builtInComponents[floorModuleType]) || null
|
|
18
17
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
19
18
|
|
|
20
19
|
const renderDecorateDefaultModule = () => {
|
|
21
20
|
return (
|
|
22
21
|
<View
|
|
23
22
|
style={{
|
|
24
23
|
lineHeight: '120px',
|
|
25
24
|
textAlign: 'center',
|
|
26
25
|
}}
|
|
27
26
|
>
|
|
28
27
|
当前模块是{floorData.moduleName}
|
|
29
28
|
</View>
|
|
30
29
|
)
|
|
31
30
|
}
|
|
32
31
|
if (
|
|
33
32
|
floorModuleType &&
|
|
34
33
|
(RemoteLoadFloorList.includes(floorModuleType) ||
|
|
35
34
|
floorData?.floorExtInfo?.floorLoadWay === 2)
|
|
36
35
|
) {
|
|
37
36
|
return (
|
|
38
37
|
<RemoteFloorItem {...props} dataDefines={dataDefines}></RemoteFloorItem>
|
|
39
38
|
)
|
|
40
39
|
} else {
|
|
41
40
|
return FloorContentItem ? (
|
|
42
41
|
<ErrorBoundary {...props}>
|
|
43
42
|
<FloorContentItem {...props} dataDefines={dataDefines} />
|
|
44
43
|
</ErrorBoundary>
|
|
45
44
|
) : isDevMode ? (
|
|
46
45
|
renderDecorateDefaultModule()
|
|
47
46
|
) : null
|
|
48
47
|
}
|
|
49
48
|
switch (moduleId) {
|
|
50
49
|
case 83158:
|
|
51
50
|
return 'freeLayout'
|
|
52
51
|
case 99654:
|
|
53
52
|
return 'activeText'
|
|
54
53
|
case 100382:
|
|
55
54
|
return 'superGoods'
|
|
56
55
|
}
|
|
57
56
|
floorList.map((item) => {
|
|
58
57
|
if (!item.floorExtInfo) {
|
|
59
58
|
return null
|
|
60
59
|
}
|
|
61
60
|
const moduleFlag = item.floorExtInfo.moduleFlag
|
|
62
61
|
if (!moduleFlag) {
|
|
63
62
|
const newModuleFlag = moduleId2ModuleFlag(item.moduleId)
|
|
64
63
|
if (newModuleFlag) {
|
|
65
64
|
item.floorExtInfo.moduleFlag = newModuleFlag
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
})
|
|
68
|
+
import React, { memo, useMemo } from 'react';
|
|
69
69
|
const {
|
|
70
70
|
floorData,
|
|
71
71
|
renderSourceType = BUSINESS_TYPE.ONLINE,
|
|
72
72
|
builtInComponents = {},
|
|
73
73
|
} = props;
|
|
74
74
|
const isDevMode = renderSourceType === BUSINESS_TYPE.DECORATE;
|
|
75
75
|
const specificModuleFlag = ['mHeaderVideo'];
|
|
76
76
|
const frontEndSpecificModuleFlag = ['header_mVideo'];
|
|
77
77
|
const luxuryContainerPosition = 'luxuryFixed';
|
|
78
78
|
const floorPosition = floorData?.floorPosition;
|
|
79
79
|
let floorModuleType: any = floorData?.floorExtInfo?.moduleFlag;
|
|
80
80
|
specificModuleFlag.includes(floorModuleType) &&
|
|
81
81
|
floorPosition === luxuryContainerPosition &&
|
|
82
82
|
(floorModuleType = frontEndSpecificModuleFlag);
|
|
83
83
|
const FloorContentItem = (floorModuleType && builtInComponents[floorModuleType]) || null;
|
|
84
84
|
const dataDefines = useMemo(() => {
|
|
85
85
|
return getFloorDataToDataDefines(floorData);
|
|
86
86
|
}, [floorData]);
|
|
87
87
|
|
|
88
88
|
const renderDecorateDefaultModule = () => {
|
|
89
89
|
return (
|
|
90
90
|
<View
|
|
91
91
|
style={{
|
|
92
92
|
lineHeight: '120px',
|
|
93
93
|
textAlign: 'center',
|
|
94
94
|
}}
|
|
95
95
|
>
|
|
96
96
|
当前模块是{floorData.moduleName}
|
|
97
97
|
</View>
|
|
98
98
|
);
|
|
99
99
|
};
|
|
100
100
|
if (
|
|
101
101
|
floorModuleType &&
|
|
102
102
|
(RemoteLoadFloorList.includes(floorModuleType) || floorData?.floorExtInfo?.floorLoadWay === 2)
|
|
103
103
|
) {
|
|
104
104
|
return <RemoteFloorItem {...props} dataDefines={dataDefines}></RemoteFloorItem>;
|
|
105
105
|
} else {
|
|
106
106
|
return FloorContentItem ? (
|
|
107
107
|
<ErrorBoundary {...props}>
|
|
108
108
|
<FloorContentItem {...props} dataDefines={dataDefines} />
|
|
109
109
|
</ErrorBoundary>
|
|
110
110
|
) : isDevMode ? (
|
|
111
111
|
renderDecorateDefaultModule()
|
|
112
112
|
) : null;
|
|
113
113
|
}
|
|
114
114
|
switch (moduleId) {
|
|
115
115
|
case 83158:
|
|
116
116
|
return 'freeLayout';
|
|
117
117
|
case 99654:
|
|
118
118
|
return 'activeText';
|
|
119
119
|
case 100382:
|
|
120
120
|
return 'superGoods';
|
|
121
121
|
}
|
|
122
122
|
floorList.map((item) => {
|
|
123
123
|
if (!item.floorExtInfo) {
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
126
|
const moduleFlag = item.floorExtInfo.moduleFlag;
|
|
127
127
|
if (!moduleFlag) {
|
|
128
128
|
const newModuleFlag = moduleId2ModuleFlag(item.moduleId);
|
|
129
129
|
if (newModuleFlag) {
|
|
130
130
|
item.floorExtInfo.moduleFlag = newModuleFlag;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
if (nextProps.source !== 'appView') return false;
|
|
135
135
|
return (
|
|
136
136
|
prevProps.floorData === nextProps.floorData &&
|
|
137
137
|
prevProps.extendInfoData === nextProps.extendInfoData
|
|
138
138
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useCallback } from 'react'
|
|
2
1
|
const {
|
|
3
2
|
style,
|
|
4
3
|
dataDefines,
|
|
5
4
|
containerBorderRadius,
|
|
6
5
|
floorData,
|
|
7
6
|
isRealTimeRender,
|
|
8
7
|
forceRenderTime,
|
|
9
8
|
} = props
|
|
10
9
|
const getRenderRealTimeKeyObj = {
|
|
11
10
|
key: isRealTimeRender ? Date.now() : forceRenderTime,
|
|
12
11
|
}
|
|
13
12
|
console.log('远程加载楼层渲染key信息', getRenderRealTimeKeyObj)
|
|
14
13
|
return (
|
|
15
14
|
<View className={floorStyle['wrap']} style={style}>
|
|
16
15
|
{floorData?.showCommonFloorHead === false ? null : (
|
|
17
16
|
<CommonFloorHead
|
|
18
17
|
dataDefines={dataDefines}
|
|
19
18
|
floorData={floorData}
|
|
20
19
|
{...getRenderRealTimeKeyObj}
|
|
21
20
|
/>
|
|
22
21
|
)}
|
|
23
22
|
<View
|
|
24
23
|
className={floorStyle['wrap']}
|
|
25
24
|
style={
|
|
26
25
|
typeof containerBorderRadius === 'number'
|
|
27
26
|
? {
|
|
28
27
|
borderRadius: containerBorderRadius + 'px',
|
|
29
28
|
}
|
|
30
29
|
: containerBorderRadius
|
|
31
30
|
}
|
|
32
31
|
>
|
|
33
32
|
{}
|
|
34
33
|
{props.children &&
|
|
35
34
|
React.cloneElement(props.children, {
|
|
36
35
|
dataDefines: dataDefines,
|
|
37
36
|
...getRenderRealTimeKeyObj,
|
|
38
37
|
})}
|
|
39
38
|
</View>
|
|
40
39
|
</View>
|
|
41
40
|
)
|
|
42
41
|
isRealTimeRender: false,
|
|
43
42
|
forceRenderTime: 1,
|
|
43
|
+
import React, { useState, useMemo, useRef, useCallback } from 'react';
|
|
44
44
|
const {
|
|
45
45
|
style,
|
|
46
46
|
dataDefines,
|
|
47
47
|
containerBorderRadius,
|
|
48
48
|
floorData,
|
|
49
49
|
isRealTimeRender,
|
|
50
50
|
forceRenderTime,
|
|
51
51
|
containerIndex = 0,
|
|
52
52
|
} = props;
|
|
53
53
|
const domRef = useRef<HTMLDivElement>(null);
|
|
54
54
|
const [wrapperHeight, setWrapperHeight] = useState<number | string>('auto');
|
|
55
55
|
const hasBeenInViewRef = useRef(false);
|
|
56
56
|
|
|
57
57
|
const globalSwitch = useMemo(() => {
|
|
58
58
|
let contentVisibilityShieldAll = true;
|
|
59
59
|
let contentVisibilityShieldModuleId: number[] = [];
|
|
60
60
|
if (window.shopGlobalSwitch) {
|
|
61
61
|
contentVisibilityShieldAll =
|
|
62
62
|
typeof window.shopGlobalSwitch.contentVisibilityShieldAll === 'boolean'
|
|
63
63
|
? window.shopGlobalSwitch.contentVisibilityShieldAll
|
|
64
64
|
: true;
|
|
65
65
|
contentVisibilityShieldModuleId = Array.isArray(
|
|
66
66
|
window.shopGlobalSwitch.contentVisibilityShieldModuleId,
|
|
67
67
|
)
|
|
68
68
|
? window.shopGlobalSwitch.contentVisibilityShieldModuleId
|
|
69
69
|
: [];
|
|
70
70
|
}
|
|
71
71
|
return { contentVisibilityShieldAll, contentVisibilityShieldModuleId };
|
|
72
72
|
}, []);
|
|
73
73
|
|
|
74
74
|
const handleInViewCallback = useCallback(() => {
|
|
75
75
|
if (globalSwitch.contentVisibilityShieldAll) return;
|
|
76
76
|
if (
|
|
77
77
|
floorData.moduleId &&
|
|
78
78
|
globalSwitch.contentVisibilityShieldModuleId.indexOf(floorData.moduleId) > -1
|
|
79
79
|
) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
if (!hasBeenInViewRef.current) {
|
|
83
83
|
hasBeenInViewRef.current = true;
|
|
84
84
|
setWrapperHeight('auto');
|
|
85
85
|
}
|
|
86
86
|
}, [containerIndex]);
|
|
87
87
|
|
|
88
88
|
const handleOutViewCallback = useCallback(() => {
|
|
89
89
|
if (globalSwitch.contentVisibilityShieldAll) return;
|
|
90
90
|
if (
|
|
91
91
|
floorData.moduleId &&
|
|
92
92
|
globalSwitch.contentVisibilityShieldModuleId.indexOf(floorData.moduleId) > -1
|
|
93
93
|
) {
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
if (hasBeenInViewRef.current && domRef.current) {
|
|
97
97
|
hasBeenInViewRef.current = false;
|
|
98
98
|
const height = domRef.current.getBoundingClientRect().height;
|
|
99
99
|
if (height > 0) {
|
|
100
100
|
setWrapperHeight(height);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}, [containerIndex]);
|
|
104
104
|
const getRenderRealTimeKeyObj = useMemo(() => {
|
|
105
105
|
return {
|
|
106
106
|
key: isRealTimeRender ? Date.now() : forceRenderTime,
|
|
107
107
|
};
|
|
108
108
|
}, [isRealTimeRender, forceRenderTime]);
|
|
109
109
|
const innerStyle = useMemo(() => {
|
|
110
110
|
const baseStyle = style || {};
|
|
111
111
|
let borderRadius = {};
|
|
112
112
|
if (typeof containerBorderRadius === 'number') {
|
|
113
113
|
borderRadius = { borderRadius: containerBorderRadius + 'px' };
|
|
114
114
|
} else if (containerBorderRadius && typeof containerBorderRadius === 'object') {
|
|
115
115
|
borderRadius = containerBorderRadius;
|
|
116
116
|
}
|
|
117
117
|
if (typeof wrapperHeight === 'number') {
|
|
118
118
|
return {
|
|
119
119
|
...baseStyle,
|
|
120
120
|
...borderRadius,
|
|
121
121
|
height: `${wrapperHeight}px`,
|
|
122
122
|
overflow: 'hidden',
|
|
123
123
|
contentVisibility: 'auto',
|
|
124
124
|
containIntrinsicSize: `${wrapperHeight}px`,
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
return { ...baseStyle, ...borderRadius };
|
|
128
128
|
}, [containerBorderRadius, wrapperHeight]);
|
|
129
129
|
return (
|
|
130
130
|
<InOrOutViewObserver
|
|
131
131
|
inViewCallback={handleInViewCallback}
|
|
132
132
|
outViewCallback={handleOutViewCallback}
|
|
133
133
|
threshold={0}
|
|
134
134
|
>
|
|
135
135
|
<View ref={domRef} style={innerStyle} className={floorStyle['wrap']}>
|
|
136
136
|
{floorData?.showCommonFloorHead === false ? null : (
|
|
137
137
|
<CommonFloorHead
|
|
138
138
|
dataDefines={dataDefines}
|
|
139
139
|
floorData={floorData}
|
|
140
140
|
{...getRenderRealTimeKeyObj}
|
|
141
141
|
/>
|
|
142
142
|
)}
|
|
143
143
|
{props.children &&
|
|
144
144
|
React.cloneElement(props.children, {
|
|
145
145
|
dataDefines: dataDefines,
|
|
146
146
|
...getRenderRealTimeKeyObj,
|
|
147
147
|
})}
|
|
148
148
|
</View>
|
|
149
149
|
</InOrOutViewObserver>
|
|
150
150
|
);
|
|
151
151
|
isRealTimeRender: false,
|
|
152
152
|
forceRenderTime: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
getBundleUrl,
|
|
3
2
|
getBundleFileName,
|
|
4
3
|
formatPackResult,
|
|
5
4
|
getTaroVersion
|
|
6
5
|
const { floorData, renderSourceType, updateContainerFloorListDataFn } = props
|
|
7
6
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
8
7
|
const [forceRenderTime,setForceRenderTime] = useState(1)
|
|
9
8
|
useEffect(() => {
|
|
10
9
|
isJdAndAndroidDevice && Taro.eventCenter.on(TaroEventType.FORCE_UPDATE_PAGE_LAYOUT, (_result) => {
|
|
11
10
|
setForceRenderTime(Date.now())
|
|
12
11
|
})
|
|
13
12
|
return () => {
|
|
14
13
|
isJdAndAndroidDevice && Taro.eventCenter.off(TaroEventType.FORCE_UPDATE_PAGE_LAYOUT)
|
|
15
14
|
}
|
|
16
15
|
},[])
|
|
17
16
|
|
|
18
17
|
const getFloorSetHeight = (item) => {
|
|
19
18
|
const getHeight = item?.floorExtInfo?.floorHeight
|
|
20
19
|
? Number(item?.floorExtInfo?.floorHeight)
|
|
21
20
|
: 200
|
|
22
21
|
return getHeight > 0 ? getHeight : 200
|
|
23
22
|
}
|
|
24
23
|
console.log(
|
|
25
24
|
'>>>>>>>>>> floorModuleType === FloorModuleType.ISVDESIGNERH5MODULE >>>>>>>>>>',
|
|
26
25
|
)
|
|
27
26
|
const renderResult = (() => {
|
|
28
27
|
try {
|
|
29
28
|
console.log('>>>>>>>>>> 开始渲染1个isv模块 >>>>>>>>>>')
|
|
30
29
|
console.log(
|
|
31
30
|
'==========当前业务类型renderSourceType、楼层floorId: ',
|
|
32
31
|
renderSourceType,
|
|
33
32
|
floorData.uid,
|
|
34
33
|
)
|
|
35
34
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
36
35
|
const modularPackResultObj = formatPackResult(modularPackResult)
|
|
37
36
|
const bundleUrl = getBundleUrl(modularPackResultObj)
|
|
38
37
|
const bundleFileName = getBundleFileName(modularPackResultObj)
|
|
39
38
|
const taroVersion = getTaroVersion(modularPackResultObj)
|
|
40
39
|
const opt = {
|
|
41
40
|
msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
|
|
42
41
|
floorIdx: floorData?.floorIdx,
|
|
43
42
|
uid: floorData?.uid,
|
|
44
43
|
shopId: floorData?.floorExtInfo?.shopId,
|
|
45
44
|
moduleId: floorData?.moduleId,
|
|
46
45
|
moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
|
|
47
46
|
floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
|
|
48
47
|
floorKind: floorData?.floorExtInfo?.floorKind,
|
|
49
48
|
middleTemplateId: floorData?.middleTemplateId,
|
|
50
49
|
modularPackResult: {
|
|
51
50
|
bundleUrl,
|
|
52
51
|
taroVersion
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
if (bundleUrl && bundleFileName) {
|
|
56
55
|
let ISVModule =
|
|
57
56
|
taroJdBaseInfo?.renderedIsvComponents[
|
|
58
57
|
`${floorData.uid}_${bundleFileName}`
|
|
59
58
|
] || null
|
|
60
59
|
if (!ISVModule) {
|
|
61
60
|
ISVModule = lazy(() => import(bundleFileName + '@@@@@@' + bundleUrl))
|
|
62
61
|
console.log(
|
|
63
62
|
'1|加载isv模块==========走lazy import生成新的isv模块react组件',
|
|
64
63
|
bundleFileName,
|
|
65
64
|
)
|
|
66
65
|
taroJdBaseInfo.renderedIsvComponents[
|
|
67
66
|
`${floorData.uid}_${bundleFileName}`
|
|
68
67
|
] = ISVModule
|
|
69
68
|
console.log(
|
|
70
69
|
'2|渲染isv模块的react组件==========,window.taroJshopH5WebpackJsonp上的组件是否已就绪: ',
|
|
71
70
|
bundleFileName,
|
|
72
71
|
window['taroJshopH5WebpackJsonp'].find(
|
|
73
72
|
(item) => item[0][0] == bundleFileName,
|
|
74
73
|
),
|
|
75
74
|
)
|
|
76
75
|
} else {
|
|
77
76
|
console.log(
|
|
78
77
|
'1|加载isv模块==========不走lazy import生成新的isv模块react组件,从已加载中获取,taroJdBaseInfo: ',
|
|
79
78
|
taroJdBaseInfo,
|
|
80
79
|
)
|
|
81
80
|
console.log(
|
|
82
81
|
'2|渲染isv模块的react组件==========,taroJdBaseInfo.renderedIsvComponents上的组件是否已就绪: ',
|
|
83
82
|
taroJdBaseInfo.renderedIsvComponents[
|
|
84
83
|
`${floorData.uid}_${bundleFileName}`
|
|
85
84
|
],
|
|
86
85
|
)
|
|
87
86
|
}
|
|
88
87
|
const _floorHeight = getFloorSetHeight(floorData)
|
|
89
88
|
return (
|
|
90
89
|
<ErrorBoundary {...props}>
|
|
91
90
|
<Suspense
|
|
92
91
|
fallback={
|
|
93
92
|
<View
|
|
94
93
|
style={{
|
|
95
94
|
position: 'relative',
|
|
96
95
|
background: `#ffffff url('${JD_PLACEHOLDER_IMG}') center center no-repeat`,
|
|
97
96
|
height: `${_floorHeight}px`,
|
|
98
97
|
}}
|
|
99
98
|
></View>
|
|
100
99
|
}
|
|
101
100
|
>
|
|
102
101
|
<ISVFloor {...props} dataDefines={dataDefines} forceRenderTime={forceRenderTime} isRealTimeRender={realTimerRenderTypeList.includes(taroJdBaseInfo.info.pageInfo.dataType)}>
|
|
103
102
|
<ISVModule {...props} dataDefines={dataDefines}></ISVModule>
|
|
104
103
|
</ISVFloor>
|
|
105
104
|
</Suspense>
|
|
106
105
|
</ErrorBoundary>
|
|
107
106
|
)
|
|
108
107
|
} else {
|
|
109
108
|
console.log(
|
|
110
109
|
'3|isv模块渲染异常,modularPackResult中缺少bundleUrl或bundleFileName==========modularPackResult: ',
|
|
111
110
|
modularPackResultObj,
|
|
112
111
|
)
|
|
113
112
|
draBusinessCustomReport({
|
|
114
113
|
eventName: 'business',
|
|
115
114
|
errorName: getSgmCustomCode(handleSgmCodeTaroVersion(floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE ? SgmCustomCode.SYSTEMPDCMODULE_DATA : SgmCustomCode.REMOTEMODULE_DATA)),
|
|
116
115
|
errorMessage: '店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。',
|
|
117
116
|
extraData: JSON.stringify(opt),
|
|
118
117
|
})
|
|
119
118
|
return null
|
|
120
119
|
}
|
|
121
120
|
} catch (err) {
|
|
122
121
|
console.log('3|isv模块渲染异常,floorItem逻辑错误==========err: ', err)
|
|
123
122
|
return null
|
|
124
123
|
}
|
|
125
124
|
})()
|
|
126
125
|
if (renderResult === null) {
|
|
127
126
|
updateContainerFloorListDataFn &&
|
|
128
127
|
updateContainerFloorListDataFn({
|
|
129
128
|
type: 'filter',
|
|
130
129
|
containerId: floorData?.uid,
|
|
131
130
|
})
|
|
132
131
|
console.log('renderResult === null: 命中了!')
|
|
133
132
|
taroEventSendPageScrollInfo()
|
|
134
133
|
} else {
|
|
135
134
|
console.log('renderResult !== null: 没命中', renderResult)
|
|
136
135
|
}
|
|
137
136
|
return renderResult
|
|
137
|
+
import Taro from '@tarojs/taro';
|
|
138
138
|
getBundleUrl,
|
|
139
139
|
getBundleFileName,
|
|
140
140
|
formatPackResult,
|
|
141
141
|
getTaroVersion,
|
|
142
142
|
const { floorData, renderSourceType, updateContainerFloorListDataFn } = props;
|
|
143
143
|
const dataDefines = getFloorDataToDataDefines(floorData);
|
|
144
144
|
const [forceRenderTime, setForceRenderTime] = useState(1);
|
|
145
145
|
useEffect(() => {
|
|
146
146
|
isJdAndAndroidDevice &&
|
|
147
147
|
Taro.eventCenter.on(TaroEventType.FORCE_UPDATE_PAGE_LAYOUT, (_result) => {
|
|
148
148
|
setForceRenderTime(Date.now());
|
|
149
149
|
});
|
|
150
150
|
return () => {
|
|
151
151
|
isJdAndAndroidDevice && Taro.eventCenter.off(TaroEventType.FORCE_UPDATE_PAGE_LAYOUT);
|
|
152
152
|
};
|
|
153
153
|
}, []);
|
|
154
154
|
|
|
155
155
|
const getFloorSetHeight = (item) => {
|
|
156
156
|
const getHeight = item?.floorExtInfo?.floorHeight
|
|
157
157
|
? Number(item?.floorExtInfo?.floorHeight)
|
|
158
158
|
: 200;
|
|
159
159
|
return getHeight > 0 ? getHeight : 200;
|
|
160
160
|
};
|
|
161
161
|
console.log('>>>>>>>>>> floorModuleType === FloorModuleType.ISVDESIGNERH5MODULE >>>>>>>>>>');
|
|
162
162
|
const renderResult = (() => {
|
|
163
163
|
try {
|
|
164
164
|
console.log('>>>>>>>>>> 开始渲染1个isv模块 >>>>>>>>>>');
|
|
165
165
|
console.log(
|
|
166
166
|
'==========当前业务类型renderSourceType、楼层floorId: ',
|
|
167
167
|
renderSourceType,
|
|
168
168
|
floorData.uid,
|
|
169
169
|
);
|
|
170
170
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
|
|
171
171
|
const modularPackResultObj = formatPackResult(modularPackResult);
|
|
172
172
|
const bundleUrl = getBundleUrl(modularPackResultObj);
|
|
173
173
|
const bundleFileName = getBundleFileName(modularPackResultObj);
|
|
174
174
|
const taroVersion = getTaroVersion(modularPackResultObj);
|
|
175
175
|
const opt = {
|
|
176
176
|
msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
|
|
177
177
|
floorIdx: floorData?.floorIdx,
|
|
178
178
|
uid: floorData?.uid,
|
|
179
179
|
shopId: floorData?.floorExtInfo?.shopId,
|
|
180
180
|
moduleId: floorData?.moduleId,
|
|
181
181
|
moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
|
|
182
182
|
floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
|
|
183
183
|
floorKind: floorData?.floorExtInfo?.floorKind,
|
|
184
184
|
middleTemplateId: floorData?.middleTemplateId,
|
|
185
185
|
modularPackResult: {
|
|
186
186
|
bundleUrl,
|
|
187
187
|
taroVersion,
|
|
188
188
|
},
|
|
189
189
|
};
|
|
190
190
|
if (bundleUrl && bundleFileName) {
|
|
191
191
|
let ISVModule = taroJdBaseInfo?.renderedIsvComponents[bundleFileName] || null;
|
|
192
192
|
if (!ISVModule) {
|
|
193
193
|
ISVModule = lazy(() => import(bundleFileName + '@@@@@@' + bundleUrl));
|
|
194
194
|
console.log(
|
|
195
195
|
'1|加载isv模块==========走lazy import生成新的isv模块react组件',
|
|
196
196
|
bundleFileName,
|
|
197
197
|
);
|
|
198
198
|
taroJdBaseInfo.renderedIsvComponents[bundleFileName] = ISVModule;
|
|
199
199
|
console.log(
|
|
200
200
|
'2|渲染isv模块的react组件==========,window.taroJshopH5WebpackJsonp上的组件是否已就绪: ',
|
|
201
201
|
bundleFileName,
|
|
202
202
|
window['taroJshopH5WebpackJsonp'].find((item) => item[0][0] == bundleFileName),
|
|
203
203
|
);
|
|
204
204
|
} else {
|
|
205
205
|
console.log(
|
|
206
206
|
'1|加载isv模块==========不走lazy import生成新的isv模块react组件,从已加载中获取,taroJdBaseInfo: ',
|
|
207
207
|
taroJdBaseInfo,
|
|
208
208
|
);
|
|
209
209
|
console.log(
|
|
210
210
|
'2|渲染isv模块的react组件==========,taroJdBaseInfo.renderedIsvComponents上的组件是否已就绪: ',
|
|
211
211
|
taroJdBaseInfo.renderedIsvComponents[bundleFileName],
|
|
212
212
|
);
|
|
213
213
|
}
|
|
214
214
|
const _floorHeight = getFloorSetHeight(floorData);
|
|
215
215
|
return (
|
|
216
216
|
<ErrorBoundary {...props}>
|
|
217
217
|
<Suspense
|
|
218
218
|
fallback={
|
|
219
219
|
<View
|
|
220
220
|
style={{
|
|
221
221
|
position: 'relative',
|
|
222
222
|
background: `#ffffff url('${JD_PLACEHOLDER_IMG}') center center no-repeat`,
|
|
223
223
|
height: `${_floorHeight}px`,
|
|
224
224
|
}}
|
|
225
225
|
></View>
|
|
226
226
|
}
|
|
227
227
|
>
|
|
228
228
|
<ISVFloor
|
|
229
229
|
{...props}
|
|
230
230
|
dataDefines={dataDefines}
|
|
231
231
|
forceRenderTime={forceRenderTime}
|
|
232
232
|
isRealTimeRender={realTimerRenderTypeList.includes(
|
|
233
233
|
taroJdBaseInfo.info.pageInfo.dataType,
|
|
234
234
|
)}
|
|
235
235
|
>
|
|
236
236
|
<ISVModule {...props} dataDefines={dataDefines}></ISVModule>
|
|
237
237
|
</ISVFloor>
|
|
238
238
|
</Suspense>
|
|
239
239
|
</ErrorBoundary>
|
|
240
240
|
);
|
|
241
241
|
} else {
|
|
242
242
|
console.log(
|
|
243
243
|
'3|isv模块渲染异常,modularPackResult中缺少bundleUrl或bundleFileName==========modularPackResult: ',
|
|
244
244
|
modularPackResultObj,
|
|
245
245
|
);
|
|
246
246
|
draBusinessCustomReport({
|
|
247
247
|
eventName: 'business',
|
|
248
248
|
errorName: getSgmCustomCode(
|
|
249
249
|
handleSgmCodeTaroVersion(
|
|
250
250
|
floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE
|
|
251
251
|
? SgmCustomCode.SYSTEMPDCMODULE_DATA
|
|
252
252
|
: SgmCustomCode.REMOTEMODULE_DATA,
|
|
253
253
|
),
|
|
254
254
|
),
|
|
255
255
|
errorMessage: '店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。',
|
|
256
256
|
extraData: JSON.stringify(opt),
|
|
257
257
|
});
|
|
258
258
|
return null;
|
|
259
259
|
}
|
|
260
260
|
} catch (err) {
|
|
261
261
|
console.log('3|isv模块渲染异常,floorItem逻辑错误==========err: ', err);
|
|
262
262
|
return null;
|
|
263
263
|
}
|
|
264
264
|
})();
|
|
265
265
|
if (renderResult === null) {
|
|
266
266
|
updateContainerFloorListDataFn &&
|
|
267
267
|
updateContainerFloorListDataFn({
|
|
268
268
|
type: 'filter',
|
|
269
269
|
containerId: floorData?.uid,
|
|
270
270
|
});
|
|
271
271
|
console.log('renderResult === null: 命中了!');
|
|
272
272
|
taroEventSendPageScrollInfo();
|
|
273
273
|
} else {
|
|
274
274
|
console.log('renderResult !== null: 没命中', renderResult);
|
|
275
275
|
}
|
|
276
276
|
return renderResult;
|