@conecli/cone-render 0.10.1-shop3.5 → 0.10.1-shop3.7
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/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/InViewRender/index.tsx +1 -1
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/interface/common.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -56
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/open/api/util.ts +1 -1
- package/dist/sass/app.h5.scss +252 -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/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.js +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
NETWORK_DATA_TYPE,
|
|
3
2
|
TaroEventType,
|
|
4
3
|
MINI_APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
|
|
5
4
|
SHOP_TAB_CONTENT_BOTTOM,
|
|
6
5
|
listData,
|
|
7
6
|
num = LOAD_FLOOR_BATCH_NUM,
|
|
8
7
|
let thisListData: ComponentInterFace.ContainerItemData[] | [] =
|
|
9
8
|
listData.slice(0)
|
|
10
9
|
const thisListDataLen = thisListData.length
|
|
11
10
|
const res: any[] = []
|
|
12
11
|
if (thisListDataLen) {
|
|
13
12
|
if (thisListDataLen < num) {
|
|
14
13
|
res.push(thisListData)
|
|
15
14
|
} else {
|
|
16
15
|
while (thisListData.length) {
|
|
17
16
|
if (thisListData.length >= num) {
|
|
18
17
|
res.push(thisListData.splice(0, num))
|
|
19
18
|
} else {
|
|
20
19
|
res.push(thisListData)
|
|
21
20
|
thisListData = []
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
return res
|
|
27
26
|
containerFloorListData: ComponentInterFace.ContainerItemData[]
|
|
28
27
|
className?: string
|
|
29
28
|
sectionType?: string
|
|
30
29
|
style?: object
|
|
31
30
|
hasGoodsFeeds?: boolean
|
|
32
31
|
miniScrollSelf?: boolean
|
|
33
32
|
tabContentShowState?: boolean
|
|
34
33
|
loadingEndComponentFn?: Function
|
|
35
34
|
updateShopFloorDataFn?: Function
|
|
36
35
|
builtInComponents?: Object
|
|
37
36
|
changeScrollToLowerStateFn: Function | null
|
|
38
37
|
changeLayoutScrollToTopFn?: Function
|
|
39
38
|
triggerMiniLoadProductWithFilterFn?: Function
|
|
40
39
|
const { windowHeight, actualNavBarHeight } = taroJdBaseInfo.info.sysInfo
|
|
41
40
|
const {
|
|
42
41
|
className,
|
|
43
42
|
style,
|
|
44
43
|
loadingEndComponentFn,
|
|
45
44
|
hasGoodsFeeds,
|
|
46
45
|
sectionType,
|
|
47
46
|
tabContentShowState,
|
|
48
47
|
containerFloorListData,
|
|
49
48
|
updateShopFloorDataFn,
|
|
50
49
|
changeScrollToLowerStateFn,
|
|
51
50
|
changeLayoutScrollToTopFn,
|
|
52
51
|
triggerMiniLoadProductWithFilterFn,
|
|
53
52
|
builtInComponents,
|
|
54
53
|
miniScrollSelf = false,
|
|
55
54
|
} = props
|
|
56
55
|
const [containerFloorListScrollTop, setContainerFloorListScrollTop] =
|
|
57
56
|
useState(0)
|
|
58
57
|
const loadMoreContainerFloorListDataRef = useRef({
|
|
59
58
|
needFirstLoadState: true,
|
|
60
59
|
loadingState: false,
|
|
61
60
|
})
|
|
62
61
|
const isFuncForChangeScrollToLowerStateFn =
|
|
63
62
|
typeof changeScrollToLowerStateFn == 'function'
|
|
64
63
|
const loadSectionTypeContainerFloorListRef = useRef<{
|
|
65
64
|
[key: string]: ComponentInterFace.MiniLoadFloorListRef
|
|
66
65
|
}>({
|
|
67
66
|
[`${sectionType}`]: {
|
|
68
67
|
index: 1,
|
|
69
68
|
itemNum: 0,
|
|
70
69
|
list: [],
|
|
71
70
|
loadList: [],
|
|
72
71
|
max: 1,
|
|
73
72
|
},
|
|
74
73
|
})
|
|
75
74
|
const [containerFloorList, setContainerFloorList] = useState<
|
|
76
75
|
ComponentInterFace.ContainerItemData[]
|
|
77
76
|
>(() => {
|
|
78
77
|
|
|
79
78
|
const getLoadDataArr = containerFloorListDataSpliceToPromise(
|
|
80
79
|
containerFloorListData,
|
|
81
80
|
)
|
|
82
81
|
const getThisSectionTypeListData =
|
|
83
82
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`]
|
|
84
83
|
getThisSectionTypeListData.list = getLoadDataArr
|
|
85
84
|
getThisSectionTypeListData.itemNum = containerFloorListData.length
|
|
86
85
|
getThisSectionTypeListData.max = getLoadDataArr.length
|
|
87
86
|
console.log('获取加载数据总数据----' + sectionType, getLoadDataArr)
|
|
88
87
|
const getThisLoadList = getLoadDataArr.shift()
|
|
89
88
|
if (getThisLoadList) {
|
|
90
89
|
getThisSectionTypeListData.loadList = getThisLoadList
|
|
91
90
|
return getThisLoadList
|
|
92
91
|
} else {
|
|
93
92
|
return []
|
|
94
93
|
}
|
|
95
94
|
})
|
|
96
95
|
useEffect(() => {
|
|
97
96
|
if (containerFloorList.length > 0) {
|
|
98
97
|
Taro.nextTick(() => {
|
|
99
98
|
const getThisSectionTypeListData =
|
|
100
99
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`]
|
|
101
100
|
console.log(
|
|
102
101
|
`加载${sectionType}中第${getThisSectionTypeListData.index}批次${LOAD_FLOOR_BATCH_NUM}个模块完毕,共计${getThisSectionTypeListData.max}轮,楼层总计${getThisSectionTypeListData.itemNum}`,
|
|
103
102
|
)
|
|
104
103
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState &&
|
|
105
104
|
checkLoadFloorListLoadState().then((needLoadState) => {
|
|
106
105
|
console.log('检查是否需要继续加载状态', needLoadState)
|
|
107
106
|
if (needLoadState) {
|
|
108
107
|
const getThisLoadList = getThisSectionTypeListData.list.shift()
|
|
109
108
|
if (getThisLoadList) {
|
|
110
109
|
getThisSectionTypeListData.index++
|
|
111
110
|
const changeContainerList: ComponentInterFace.ContainerItemData[] =
|
|
112
111
|
[...getThisSectionTypeListData.loadList, ...getThisLoadList]
|
|
113
112
|
getThisSectionTypeListData.loadList = changeContainerList
|
|
114
113
|
setContainerFloorList(changeContainerList)
|
|
115
114
|
} else {
|
|
116
115
|
Taro.hideLoading()
|
|
117
116
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState =
|
|
118
117
|
false
|
|
119
118
|
}
|
|
120
119
|
} else {
|
|
121
120
|
Taro.hideLoading()
|
|
122
121
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState =
|
|
123
122
|
false
|
|
124
123
|
}
|
|
125
124
|
})
|
|
126
125
|
})
|
|
127
126
|
}
|
|
128
127
|
}, [containerFloorList])
|
|
129
128
|
|
|
130
129
|
const checkLoadFloorListLoadState = () => {
|
|
131
130
|
return new Promise((resolve) => {
|
|
132
131
|
Taro.createSelectorQuery()
|
|
133
132
|
.select('#J_shopContainerFloorList')
|
|
134
133
|
.boundingClientRect(function (rect) {
|
|
135
134
|
if (rect) {
|
|
136
135
|
if (rect.height && rect.height < windowHeight + 100) {
|
|
137
136
|
resolve(true)
|
|
138
137
|
} else {
|
|
139
138
|
resolve(false)
|
|
140
139
|
}
|
|
141
140
|
} else {
|
|
142
141
|
resolve(true)
|
|
143
142
|
}
|
|
144
143
|
})
|
|
145
144
|
.exec()
|
|
146
145
|
})
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
const loadMoreContainerFloorList = (evt: any = false) => {
|
|
150
149
|
const getThisSectionTypeListData =
|
|
151
150
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`]
|
|
152
151
|
if (
|
|
153
152
|
!loadMoreContainerFloorListDataRef.current.loadingState &&
|
|
154
153
|
getThisSectionTypeListData.list.length > 0
|
|
155
154
|
) {
|
|
156
155
|
loadMoreContainerFloorListDataRef.current.loadingState = true
|
|
157
156
|
getThisSectionTypeListData.index++
|
|
158
157
|
console.log(
|
|
159
158
|
`当前即将加载${sectionType}中第${getThisSectionTypeListData.index}轮`,
|
|
160
159
|
)
|
|
161
160
|
const getThisLoadList = getThisSectionTypeListData.list.shift()
|
|
162
161
|
if (getThisLoadList) {
|
|
163
162
|
const changeFloorList = [
|
|
164
163
|
...getThisSectionTypeListData.loadList,
|
|
165
164
|
...getThisLoadList,
|
|
166
165
|
]
|
|
167
166
|
getThisSectionTypeListData.loadList = changeFloorList
|
|
168
167
|
loadMoreContainerFloorListDataRef.current.loadingState = false
|
|
169
168
|
isFuncForChangeScrollToLowerStateFn && changeScrollToLowerStateFn(false)
|
|
170
169
|
setContainerFloorList(changeFloorList)
|
|
171
170
|
Taro.nextTick(() => {
|
|
172
171
|
if (getThisSectionTypeListData.list.length == 0) {
|
|
173
172
|
typeof triggerMiniLoadProductWithFilterFn == 'function' &&
|
|
174
173
|
triggerMiniLoadProductWithFilterFn()
|
|
175
174
|
}
|
|
176
175
|
})
|
|
177
176
|
} else {
|
|
178
177
|
isFuncForChangeScrollToLowerStateFn && changeScrollToLowerStateFn(false)
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
if (
|
|
182
181
|
miniScrollSelf &&
|
|
183
182
|
evt &&
|
|
184
183
|
!loadMoreContainerFloorListDataRef.current.loadingState &&
|
|
185
184
|
getThisSectionTypeListData.index >= getThisSectionTypeListData.max
|
|
186
185
|
) {
|
|
187
186
|
pageScrollToLower(evt)
|
|
188
187
|
}
|
|
189
188
|
}
|
|
190
189
|
useEffect(() => {
|
|
191
190
|
if (!miniScrollSelf) {
|
|
192
191
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL_END, (tabActiveType) => {
|
|
193
192
|
if (tabActiveType == sectionType && tabContentShowState) {
|
|
194
193
|
loadMoreContainerFloorList()
|
|
195
194
|
}
|
|
196
195
|
})
|
|
197
196
|
}
|
|
198
197
|
}, [])
|
|
199
198
|
const pageScrollToLower = useCallback((evt) => {
|
|
200
199
|
console.log('触发滚动底部位置', evt.detail)
|
|
201
200
|
Taro.eventCenter.trigger(TaroEventType.PAGE_SCROLL_END)
|
|
202
201
|
}, [])
|
|
203
202
|
|
|
204
203
|
const onScrollRecord = (event) => {
|
|
205
204
|
const { detail } = event
|
|
206
205
|
if (detail) {
|
|
207
206
|
taroJdBaseInfo.info.pageInfo.miniScrollInfo = detail
|
|
208
207
|
}
|
|
209
208
|
}
|
|
210
209
|
const renderFloorItem = useCallback(
|
|
211
210
|
(
|
|
212
211
|
item,
|
|
213
212
|
floorItem,
|
|
214
213
|
floorIndex,
|
|
215
214
|
containerLayoutLeftRightMargin,
|
|
216
215
|
borderStyle,
|
|
217
216
|
) => {
|
|
218
217
|
return (
|
|
219
218
|
<View
|
|
220
219
|
className={classNames(shopContainerListStyle['d-floor-item'])}
|
|
221
220
|
id={`J_floor_${floorItem?.uid}`}
|
|
222
221
|
key={floorItem.uid}
|
|
223
222
|
data-floor-uid={floorItem?.uid}
|
|
224
223
|
data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
|
|
225
224
|
style={borderStyle}
|
|
226
225
|
>
|
|
227
226
|
<FloorListItem
|
|
228
227
|
floorIndex={floorIndex}
|
|
229
228
|
floorData={floorItem}
|
|
230
229
|
layoutLeftRightMargin={containerLayoutLeftRightMargin}
|
|
231
230
|
containerBorderRadius={borderStyle}
|
|
232
231
|
updateShopFloorDataFn={updateShopFloorDataFn}
|
|
233
232
|
loadingEndComponentFn={loadingEndComponentFn}
|
|
234
233
|
changeScrollToLowerStateFn={changeScrollToLowerStateFn}
|
|
235
234
|
key={floorItem.uid}
|
|
236
235
|
changeScrollTopFn={changeContainerFloorListScrollTop}
|
|
237
236
|
builtInComponents={builtInComponents}
|
|
238
237
|
/>
|
|
239
238
|
</View>
|
|
240
239
|
)
|
|
241
240
|
},
|
|
242
241
|
[],
|
|
243
242
|
)
|
|
244
243
|
const changeContainerFloorListScrollTop = (top) => {
|
|
245
244
|
if (miniScrollSelf) {
|
|
246
245
|
setContainerFloorListScrollTop(top)
|
|
247
246
|
} else {
|
|
248
247
|
typeof changeLayoutScrollToTopFn == 'function' &&
|
|
249
248
|
changeLayoutScrollToTopFn(top)
|
|
250
249
|
}
|
|
251
250
|
}
|
|
252
251
|
const renderContainerList = () => {
|
|
253
252
|
const listNum = containerFloorList.length || 0
|
|
254
253
|
const getThisSectionTypeListData =
|
|
255
254
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`]
|
|
256
255
|
return (
|
|
257
256
|
<View id="J_shopContainerFloorList">
|
|
258
257
|
{containerFloorListData && containerFloorListData.length > 0 ? (
|
|
259
258
|
listNum > 0 && (
|
|
260
259
|
<>
|
|
261
260
|
{containerFloorList.map((item, index) => {
|
|
262
261
|
const containerLayoutLeftRightMargin =
|
|
263
262
|
(item.marginLeft || 0) + (item.marginRight || 0)
|
|
264
263
|
const getContainerId = `J_container_${item.containerId}`
|
|
265
264
|
const borderStyle = getBorderStyle(
|
|
266
265
|
item,
|
|
267
266
|
index,
|
|
268
267
|
containerFloorList,
|
|
269
268
|
listNum,
|
|
270
269
|
)
|
|
271
270
|
if (index === listNum - 1) item.marginBottom = 8
|
|
272
271
|
return (
|
|
273
272
|
<View
|
|
274
273
|
className={shopContainerListStyle['d-container-item']}
|
|
275
274
|
id={getContainerId}
|
|
276
275
|
key={item.containerId + item.key}
|
|
277
276
|
style={{
|
|
278
277
|
marginBottom: item.marginBottom
|
|
279
278
|
? `${item.marginBottom}px`
|
|
280
279
|
: 0,
|
|
281
280
|
marginTop: item.marginTop ? `${item.marginTop}px` : 0,
|
|
282
281
|
marginLeft: item.marginLeft ? `${item.marginLeft}px` : 0,
|
|
283
282
|
marginRight: item.marginRight
|
|
284
283
|
? `${item.marginRight}px`
|
|
285
284
|
: 0,
|
|
286
285
|
borderTopLeftRadius:
|
|
287
286
|
borderStyle?.borderTopLeftRadius || `0px`,
|
|
288
287
|
borderTopRightRadius:
|
|
289
288
|
borderStyle?.borderTopRightRadiu || `0px`,
|
|
290
289
|
borderBottomLeftRadius:
|
|
291
290
|
borderStyle?.borderBottomLeftRadius || `0px`,
|
|
292
291
|
borderBottomRightRadius:
|
|
293
292
|
borderStyle?.borderBottomRightRadius || `0px`,
|
|
294
293
|
}}
|
|
295
294
|
>
|
|
296
295
|
{item.floors.length > 0 && (
|
|
297
296
|
<>
|
|
298
297
|
{item.floors?.map((floorItem, floorIndex) => {
|
|
299
298
|
return renderFloorItem(
|
|
300
299
|
item,
|
|
301
300
|
floorItem,
|
|
302
301
|
floorIndex,
|
|
303
302
|
containerLayoutLeftRightMargin,
|
|
304
303
|
borderStyle,
|
|
305
304
|
)
|
|
306
305
|
})}
|
|
307
306
|
</>
|
|
308
307
|
)}
|
|
309
308
|
</View>
|
|
310
309
|
)
|
|
311
310
|
})}
|
|
312
311
|
{getThisSectionTypeListData.index <
|
|
313
312
|
getThisSectionTypeListData.max && (
|
|
314
313
|
<JdLoading localState={true} text="加载中..." />
|
|
315
314
|
)}
|
|
316
315
|
{!hasGoodsFeeds &&
|
|
317
316
|
getThisSectionTypeListData.index >=
|
|
318
317
|
getThisSectionTypeListData.max &&
|
|
319
318
|
loadingEndComponentFn &&
|
|
320
319
|
loadingEndComponentFn()}
|
|
321
320
|
</>
|
|
322
321
|
)
|
|
323
322
|
) : (
|
|
324
323
|
<View
|
|
325
324
|
className={shopContainerListStyle['d-container-list-no-data']}
|
|
326
325
|
style={{
|
|
327
326
|
height: `${
|
|
328
327
|
windowHeight -
|
|
329
328
|
actualNavBarHeight -
|
|
330
329
|
MINI_APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT +
|
|
331
330
|
SHOP_TAB_CONTENT_BOTTOM
|
|
332
331
|
}px`,
|
|
333
332
|
}}
|
|
334
333
|
>
|
|
335
334
|
<NetworkDataError
|
|
336
335
|
netWorkShowType={NetWorkShowType.PART}
|
|
337
336
|
netWorkDataType={NETWORK_DATA_TYPE.DATA_ERROR}
|
|
338
337
|
refreshCallBackFn={updateShopFloorDataFn}
|
|
339
338
|
/>
|
|
340
339
|
</View>
|
|
341
340
|
)}
|
|
342
341
|
</View>
|
|
343
342
|
)
|
|
344
343
|
}
|
|
345
344
|
return miniScrollSelf ? (
|
|
346
345
|
<ScrollView
|
|
347
346
|
scrollY
|
|
348
347
|
scrollTop={containerFloorListScrollTop}
|
|
349
348
|
className={classNames(
|
|
350
349
|
className,
|
|
351
350
|
shopContainerListStyle['d-shop-container-list'],
|
|
352
351
|
)}
|
|
353
352
|
onScroll={onScrollRecord}
|
|
354
353
|
lowerThreshold={windowHeight / 2}
|
|
355
354
|
onScrollToLower={loadMoreContainerFloorList}
|
|
356
355
|
style={style}
|
|
357
356
|
>
|
|
358
357
|
{tabContentShowState && renderContainerList()}
|
|
359
358
|
</ScrollView>
|
|
360
359
|
) : (
|
|
361
360
|
<View
|
|
362
361
|
className={classNames(
|
|
363
362
|
className,
|
|
364
363
|
shopContainerListStyle['d-shop-container-list'],
|
|
365
364
|
)}
|
|
366
365
|
style={style}
|
|
367
366
|
>
|
|
368
367
|
{tabContentShowState && renderContainerList()}
|
|
369
368
|
</View>
|
|
370
369
|
)
|
|
370
|
+
import Taro from '@tarojs/taro';
|
|
371
371
|
NETWORK_DATA_TYPE,
|
|
372
372
|
TaroEventType,
|
|
373
373
|
MINI_APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
|
|
374
374
|
SHOP_TAB_CONTENT_BOTTOM,
|
|
375
375
|
let thisListData: ComponentInterFace.ContainerItemData[] | [] = listData.slice(0);
|
|
376
376
|
const thisListDataLen = thisListData.length;
|
|
377
377
|
const res: any[] = [];
|
|
378
378
|
if (thisListDataLen) {
|
|
379
379
|
if (thisListDataLen < num) {
|
|
380
380
|
res.push(thisListData);
|
|
381
381
|
} else {
|
|
382
382
|
while (thisListData.length) {
|
|
383
383
|
if (thisListData.length >= num) {
|
|
384
384
|
res.push(thisListData.splice(0, num));
|
|
385
385
|
} else {
|
|
386
386
|
res.push(thisListData);
|
|
387
387
|
thisListData = [];
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
return res;
|
|
393
393
|
containerFloorListData: ComponentInterFace.ContainerItemData[];
|
|
394
394
|
className?: string;
|
|
395
395
|
sectionType?: string;
|
|
396
396
|
style?: object;
|
|
397
397
|
hasGoodsFeeds?: boolean;
|
|
398
398
|
miniScrollSelf?: boolean;
|
|
399
399
|
tabContentShowState?: boolean;
|
|
400
400
|
loadingEndComponentFn?: functionType;
|
|
401
401
|
updateShopFloorDataFn?: functionType;
|
|
402
402
|
builtInComponents?: object;
|
|
403
403
|
changeScrollToLowerStateFn: functionType | null;
|
|
404
404
|
changeLayoutScrollToTopFn?: functionType;
|
|
405
405
|
triggerMiniLoadProductWithFilterFn?: functionType;
|
|
406
406
|
switchConfig?: {
|
|
407
407
|
[key: string]: any;
|
|
408
408
|
};
|
|
409
409
|
const { windowHeight, actualNavBarHeight } = taroJdBaseInfo.info.sysInfo;
|
|
410
410
|
const {
|
|
411
411
|
className,
|
|
412
412
|
style,
|
|
413
413
|
loadingEndComponentFn,
|
|
414
414
|
hasGoodsFeeds,
|
|
415
415
|
sectionType,
|
|
416
416
|
tabContentShowState,
|
|
417
417
|
containerFloorListData,
|
|
418
418
|
updateShopFloorDataFn,
|
|
419
419
|
changeScrollToLowerStateFn,
|
|
420
420
|
changeLayoutScrollToTopFn,
|
|
421
421
|
triggerMiniLoadProductWithFilterFn,
|
|
422
422
|
builtInComponents,
|
|
423
423
|
miniScrollSelf = false,
|
|
424
424
|
switchConfig,
|
|
425
425
|
} = props;
|
|
426
426
|
const emptyFloorListHidden = switchConfig?.emptyFloorListHidden || false;
|
|
427
427
|
const [containerFloorListScrollTop, setContainerFloorListScrollTop] = useState(0);
|
|
428
428
|
const loadMoreContainerFloorListDataRef = useRef({
|
|
429
429
|
needFirstLoadState: true,
|
|
430
430
|
loadingState: false,
|
|
431
431
|
});
|
|
432
432
|
const isFuncForChangeScrollToLowerStateFn = typeof changeScrollToLowerStateFn === 'function';
|
|
433
433
|
const loadSectionTypeContainerFloorListRef = useRef<{
|
|
434
434
|
[key: string]: ComponentInterFace.MiniLoadFloorListRef;
|
|
435
435
|
}>({
|
|
436
436
|
[`${sectionType}`]: {
|
|
437
437
|
index: 1,
|
|
438
438
|
itemNum: 0,
|
|
439
439
|
list: [],
|
|
440
440
|
loadList: [],
|
|
441
441
|
max: 1,
|
|
442
442
|
},
|
|
443
443
|
});
|
|
444
444
|
const [containerFloorList, setContainerFloorList] = useState<
|
|
445
445
|
ComponentInterFace.ContainerItemData[]
|
|
446
446
|
>(() => {
|
|
447
447
|
|
|
448
448
|
const getLoadDataArr = containerFloorListDataSpliceToPromise(containerFloorListData);
|
|
449
449
|
const getThisSectionTypeListData =
|
|
450
450
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`];
|
|
451
451
|
getThisSectionTypeListData.list = getLoadDataArr;
|
|
452
452
|
getThisSectionTypeListData.itemNum = containerFloorListData.length;
|
|
453
453
|
getThisSectionTypeListData.max = getLoadDataArr.length;
|
|
454
454
|
console.log('获取加载数据总数据----' + sectionType, getLoadDataArr);
|
|
455
455
|
const getThisLoadList = getLoadDataArr.shift();
|
|
456
456
|
if (getThisLoadList) {
|
|
457
457
|
getThisSectionTypeListData.loadList = getThisLoadList;
|
|
458
458
|
return getThisLoadList;
|
|
459
459
|
} else {
|
|
460
460
|
return [];
|
|
461
461
|
}
|
|
462
462
|
});
|
|
463
463
|
useEffect(() => {
|
|
464
464
|
if (containerFloorList.length > 0) {
|
|
465
465
|
Taro.nextTick(() => {
|
|
466
466
|
const getThisSectionTypeListData =
|
|
467
467
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`];
|
|
468
468
|
console.log(
|
|
469
469
|
`加载${sectionType}中第${getThisSectionTypeListData.index}批次${LOAD_FLOOR_BATCH_NUM}个模块完毕,共计${getThisSectionTypeListData.max}轮,楼层总计${getThisSectionTypeListData.itemNum}`,
|
|
470
470
|
);
|
|
471
471
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState &&
|
|
472
472
|
checkLoadFloorListLoadState().then((needLoadState) => {
|
|
473
473
|
console.log('检查是否需要继续加载状态', needLoadState);
|
|
474
474
|
if (needLoadState) {
|
|
475
475
|
const getThisLoadList = getThisSectionTypeListData.list.shift();
|
|
476
476
|
if (getThisLoadList) {
|
|
477
477
|
getThisSectionTypeListData.index++;
|
|
478
478
|
const changeContainerList: ComponentInterFace.ContainerItemData[] = [
|
|
479
479
|
...getThisSectionTypeListData.loadList,
|
|
480
480
|
...getThisLoadList,
|
|
481
481
|
];
|
|
482
482
|
getThisSectionTypeListData.loadList = changeContainerList;
|
|
483
483
|
setContainerFloorList(changeContainerList);
|
|
484
484
|
} else {
|
|
485
485
|
Taro.hideLoading();
|
|
486
486
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState = false;
|
|
487
487
|
}
|
|
488
488
|
} else {
|
|
489
489
|
Taro.hideLoading();
|
|
490
490
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState = false;
|
|
491
491
|
}
|
|
492
492
|
});
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
}, [containerFloorList]);
|
|
496
496
|
|
|
497
497
|
const checkLoadFloorListLoadState = () => {
|
|
498
498
|
return new Promise((resolve) => {
|
|
499
499
|
Taro.createSelectorQuery()
|
|
500
500
|
.select('#J_shopContainerFloorList')
|
|
501
501
|
.boundingClientRect(function (rect) {
|
|
502
502
|
if (rect) {
|
|
503
503
|
if (rect.height && rect.height < windowHeight + 100) {
|
|
504
504
|
resolve(true);
|
|
505
505
|
} else {
|
|
506
506
|
resolve(false);
|
|
507
507
|
}
|
|
508
508
|
} else {
|
|
509
509
|
resolve(true);
|
|
510
510
|
}
|
|
511
511
|
})
|
|
512
512
|
.exec();
|
|
513
513
|
});
|
|
514
514
|
};
|
|
515
515
|
|
|
516
516
|
const loadMoreContainerFloorList = (evt: any = false) => {
|
|
517
517
|
const getThisSectionTypeListData =
|
|
518
518
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`];
|
|
519
519
|
if (
|
|
520
520
|
!loadMoreContainerFloorListDataRef.current.loadingState &&
|
|
521
521
|
getThisSectionTypeListData.list.length > 0
|
|
522
522
|
) {
|
|
523
523
|
loadMoreContainerFloorListDataRef.current.loadingState = true;
|
|
524
524
|
getThisSectionTypeListData.index++;
|
|
525
525
|
console.log(`当前即将加载${sectionType}中第${getThisSectionTypeListData.index}轮`);
|
|
526
526
|
const getThisLoadList = getThisSectionTypeListData.list.shift();
|
|
527
527
|
if (getThisLoadList) {
|
|
528
528
|
const changeFloorList = [...getThisSectionTypeListData.loadList, ...getThisLoadList];
|
|
529
529
|
getThisSectionTypeListData.loadList = changeFloorList;
|
|
530
530
|
loadMoreContainerFloorListDataRef.current.loadingState = false;
|
|
531
531
|
isFuncForChangeScrollToLowerStateFn && changeScrollToLowerStateFn(false);
|
|
532
532
|
setContainerFloorList(changeFloorList);
|
|
533
533
|
Taro.nextTick(() => {
|
|
534
534
|
if (getThisSectionTypeListData.list.length == 0) {
|
|
535
535
|
typeof triggerMiniLoadProductWithFilterFn === 'function' &&
|
|
536
536
|
triggerMiniLoadProductWithFilterFn();
|
|
537
537
|
}
|
|
538
538
|
});
|
|
539
539
|
} else {
|
|
540
540
|
isFuncForChangeScrollToLowerStateFn && changeScrollToLowerStateFn(false);
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
543
|
if (
|
|
544
544
|
miniScrollSelf &&
|
|
545
545
|
evt &&
|
|
546
546
|
!loadMoreContainerFloorListDataRef.current.loadingState &&
|
|
547
547
|
getThisSectionTypeListData.index >= getThisSectionTypeListData.max
|
|
548
548
|
) {
|
|
549
549
|
pageScrollToLower(evt);
|
|
550
550
|
}
|
|
551
551
|
};
|
|
552
552
|
useEffect(() => {
|
|
553
553
|
if (!miniScrollSelf) {
|
|
554
554
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL_END, (tabActiveType) => {
|
|
555
555
|
if (tabActiveType == sectionType && tabContentShowState) {
|
|
556
556
|
loadMoreContainerFloorList();
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
559
|
}
|
|
560
560
|
}, []);
|
|
561
561
|
const pageScrollToLower = useCallback((evt) => {
|
|
562
562
|
console.log('触发滚动底部位置', evt.detail);
|
|
563
563
|
Taro.eventCenter.trigger(TaroEventType.PAGE_SCROLL_END);
|
|
564
564
|
}, []);
|
|
565
565
|
|
|
566
566
|
const onScrollRecord = (event) => {
|
|
567
567
|
const { detail } = event;
|
|
568
568
|
if (detail) {
|
|
569
569
|
taroJdBaseInfo.info.pageInfo.miniScrollInfo = detail;
|
|
570
570
|
}
|
|
571
571
|
};
|
|
572
572
|
const renderFloorItem = useCallback(
|
|
573
573
|
(item, floorItem, floorIndex, containerLayoutLeftRightMargin, borderStyle) => {
|
|
574
574
|
return (
|
|
575
575
|
<View
|
|
576
576
|
className={classNames(shopContainerListStyle['d-floor-item'])}
|
|
577
577
|
id={`J_floor_${floorItem?.uid}`}
|
|
578
578
|
key={floorItem.uid}
|
|
579
579
|
data-floor-uid={floorItem?.uid}
|
|
580
580
|
data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
|
|
581
581
|
style={borderStyle}
|
|
582
582
|
>
|
|
583
583
|
<FloorListItem
|
|
584
584
|
floorIndex={floorIndex}
|
|
585
585
|
floorData={floorItem}
|
|
586
586
|
layoutLeftRightMargin={containerLayoutLeftRightMargin}
|
|
587
587
|
containerBorderRadius={borderStyle}
|
|
588
588
|
updateShopFloorDataFn={updateShopFloorDataFn}
|
|
589
589
|
loadingEndComponentFn={loadingEndComponentFn}
|
|
590
590
|
changeScrollToLowerStateFn={changeScrollToLowerStateFn}
|
|
591
591
|
key={floorItem.uid}
|
|
592
592
|
changeScrollTopFn={changeContainerFloorListScrollTop}
|
|
593
593
|
builtInComponents={builtInComponents}
|
|
594
594
|
/>
|
|
595
595
|
</View>
|
|
596
596
|
);
|
|
597
597
|
},
|
|
598
598
|
[],
|
|
599
599
|
);
|
|
600
600
|
const changeContainerFloorListScrollTop = (top) => {
|
|
601
601
|
if (miniScrollSelf) {
|
|
602
602
|
setContainerFloorListScrollTop(top);
|
|
603
603
|
} else {
|
|
604
604
|
typeof changeLayoutScrollToTopFn === 'function' && changeLayoutScrollToTopFn(top);
|
|
605
605
|
}
|
|
606
606
|
};
|
|
607
607
|
const renderContainerList = () => {
|
|
608
608
|
const listNum = containerFloorList.length || 0;
|
|
609
609
|
const getThisSectionTypeListData =
|
|
610
610
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`];
|
|
611
611
|
return (
|
|
612
612
|
<View id="J_shopContainerFloorList">
|
|
613
613
|
{containerFloorListData && containerFloorListData.length > 0 ? (
|
|
614
614
|
listNum > 0 && (
|
|
615
615
|
<>
|
|
616
616
|
{containerFloorList.map((item, index) => {
|
|
617
617
|
const containerLayoutLeftRightMargin =
|
|
618
618
|
(item.marginLeft || 0) + (item.marginRight || 0);
|
|
619
619
|
const getContainerId = `J_container_${item.containerId}`;
|
|
620
620
|
const borderStyle = getBorderStyle(item, index, containerFloorList, listNum);
|
|
621
621
|
if (index === listNum - 1) item.marginBottom = 8;
|
|
622
622
|
return (
|
|
623
623
|
<View
|
|
624
624
|
className={shopContainerListStyle['d-container-item']}
|
|
625
625
|
id={getContainerId}
|
|
626
626
|
key={item.containerId + item.key}
|
|
627
627
|
style={{
|
|
628
628
|
marginBottom: item.marginBottom ? `${item.marginBottom}px` : 0,
|
|
629
629
|
marginTop: item.marginTop ? `${item.marginTop}px` : 0,
|
|
630
630
|
marginLeft: item.marginLeft ? `${item.marginLeft}px` : 0,
|
|
631
631
|
marginRight: item.marginRight ? `${item.marginRight}px` : 0,
|
|
632
632
|
borderTopLeftRadius: borderStyle?.borderTopLeftRadius || `0px`,
|
|
633
633
|
borderTopRightRadius: borderStyle?.borderTopRightRadiu || `0px`,
|
|
634
634
|
borderBottomLeftRadius: borderStyle?.borderBottomLeftRadius || `0px`,
|
|
635
635
|
borderBottomRightRadius: borderStyle?.borderBottomRightRadius || `0px`,
|
|
636
636
|
}}
|
|
637
637
|
>
|
|
638
638
|
{item.floors.length > 0 && (
|
|
639
639
|
<>
|
|
640
640
|
{item.floors?.map((floorItem, floorIndex) => {
|
|
641
641
|
return renderFloorItem(
|
|
642
642
|
item,
|
|
643
643
|
floorItem,
|
|
644
644
|
floorIndex,
|
|
645
645
|
containerLayoutLeftRightMargin,
|
|
646
646
|
borderStyle,
|
|
647
647
|
);
|
|
648
648
|
})}
|
|
649
649
|
</>
|
|
650
650
|
)}
|
|
651
651
|
</View>
|
|
652
652
|
);
|
|
653
653
|
})}
|
|
654
654
|
{getThisSectionTypeListData.index < getThisSectionTypeListData.max && (
|
|
655
655
|
<JdLoading localState={true} text="加载中..." />
|
|
656
656
|
)}
|
|
657
657
|
{!hasGoodsFeeds &&
|
|
658
658
|
getThisSectionTypeListData.index >= getThisSectionTypeListData.max &&
|
|
659
659
|
loadingEndComponentFn &&
|
|
660
660
|
loadingEndComponentFn()}
|
|
661
661
|
</>
|
|
662
662
|
)
|
|
663
663
|
) : !emptyFloorListHidden ? (
|
|
664
664
|
<View
|
|
665
665
|
className={shopContainerListStyle['d-container-list-no-data']}
|
|
666
666
|
style={{
|
|
667
667
|
height: `${
|
|
668
668
|
windowHeight -
|
|
669
669
|
actualNavBarHeight -
|
|
670
670
|
MINI_APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT +
|
|
671
671
|
SHOP_TAB_CONTENT_BOTTOM
|
|
672
672
|
}px`,
|
|
673
673
|
}}
|
|
674
674
|
>
|
|
675
675
|
<NetworkDataError
|
|
676
676
|
netWorkShowType={NetWorkShowType.PART}
|
|
677
677
|
netWorkDataType={NETWORK_DATA_TYPE.DATA_ERROR}
|
|
678
678
|
refreshCallBackFn={updateShopFloorDataFn}
|
|
679
679
|
/>
|
|
680
680
|
</View>
|
|
681
681
|
) : null}
|
|
682
682
|
</View>
|
|
683
683
|
);
|
|
684
684
|
};
|
|
685
685
|
return miniScrollSelf ? (
|
|
686
686
|
<ScrollView
|
|
687
687
|
scrollY
|
|
688
688
|
scrollTop={containerFloorListScrollTop}
|
|
689
689
|
className={classNames(className, shopContainerListStyle['d-shop-container-list'])}
|
|
690
690
|
onScroll={onScrollRecord}
|
|
691
691
|
lowerThreshold={windowHeight / 2}
|
|
692
692
|
onScrollToLower={loadMoreContainerFloorList}
|
|
693
693
|
style={style}
|
|
694
694
|
>
|
|
695
695
|
{tabContentShowState && renderContainerList()}
|
|
696
696
|
</ScrollView>
|
|
697
697
|
) : (
|
|
698
698
|
<View
|
|
699
699
|
className={classNames(className, shopContainerListStyle['d-shop-container-list'])}
|
|
700
700
|
style={style}
|
|
701
701
|
>
|
|
702
702
|
{tabContentShowState && renderContainerList()}
|
|
703
703
|
</View>
|
|
704
704
|
);
|