@conecli/cone-render 0.9.1-shop2.1 → 0.9.1-shop2.2
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/components/base/CommonFloorHead/index.tsx +1 -1
- 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/interface/jumpEventReport.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.pc.ts +1 -0
- 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/taroRenderUtil.ts +1 -1
- package/dist/utils/utils.ts +1 -1
- package/package.json +1 -1
package/dist/common/index.h5.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
urlCookie
|
|
3
2
|
public config: {
|
|
4
3
|
[key: string]: any
|
|
5
4
|
}
|
|
6
5
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
7
6
|
this.config = {}
|
|
8
7
|
pin: cookie.get('pin') || ''
|
|
9
8
|
})
|
|
10
9
|
if(!this.checkStatusAndLoginPromise){
|
|
11
10
|
this.checkStatusAndLoginPromise = new Promise(async (resolve, reject) => {
|
|
12
11
|
try {
|
|
13
12
|
const getLoginState = await this.doCheckLoginStateAndForApiCheck()
|
|
14
13
|
if(getLoginState){
|
|
15
14
|
resolve(true)
|
|
16
15
|
}else {
|
|
17
16
|
this.toLogin(options)
|
|
18
17
|
reject(false)
|
|
19
18
|
}
|
|
20
19
|
}catch (e) {
|
|
21
20
|
this.toLogin(options)
|
|
22
21
|
reject(false)
|
|
23
22
|
}
|
|
24
23
|
})
|
|
25
24
|
return this.checkStatusAndLoginPromise
|
|
26
25
|
}else {
|
|
27
26
|
return this.checkStatusAndLoginPromise.then(() => {
|
|
28
27
|
return Promise.resolve(true)
|
|
29
28
|
}).catch (() => {
|
|
30
29
|
this.toLogin(options)
|
|
31
30
|
return Promise.reject(true)
|
|
32
31
|
})
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
doCheckLoginStateAndForApiCheck() {
|
|
36
35
|
if(this.info.loginState){
|
|
37
36
|
return Promise.resolve(true)
|
|
38
37
|
}else {
|
|
39
38
|
return new Promise((resolve, reject) => {
|
|
40
39
|
if(this.info.isJingGouMiniViewState){
|
|
41
40
|
const getWqAuthToken = cookie.get("wq_auth_token")
|
|
42
41
|
if(getWqAuthToken){
|
|
43
42
|
this.info.loginState = true
|
|
44
43
|
resolve(true)
|
|
45
44
|
}else {
|
|
46
45
|
reject(false)
|
|
47
46
|
}
|
|
48
47
|
}else{
|
|
49
48
|
Taro.request({
|
|
50
49
|
url: api.isLogin,
|
|
51
50
|
jsonp:true,
|
|
52
51
|
timeout: 3000,
|
|
53
52
|
success: (res) => {
|
|
54
53
|
const {statusCode,data} = res
|
|
55
54
|
if (statusCode === 200 && data?.islogin && Number(data.islogin) === 1) {
|
|
56
55
|
this.info.loginState = true
|
|
57
56
|
resolve(true);
|
|
58
57
|
} else {
|
|
59
58
|
reject(false)
|
|
60
59
|
}
|
|
61
60
|
},
|
|
62
61
|
fail:(err) => {
|
|
63
62
|
console.log("登录检查异常", err)
|
|
64
63
|
reject(false)
|
|
65
64
|
}
|
|
66
65
|
})
|
|
67
66
|
}
|
|
68
67
|
})
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
try {
|
|
73
72
|
const getLoginState = await this.doCheckLoginStateAndForApiCheck()
|
|
74
73
|
if(getLoginState){
|
|
75
74
|
const { pin } = await this.getLoginCookie();
|
|
76
75
|
this.info.userInfo = {
|
|
77
76
|
pin,
|
|
78
77
|
encodePin: encodeURIComponent(pin),
|
|
79
78
|
ptkey: '',
|
|
80
79
|
}
|
|
81
80
|
resolve(true)
|
|
82
81
|
}else {
|
|
83
82
|
reject(false)
|
|
84
83
|
}
|
|
85
84
|
}catch (e) {
|
|
86
85
|
reject(false)
|
|
87
86
|
}
|
|
88
87
|
})
|
|
89
88
|
if(un_area && un_area.length > 0){
|
|
90
89
|
this.info.pageInfo.address = un_area
|
|
91
90
|
this.info.pageInfo.un_area = un_area
|
|
92
91
|
this.info.pageInfo.addressCommaStr = un_area.replace(/_/g, ',')
|
|
93
92
|
}
|
|
93
|
+
import Taro from '@tarojs/taro'
|
|
94
94
|
urlCookie
|
|
95
95
|
public config: {
|
|
96
96
|
[key: string]: any
|
|
97
97
|
}
|
|
98
98
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
99
99
|
this.config = {}
|
|
100
100
|
...info,
|
|
101
101
|
let getFullUrl = loginUrl + '?' + serialize(params)
|
|
102
102
|
if(isPc) {
|
|
103
103
|
getFullUrl = getFullUrl.replace(/returnurl/,'ReturnUrl')
|
|
104
104
|
}
|
|
105
105
|
pin: cookie.get('pin') || ''
|
|
106
106
|
})
|
|
107
107
|
if(!this.checkStatusAndLoginPromise){
|
|
108
108
|
this.checkStatusAndLoginPromise = new Promise(async (resolve, reject) => {
|
|
109
109
|
try {
|
|
110
110
|
const getLoginState = await this.doCheckLoginStateAndForApiCheck()
|
|
111
111
|
if(getLoginState){
|
|
112
112
|
resolve(true)
|
|
113
113
|
}else {
|
|
114
114
|
this.toLogin(options)
|
|
115
115
|
reject(false)
|
|
116
116
|
}
|
|
117
117
|
}catch (e) {
|
|
118
118
|
this.toLogin(options)
|
|
119
119
|
reject(false)
|
|
120
120
|
}
|
|
121
121
|
})
|
|
122
122
|
return this.checkStatusAndLoginPromise
|
|
123
123
|
}else {
|
|
124
124
|
return this.checkStatusAndLoginPromise.then(() => {
|
|
125
125
|
return Promise.resolve(true)
|
|
126
126
|
}).catch (() => {
|
|
127
127
|
this.toLogin(options)
|
|
128
128
|
return Promise.reject(true)
|
|
129
129
|
})
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
doCheckLoginStateAndForApiCheck() {
|
|
133
133
|
if(this.info.loginState){
|
|
134
134
|
return Promise.resolve(true)
|
|
135
135
|
}else {
|
|
136
136
|
return new Promise((resolve, reject) => {
|
|
137
137
|
if(this.info.isJingGouMiniViewState){
|
|
138
138
|
const getWqAuthToken = cookie.get("wq_auth_token")
|
|
139
139
|
if(getWqAuthToken){
|
|
140
140
|
this.info.loginState = true
|
|
141
141
|
resolve(true)
|
|
142
142
|
}else {
|
|
143
143
|
reject(false)
|
|
144
144
|
}
|
|
145
145
|
}else{
|
|
146
146
|
Taro.request({
|
|
147
147
|
url: api.isLogin,
|
|
148
148
|
jsonp:true,
|
|
149
149
|
timeout: 3000,
|
|
150
150
|
success: (res) => {
|
|
151
151
|
const {statusCode,data} = res
|
|
152
152
|
if (statusCode === 200 && data?.islogin && Number(data.islogin) === 1) {
|
|
153
153
|
this.info.loginState = true
|
|
154
154
|
resolve(true);
|
|
155
155
|
} else {
|
|
156
156
|
reject(false)
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
159
|
fail:(err) => {
|
|
160
160
|
console.log("登录检查异常", err)
|
|
161
161
|
reject(false)
|
|
162
162
|
}
|
|
163
163
|
})
|
|
164
164
|
}
|
|
165
165
|
})
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
try {
|
|
170
170
|
const getLoginState = await this.doCheckLoginStateAndForApiCheck()
|
|
171
171
|
if(getLoginState){
|
|
172
172
|
const { pin } = await this.getLoginCookie();
|
|
173
173
|
this.info.userInfo = {
|
|
174
174
|
pin,
|
|
175
175
|
encodePin: encodeURIComponent(pin),
|
|
176
176
|
ptkey: '',
|
|
177
177
|
}
|
|
178
178
|
resolve(true)
|
|
179
179
|
}else {
|
|
180
180
|
reject(false)
|
|
181
181
|
}
|
|
182
182
|
}catch (e) {
|
|
183
183
|
reject(false)
|
|
184
184
|
}
|
|
185
185
|
})
|
|
186
186
|
const changeArea = un_area && un_area.length > 0 ? un_area : (ipLoc_djd ? ipLoc_djd : '')
|
|
187
187
|
if(changeArea){
|
|
188
188
|
this.info.pageInfo.address = changeArea
|
|
189
189
|
this.info.pageInfo.un_area = changeArea
|
|
190
190
|
this.info.pageInfo.addressCommaStr = changeArea.replace(/_/g, ',')
|
|
191
191
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
2
|
key: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
const { floorData, renderSourceType, builtInComponents = {} } = props
|
|
3
2
|
const isDevMode = renderSourceType === BUSINESS_TYPE.DECORATE
|
|
4
3
|
const floorModuleType: any = floorData?.floorExtInfo?.moduleFlag
|
|
5
4
|
const FloorContentItem =
|
|
6
5
|
(floorModuleType && builtInComponents[floorModuleType]) || null
|
|
7
6
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
8
7
|
|
|
9
8
|
const renderDecorateDefaultModule = () => {
|
|
10
9
|
return (
|
|
11
10
|
<View
|
|
12
11
|
style={{
|
|
13
12
|
lineHeight: '120px',
|
|
14
13
|
textAlign: 'center',
|
|
15
14
|
}}
|
|
16
15
|
>
|
|
17
16
|
当前模块是{floorData.moduleName}
|
|
18
17
|
</View>
|
|
19
18
|
)
|
|
20
19
|
}
|
|
21
20
|
if (floorModuleType && RemoteLoadFloorList.includes(floorModuleType)) {
|
|
22
21
|
return (
|
|
23
22
|
<RemoteFloorItem {...props} dataDefines={dataDefines}></RemoteFloorItem>
|
|
24
23
|
)
|
|
25
24
|
} else {
|
|
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
|
}
|
|
34
33
|
renderSourceType: BUSINESS_TYPE.ONLINE,
|
|
35
34
|
switch (moduleId) {
|
|
36
35
|
case 83158:
|
|
37
36
|
return 'freeLayout'
|
|
38
37
|
case 99654:
|
|
39
38
|
return 'activeText'
|
|
40
39
|
case 100382:
|
|
41
40
|
return 'superGoods'
|
|
42
41
|
}
|
|
43
42
|
floorList.map((item) => {
|
|
44
43
|
if (!item.floorExtInfo) {
|
|
45
44
|
return null
|
|
46
45
|
}
|
|
47
46
|
const moduleFlag = item.floorExtInfo.moduleFlag
|
|
48
47
|
if (!moduleFlag) {
|
|
49
48
|
const newModuleFlag = moduleId2ModuleFlag(item.moduleId)
|
|
50
49
|
if (newModuleFlag) {
|
|
51
50
|
item.floorExtInfo.moduleFlag = newModuleFlag
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
})
|
|
54
|
+
import React from 'react'
|
|
55
55
|
const { floorData, renderSourceType, builtInComponents = {} } = props
|
|
56
56
|
const isDevMode = renderSourceType === BUSINESS_TYPE.DECORATE
|
|
57
57
|
const floorModuleType: any = floorData?.floorExtInfo?.moduleFlag
|
|
58
58
|
const FloorContentItem =
|
|
59
59
|
(floorModuleType && builtInComponents[floorModuleType]) || null
|
|
60
60
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
61
61
|
|
|
62
62
|
const renderDecorateDefaultModule = () => {
|
|
63
63
|
return (
|
|
64
64
|
<View
|
|
65
65
|
style={{
|
|
66
66
|
lineHeight: '120px',
|
|
67
67
|
textAlign: 'center',
|
|
68
68
|
}}
|
|
69
69
|
>
|
|
70
70
|
当前模块是{floorData.moduleName}
|
|
71
71
|
</View>
|
|
72
72
|
)
|
|
73
73
|
}
|
|
74
74
|
if (floorModuleType && (RemoteLoadFloorList.includes(floorModuleType) || floorData?.floorExtInfo?.floorLoadWay === 2)) {
|
|
75
75
|
return (
|
|
76
76
|
<RemoteFloorItem {...props} dataDefines={dataDefines}></RemoteFloorItem>
|
|
77
77
|
)
|
|
78
78
|
} else {
|
|
79
79
|
return FloorContentItem ? (
|
|
80
80
|
<ErrorBoundary {...props}>
|
|
81
81
|
<FloorContentItem {...props} dataDefines={dataDefines} />
|
|
82
82
|
</ErrorBoundary>
|
|
83
83
|
) : isDevMode ? (
|
|
84
84
|
renderDecorateDefaultModule()
|
|
85
85
|
) : null
|
|
86
86
|
}
|
|
87
87
|
renderSourceType: BUSINESS_TYPE.ONLINE,
|
|
88
88
|
switch (moduleId) {
|
|
89
89
|
case 83158:
|
|
90
90
|
return 'freeLayout'
|
|
91
91
|
case 99654:
|
|
92
92
|
return 'activeText'
|
|
93
93
|
case 100382:
|
|
94
94
|
return 'superGoods'
|
|
95
95
|
}
|
|
96
96
|
floorList.map((item) => {
|
|
97
97
|
if (!item.floorExtInfo) {
|
|
98
98
|
return null
|
|
99
99
|
}
|
|
100
100
|
const moduleFlag = item.floorExtInfo.moduleFlag
|
|
101
101
|
if (!moduleFlag) {
|
|
102
102
|
const newModuleFlag = moduleId2ModuleFlag(item.moduleId)
|
|
103
103
|
if (newModuleFlag) {
|
|
104
104
|
item.floorExtInfo.moduleFlag = newModuleFlag
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useCallback } from 'react'
|
|
2
1
|
{floorData?.showCommonFloorHead === false ? null : (
|
|
3
2
|
<CommonFloorHead dataDefines={dataDefines} floorData={floorData} />
|
|
4
3
|
)}
|
|
4
|
+
import React, { useCallback } from 'react'
|
|
5
5
|
const getRenderRealTimeKeyObj = isRealTimeRender ? {
|
|
6
6
|
key: Date.now()
|
|
7
7
|
} : {}
|
|
8
8
|
{floorData?.showCommonFloorHead === false ? null : <CommonFloorHead dataDefines={dataDefines} floorData={floorData} {...getRenderRealTimeKeyObj} />}
|
|
9
9
|
...getRenderRealTimeKeyObj
|
|
10
10
|
isRealTimeRender: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { Suspense, lazy } from 'react'
|
|
2
1
|
getBundleUrl,
|
|
3
2
|
getBundleFileName,
|
|
4
3
|
formatPackResult,
|
|
5
4
|
const { floorData, renderSourceType, updateContainerFloorListDataFn } = props
|
|
6
5
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
7
6
|
|
|
8
7
|
const getFloorSetHeight = (item) => {
|
|
9
8
|
const getHeight = item?.floorExtInfo?.floorHeight
|
|
10
9
|
? Number(item?.floorExtInfo?.floorHeight)
|
|
11
10
|
: 200
|
|
12
11
|
return getHeight > 0 ? getHeight : 200
|
|
13
12
|
}
|
|
14
13
|
console.log(
|
|
15
14
|
'>>>>>>>>>> floorModuleType === FloorModuleType.ISVDESIGNERH5MODULE >>>>>>>>>>',
|
|
16
15
|
)
|
|
17
16
|
const renderResult = (() => {
|
|
18
17
|
try {
|
|
19
18
|
console.log('>>>>>>>>>> 开始渲染1个isv模块 >>>>>>>>>>')
|
|
20
19
|
console.log(
|
|
21
20
|
'==========当前业务类型renderSourceType、楼层floorId: ',
|
|
22
21
|
renderSourceType,
|
|
23
22
|
floorData.uid,
|
|
24
23
|
)
|
|
25
24
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
26
25
|
const modularPackResultObj = formatPackResult(modularPackResult)
|
|
27
26
|
const bundleUrl = getBundleUrl(modularPackResultObj)
|
|
28
27
|
const bundleFileName = getBundleFileName(modularPackResultObj)
|
|
29
28
|
const opt = {
|
|
30
29
|
msg: `店铺首页isv h5楼层隐藏不显示。原因:modularPackResult数据不完备。页面类型-buildType: ${buildType}。楼层顺序-floorIdx: ${floorData?.floorIdx}`,
|
|
31
30
|
buildType,
|
|
32
31
|
uid: floorData?.uid,
|
|
33
32
|
floorIdx: floorData?.floorIdx,
|
|
34
33
|
shopId: floorData?.floorExtInfo?.shopId,
|
|
35
34
|
moduleId: floorData?.moduleId,
|
|
36
35
|
moduleName: floorData?.moduleName,
|
|
37
36
|
middleTemplateId: floorData?.middleTemplateId,
|
|
38
37
|
modularPackResult: modularPackResult,
|
|
39
38
|
}
|
|
40
39
|
if (bundleUrl && bundleFileName) {
|
|
41
40
|
let ISVModule =
|
|
42
41
|
taroJdBaseInfo?.renderedIsvComponents[
|
|
43
42
|
`${floorData.uid}_${bundleFileName}`
|
|
44
43
|
] || null
|
|
45
44
|
if (!ISVModule) {
|
|
46
45
|
ISVModule = lazy(() => import(bundleFileName + '@@@@@@' + bundleUrl))
|
|
47
46
|
console.log(
|
|
48
47
|
'1|加载isv模块==========走lazy import生成新的isv模块react组件',
|
|
49
48
|
bundleFileName,
|
|
50
49
|
)
|
|
51
50
|
taroJdBaseInfo.renderedIsvComponents[
|
|
52
51
|
`${floorData.uid}_${bundleFileName}`
|
|
53
52
|
] = ISVModule
|
|
54
53
|
console.log(
|
|
55
54
|
'2|渲染isv模块的react组件==========,window.taroJshopH5WebpackJsonp上的组件是否已就绪: ',
|
|
56
55
|
bundleFileName,
|
|
57
56
|
window['taroJshopH5WebpackJsonp'].find(
|
|
58
57
|
(item) => item[0][0] == bundleFileName,
|
|
59
58
|
),
|
|
60
59
|
)
|
|
61
60
|
} else {
|
|
62
61
|
console.log(
|
|
63
62
|
'1|加载isv模块==========不走lazy import生成新的isv模块react组件,从已加载中获取,taroJdBaseInfo: ',
|
|
64
63
|
taroJdBaseInfo,
|
|
65
64
|
)
|
|
66
65
|
console.log(
|
|
67
66
|
'2|渲染isv模块的react组件==========,taroJdBaseInfo.renderedIsvComponents上的组件是否已就绪: ',
|
|
68
67
|
taroJdBaseInfo.renderedIsvComponents[
|
|
69
68
|
`${floorData.uid}_${bundleFileName}`
|
|
70
69
|
],
|
|
71
70
|
)
|
|
72
71
|
}
|
|
73
72
|
const _floorHeight = getFloorSetHeight(floorData)
|
|
74
73
|
return (
|
|
75
74
|
<ErrorBoundary {...props}>
|
|
76
75
|
<Suspense
|
|
77
76
|
fallback={
|
|
78
77
|
<View
|
|
79
78
|
style={{
|
|
80
79
|
position: 'relative',
|
|
81
80
|
background: `#ffffff url('${JD_PLACEHOLDER_IMG}') center center no-repeat`,
|
|
82
81
|
height: `${_floorHeight}px`,
|
|
83
82
|
}}
|
|
84
83
|
></View>
|
|
85
84
|
}
|
|
86
85
|
>
|
|
87
86
|
<ISVFloor {...props} dataDefines={dataDefines}>
|
|
88
87
|
<ISVModule {...props} dataDefines={dataDefines}></ISVModule>
|
|
89
88
|
</ISVFloor>
|
|
90
89
|
</Suspense>
|
|
91
90
|
</ErrorBoundary>
|
|
92
91
|
)
|
|
93
92
|
} else {
|
|
94
93
|
console.log(
|
|
95
94
|
'3|isv模块渲染异常,modularPackResult中缺少bundleUrl或bundleFileName==========modularPackResult: ',
|
|
96
95
|
modularPackResultObj,
|
|
97
96
|
)
|
|
98
97
|
sgmCustomReport({
|
|
99
98
|
code: 'isvModuleError',
|
|
100
99
|
msg: opt,
|
|
101
100
|
})
|
|
102
101
|
return null
|
|
103
102
|
}
|
|
104
103
|
} catch (err) {
|
|
105
104
|
console.log('3|isv模块渲染异常,floorItem逻辑错误==========err: ', err)
|
|
106
105
|
sgmCustomReport({
|
|
107
106
|
code: 'isvModuleError',
|
|
108
107
|
msg: {
|
|
109
108
|
msg: 'remoteFloorItem try catch 异常',
|
|
110
109
|
err,
|
|
111
110
|
},
|
|
112
111
|
})
|
|
113
112
|
return null
|
|
114
113
|
}
|
|
115
114
|
})()
|
|
116
115
|
if (renderResult === null) {
|
|
117
116
|
updateContainerFloorListDataFn &&
|
|
118
117
|
updateContainerFloorListDataFn({
|
|
119
118
|
type: 'filter',
|
|
120
119
|
containerId: floorData?.uid,
|
|
121
120
|
})
|
|
122
121
|
console.log('renderResult === null: 命中了!')
|
|
123
122
|
taroEventSendPageScrollInfo()
|
|
124
123
|
} else {
|
|
125
124
|
console.log('renderResult !== null: 没命中', renderResult)
|
|
126
125
|
}
|
|
127
126
|
return renderResult
|
|
127
|
+
import React, { Suspense, lazy } from 'react'
|
|
128
128
|
getBundleUrl,
|
|
129
129
|
getBundleFileName,
|
|
130
130
|
formatPackResult,
|
|
131
131
|
const { floorData, renderSourceType, updateContainerFloorListDataFn } = props
|
|
132
132
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
133
133
|
|
|
134
134
|
const getFloorSetHeight = (item) => {
|
|
135
135
|
const getHeight = item?.floorExtInfo?.floorHeight
|
|
136
136
|
? Number(item?.floorExtInfo?.floorHeight)
|
|
137
137
|
: 200
|
|
138
138
|
return getHeight > 0 ? getHeight : 200
|
|
139
139
|
}
|
|
140
140
|
console.log(
|
|
141
141
|
'>>>>>>>>>> floorModuleType === FloorModuleType.ISVDESIGNERH5MODULE >>>>>>>>>>',
|
|
142
142
|
)
|
|
143
143
|
const renderResult = (() => {
|
|
144
144
|
try {
|
|
145
145
|
console.log('>>>>>>>>>> 开始渲染1个isv模块 >>>>>>>>>>')
|
|
146
146
|
console.log(
|
|
147
147
|
'==========当前业务类型renderSourceType、楼层floorId: ',
|
|
148
148
|
renderSourceType,
|
|
149
149
|
floorData.uid,
|
|
150
150
|
)
|
|
151
151
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
152
152
|
const modularPackResultObj = formatPackResult(modularPackResult)
|
|
153
153
|
const bundleUrl = getBundleUrl(modularPackResultObj)
|
|
154
154
|
const bundleFileName = getBundleFileName(modularPackResultObj)
|
|
155
155
|
const opt = {
|
|
156
156
|
msg: `店铺首页isv h5楼层隐藏不显示。原因:modularPackResult数据不完备。页面类型-buildType: ${buildType}。楼层顺序-floorIdx: ${floorData?.floorIdx}`,
|
|
157
157
|
buildType,
|
|
158
158
|
uid: floorData?.uid,
|
|
159
159
|
floorIdx: floorData?.floorIdx,
|
|
160
160
|
shopId: floorData?.floorExtInfo?.shopId,
|
|
161
161
|
moduleId: floorData?.moduleId,
|
|
162
162
|
moduleName: floorData?.moduleName,
|
|
163
163
|
middleTemplateId: floorData?.middleTemplateId,
|
|
164
164
|
modularPackResult: modularPackResult,
|
|
165
165
|
}
|
|
166
166
|
if (bundleUrl && bundleFileName) {
|
|
167
167
|
let ISVModule =
|
|
168
168
|
taroJdBaseInfo?.renderedIsvComponents[
|
|
169
169
|
`${floorData.uid}_${bundleFileName}`
|
|
170
170
|
] || null
|
|
171
171
|
if (!ISVModule) {
|
|
172
172
|
ISVModule = lazy(() => import(bundleFileName + '@@@@@@' + bundleUrl))
|
|
173
173
|
console.log(
|
|
174
174
|
'1|加载isv模块==========走lazy import生成新的isv模块react组件',
|
|
175
175
|
bundleFileName,
|
|
176
176
|
)
|
|
177
177
|
taroJdBaseInfo.renderedIsvComponents[
|
|
178
178
|
`${floorData.uid}_${bundleFileName}`
|
|
179
179
|
] = ISVModule
|
|
180
180
|
console.log(
|
|
181
181
|
'2|渲染isv模块的react组件==========,window.taroJshopH5WebpackJsonp上的组件是否已就绪: ',
|
|
182
182
|
bundleFileName,
|
|
183
183
|
window['taroJshopH5WebpackJsonp'].find(
|
|
184
184
|
(item) => item[0][0] == bundleFileName,
|
|
185
185
|
),
|
|
186
186
|
)
|
|
187
187
|
} else {
|
|
188
188
|
console.log(
|
|
189
189
|
'1|加载isv模块==========不走lazy import生成新的isv模块react组件,从已加载中获取,taroJdBaseInfo: ',
|
|
190
190
|
taroJdBaseInfo,
|
|
191
191
|
)
|
|
192
192
|
console.log(
|
|
193
193
|
'2|渲染isv模块的react组件==========,taroJdBaseInfo.renderedIsvComponents上的组件是否已就绪: ',
|
|
194
194
|
taroJdBaseInfo.renderedIsvComponents[
|
|
195
195
|
`${floorData.uid}_${bundleFileName}`
|
|
196
196
|
],
|
|
197
197
|
)
|
|
198
198
|
}
|
|
199
199
|
const _floorHeight = getFloorSetHeight(floorData)
|
|
200
200
|
return (
|
|
201
201
|
<ErrorBoundary {...props}>
|
|
202
202
|
<Suspense
|
|
203
203
|
fallback={
|
|
204
204
|
<View
|
|
205
205
|
style={{
|
|
206
206
|
position: 'relative',
|
|
207
207
|
background: `#ffffff url('${JD_PLACEHOLDER_IMG}') center center no-repeat`,
|
|
208
208
|
height: `${_floorHeight}px`,
|
|
209
209
|
}}
|
|
210
210
|
></View>
|
|
211
211
|
}
|
|
212
212
|
>
|
|
213
213
|
<ISVFloor {...props} dataDefines={dataDefines} isRealTimeRender={realTimerRenderTypeList.includes(taroJdBaseInfo.info.pageInfo.dataType)}>
|
|
214
214
|
<ISVModule {...props} dataDefines={dataDefines}></ISVModule>
|
|
215
215
|
</ISVFloor>
|
|
216
216
|
</Suspense>
|
|
217
217
|
</ErrorBoundary>
|
|
218
218
|
)
|
|
219
219
|
} else {
|
|
220
220
|
console.log(
|
|
221
221
|
'3|isv模块渲染异常,modularPackResult中缺少bundleUrl或bundleFileName==========modularPackResult: ',
|
|
222
222
|
modularPackResultObj,
|
|
223
223
|
)
|
|
224
224
|
sgmCustomReport({
|
|
225
225
|
code: 'isvModuleError',
|
|
226
226
|
msg: opt,
|
|
227
227
|
})
|
|
228
228
|
return null
|
|
229
229
|
}
|
|
230
230
|
} catch (err) {
|
|
231
231
|
console.log('3|isv模块渲染异常,floorItem逻辑错误==========err: ', err)
|
|
232
232
|
sgmCustomReport({
|
|
233
233
|
code: 'isvModuleError',
|
|
234
234
|
msg: {
|
|
235
235
|
msg: 'remoteFloorItem try catch 异常',
|
|
236
236
|
err,
|
|
237
237
|
},
|
|
238
238
|
})
|
|
239
239
|
return null
|
|
240
240
|
}
|
|
241
241
|
})()
|
|
242
242
|
if (renderResult === null) {
|
|
243
243
|
updateContainerFloorListDataFn &&
|
|
244
244
|
updateContainerFloorListDataFn({
|
|
245
245
|
type: 'filter',
|
|
246
246
|
containerId: floorData?.uid,
|
|
247
247
|
})
|
|
248
248
|
console.log('renderResult === null: 命中了!')
|
|
249
249
|
taroEventSendPageScrollInfo()
|
|
250
250
|
} else {
|
|
251
251
|
console.log('renderResult !== null: 没命中', renderResult)
|
|
252
252
|
}
|
|
253
253
|
return renderResult
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
subMessage?: string
|
|
3
2
|
showCommonFloorHead?: boolean
|
|
4
3
|
customErrorIsvFloorModule?: React.ReactElement | undefined
|
|
5
4
|
containerIndex?: number
|
|
6
5
|
containerData?: any
|
|
7
6
|
shopTotalInfo?: any
|
|
8
7
|
selectContainerFn?: Function
|
|
9
8
|
selectContainerId?: string
|
|
10
9
|
placeHolderPreContainerId?: string
|
|
11
10
|
children?: any
|
|
12
11
|
style?: {
|
|
13
12
|
[key: string]: any
|
|
14
13
|
};
|
|
15
14
|
layoutLeftRightMargin?: number
|
|
16
15
|
}
|
|
17
16
|
onFormSubmit?: Function
|
|
18
17
|
onFormReset?: Function
|
|
19
18
|
isFormDialog?: boolean
|
|
20
19
|
forbiddenBgScrollState?: boolean
|
|
20
|
+
import React from 'react'
|
|
21
21
|
subMessage?: string
|
|
22
22
|
floorLoadWay?: number
|
|
23
23
|
showCommonFloorHead?: boolean
|
|
24
24
|
isRealTimeRender: boolean
|
|
25
25
|
customErrorIsvFloorModule?: React.ReactElement | undefined
|
|
26
26
|
containerIndex?: number
|
|
27
27
|
containerData?: any
|
|
28
28
|
shopTotalInfo?: any
|
|
29
29
|
selectContainerFn?: Function
|
|
30
30
|
selectContainerId?: string
|
|
31
31
|
placeHolderPreContainerId?: string
|
|
32
32
|
children?: any
|
|
33
33
|
style?: {
|
|
34
34
|
[key: string]: any
|
|
35
35
|
};
|
|
36
36
|
layoutLeftRightMargin?: number
|
|
37
37
|
}
|
|
38
38
|
onFormSubmit?: Function
|
|
39
39
|
onFormReset?: Function
|
|
40
40
|
isFormDialog?: boolean
|
|
41
41
|
forbiddenBgScrollState?: boolean
|