@conecli/cone-render 0.9.1-shop2.12 → 0.9.1-shop2.14

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.
Files changed (35) hide show
  1. package/dist/common/const.ts +1 -1
  2. package/dist/common/index.h5.ts +1 -1
  3. package/dist/common/index.weapp.ts +1 -1
  4. package/dist/common/sgmCustomCode.ts +1 -1
  5. package/dist/components/ErrorBoundary.tsx +1 -1
  6. package/dist/components/base/CustomVideo/index.tsx +1 -1
  7. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  8. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  9. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  10. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  11. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  12. package/dist/components/remoteFloorItem.tsx +1 -1
  13. package/dist/interface/component.ts +1 -1
  14. package/dist/jumpEventReport/base.ts +1 -1
  15. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  16. package/dist/jumpEventReport/web.base.ts +1 -1
  17. package/dist/jumpEventReport/web.jd.ts +1 -1
  18. package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -0
  19. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  20. package/dist/open/api/device.ts +1 -1
  21. package/dist/open/api/request.ts +1 -1
  22. package/dist/open/api/shopMember.ts +1 -1
  23. package/dist/open/api/util.ts +1 -1
  24. package/dist/open/components/index.ts +1 -1
  25. package/dist/sass/app.h5.scss +5 -0
  26. package/dist/service/requestServer.ts +1 -1
  27. package/dist/utils/connectNativeJsBridge.ts +1 -1
  28. package/dist/utils/h5Utils.ts +1 -1
  29. package/dist/utils/index.h5.ts +1 -1
  30. package/dist/utils/index.ts +1 -1
  31. package/dist/utils/index.weapp.ts +1 -1
  32. package/dist/utils/sgmCodeUtils.ts +1 -1
  33. package/dist/utils/taroRenderUtil.ts +1 -1
  34. package/dist/utils/utils.ts +1 -1
  35. package/package.json +1 -1
@@ -1 +1 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react'
2
1
  TaroEventType,
3
2
  const {
4
3
  src,
5
4
  lazyLoad,
6
5
  imagRenderingSet,
7
6
  width,
8
7
  height,
9
8
  className,
10
9
  isSkuImage,
11
10
  hideErrorImage,
12
11
  style,
13
12
  backgroundColor,
14
13
  errorSrc,
15
14
  onLoad,
16
15
  onError,
17
16
  ...otherOption
18
17
  } = props
19
18
  getNetWorkType === NetWorkTypeQuality.default &&
20
19
  (getNetWorkType = global.info.sysInfo.netWorkType)
21
20
  const [loadSuccess, setLoadSuccess] = useState(false)
22
21
  const [imageErrState, setImageErrState] = useState(false)
23
22
  const [componentShowState, setComponentShowState] = useState(false)
24
23
  const measureRef = useRef < HTMLElement | null > (null)
25
24
  const [measureComplete, setMeasureComplete] = useState(false)
26
25
  const [imgSrc, setImgSrc] = useState(src)
27
26
  const [hasRetrySuccess, setHasRetrySuccess] = useState(false)
28
27
  const hasRetryRef = useRef(false)
29
28
  const componentShowStateRef = useRef(false)
30
29
  const requestSrcRef = useRef(src)
31
30
  const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
32
31
  const enableAvifOptimize = isImageOptimizeEnable()
33
32
 
34
33
  const getRequestSrc = useCallback((src) => {
35
34
  const requestSrc = getQualityImage(
36
35
  imgSrc,
37
36
  { isSkuImage, size: measureRef?.current?.offsetWidth }
38
37
  )
39
38
  requestSrcRef.current = requestSrc
40
39
  return requestSrc
41
40
  }, [src])
42
41
  const imageErrorRetry = (src) => {
43
42
  return new Promise((resolve, reject) => {
44
43
  if(fetch && window && window.Image){
45
44
  fetch(src)
46
45
  .then(response => {
47
46
  const {ok, status} = response
48
47
  if (ok) {
49
48
  response.blob().then(blob => {
50
49
  const url = URL.createObjectURL(blob)
51
50
  const img = new window.Image()
52
51
  img.src = url;
53
52
  img.onload = () => {
54
53
  resolve({
55
54
  ok: true,
56
55
  url
57
56
  })
58
57
  setTimeout(() => {
59
58
  URL.revokeObjectURL(url)
60
59
  }, 1000)
61
60
  };
62
61
  img.onerror = () => {
63
62
  resolve({
64
63
  ok: false,
65
64
  text: '图片解析异常',
66
65
  type: 'imageParseError',
67
66
  })
68
67
  URL.revokeObjectURL(url)
69
68
  };
70
69
  })
71
70
  }else {
72
71
  if(status === 404){
73
72
  resolve({
74
73
  ok: false,
75
74
  text: '访问图片不存在',
76
75
  type: 'noSuchUrlImage',
77
76
  })
78
77
  }else{
79
78
  resolve({
80
79
  ok: false,
81
80
  status: status,
82
81
  text: '其它图片问题',
83
82
  type: 'otherImageError',
84
83
  })
85
84
  }
86
85
  }
87
86
  })
88
87
  .catch(error => {
89
88
  resolve({
90
89
  ok: false,
91
90
  text: '网络异常',
92
91
  type: 'networkError',
93
92
  })
94
93
  console.error('LazyLoadImage imageErrorRetry() error:', error)
95
94
  });
96
95
  }else{
97
96
  resolve({
98
97
  ok: false,
99
98
  text: '不支持重试',
100
99
  type: 'notSupportRetry',
101
100
  })
102
101
  }
103
102
  })
104
103
 
105
104
  const imageErrorHandle = useCallback(
106
105
  (e) => {
107
106
  console.log(' ==============> 图片加载错误', e)
108
107
  if (!hasRetryRef.current) {
109
108
  hasRetryRef.current = true
110
109
  if(src){
111
110
  try{
112
111
  imageErrorRetry(requestSrcRef.current).then((result) => {
113
112
  const { status, ok, text, type, url } = result || {}
114
113
  if(ok){
115
114
  setImgSrc(url)
116
115
  setHasRetrySuccess(true)
117
116
  }else{
118
117
  errorSrc && setImgSrc(errorSrc)
119
118
  hideErrorImage && setImageErrState(true)
120
119
  typeof onError === 'function' && onError(e, src, props)
121
120
  const { shopId, venderId } = global.info.queryInfo || {}
122
121
  sgmCustomReport({
123
122
  code: getSgmCustomCode(`${SgmCustomCode.IMAGE_LOAD}_${type}`),
124
123
  msg: {
125
124
  shopId,
126
125
  venderId,
127
126
  originSrc: src,
128
127
  requestSrc: requestSrcRef.current,
129
128
  status,
130
129
  text
131
130
  },
132
131
  })
133
132
  }
134
133
  })
135
134
  }catch(e){
136
135
  console.error('LazyLoadImage imageErrorHandle() error:', e)
137
136
  errorSrc && setImgSrc(errorSrc)
138
137
  hideErrorImage && setImageErrState(true)
139
138
  typeof onError === 'function' && onError(e, src, props)
140
139
  }
141
140
  }
142
141
  }
143
142
  },
144
143
  [src, hasRetryRef.current],
145
144
  )
146
145
 
147
146
 
148
147
  const imageLoad = useCallback(
149
148
  (_src, event) => {
150
149
  setLoadSuccess(true)
151
150
  typeof onLoad === 'function' && onLoad(event, src, props)
152
151
  },
153
152
  [src],
154
153
  )
155
154
 
156
155
  const changeStyleIncludeWidthAndHeightAndBgColor = () => {
157
156
  const changeStyle = {}
158
157
  width && (changeStyle['width'] = width)
159
158
  height && (changeStyle['height'] = height)
160
159
  backgroundColor && (changeStyle['backgroundColor'] = backgroundColor)
161
160
  return changeStyle
162
161
  }
163
162
  useEffect(() => {
164
163
  setMeasureComplete(true)
165
164
  if (needShowHighVersion) return
166
165
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
167
166
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
168
167
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
169
168
  !componentShowStateRef.current && dealPageScrollInfo(res)
170
169
  })
171
170
  }, [])
172
171
 
173
172
  const dealPageScrollInfo = (res) => {
174
173
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
175
174
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
176
175
  if (measureRef.current) {
177
176
  const eleClientRect =
178
177
  measureRef.current.getBoundingClientRect()
179
178
  const getContainerHeightOffSetY =
180
179
  displayHeight * 1.5 + offSetY
181
180
  const eleOffsetTop = Math.ceil(eleClientRect.top)
182
181
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
183
182
  if (!componentShowStateRef.current) {
184
183
  if (getContainerHeightOffSetY > eleOffsetTop) {
185
184
  componentShowStateRef.current = true
186
185
  setComponentShowState(true)
187
186
  }
188
187
  }
189
188
  }
190
189
  }
191
190
  return (
192
191
  isH5AndJdShopView &&
193
192
  global?.config?.needImageLazy !== false &&
194
193
  !needShowHighVersion &&
195
194
  !isAppStowShop ? (
196
195
  <View
197
196
  ref={measureRef}
198
197
  className={classNames(
199
198
  imageStyle["d-app-lazy-image"],
200
199
  {
201
200
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
202
201
  },
203
202
  {
204
203
  [imageStyle["d-hide-image-error"]]: imageErrState,
205
204
  },
206
205
  {
207
206
  [imageStyle["d-load-completed"]]: loadSuccess,
208
207
  },
209
208
  {
210
209
  "d-imag-rendering-crisp-edges":
211
210
  !global.info.pageInfo.isVipShop && imagRenderingSet,
212
211
  },
213
212
  "J_html5ImageBg",
214
213
  className
215
214
  )}
216
215
  style={{
217
216
  ...style,
218
217
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
219
218
  }}
220
219
  {...otherOption}
221
220
  >
222
221
  {(componentShowState || lazyLoad === false) && (
223
222
  <img
224
223
  src={getQualityImage(
225
224
  imgSrc,
226
225
  global.info.pageInfo.isVipShop
227
226
  ? NetWorkTypeQuality["perfect"]
228
227
  : NetWorkTypeQuality[getNetWorkType]
229
228
  )}
230
229
  onLoad={imageLoad.bind(this, imgSrc)}
231
230
  onError={imageErrorHandle}
232
231
  />
233
232
  )}
234
233
  </View>
235
234
  ) : enableAvifOptimize ? (
236
235
  [
237
236
  measureComplete ? (
238
237
  <Image
239
238
  key={hasRetrySuccess? "realImageRetry": "realImage"}
240
239
  style={{
241
240
  ...style,
242
241
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
243
242
  }}
244
243
  className={classNames(
245
244
  imageStyle["d-lazy-image"],
246
245
  {
247
246
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
248
247
  },
249
248
  {
250
249
  [imageStyle["d-hide-image-error"]]: imageErrState,
251
250
  },
252
251
  {
253
252
  [imageStyle["d-load-completed"]]: loadSuccess,
254
253
  },
255
254
  {
256
255
  "d-imag-rendering-crisp-edges": imagRenderingSet,
257
256
  },
258
257
  className
259
258
  )}
260
259
  src={hasRetrySuccess? imgSrc: getRequestSrc(imgSrc)}
261
260
  lazyLoad={isChartH5 ? false : lazyLoad}
262
261
  onError={imageErrorHandle}
263
262
  onLoad={imageLoad.bind(this, imgSrc)}
264
263
  {...otherOption}
265
264
  />
266
265
  ) : (
267
266
  <Image
268
267
  key={"defaultImage"}
269
268
  style={{
270
269
  ...style,
271
270
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
272
271
  }}
273
272
  className={classNames(
274
273
  imageStyle["d-lazy-image"],
275
274
  {
276
275
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
277
276
  },
278
277
  {
279
278
  [imageStyle["d-hide-image-error"]]: imageErrState,
280
279
  },
281
280
  {
282
281
  [imageStyle["d-load-completed"]]: loadSuccess,
283
282
  },
284
283
  {
285
284
  "d-imag-rendering-crisp-edges": imagRenderingSet,
286
285
  },
287
286
  className
288
287
  )}
289
288
  src={isSkuImage ? DEFAULT_SKU_SRC : DEFAULT_SRC}
290
289
  />
291
290
  ),
292
291
  loadSuccess ? null : <View key={"measureRef"} ref={measureRef}></View>,
293
292
  ]
294
293
  ) : (
295
294
  <Image
296
295
  style={{
297
296
  ...style,
298
297
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
299
298
  }}
300
299
  className={classNames(
301
300
  imageStyle["d-lazy-image"],
302
301
  {
303
302
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
304
303
  },
305
304
  {
306
305
  [imageStyle["d-hide-image-error"]]: imageErrState,
307
306
  },
308
307
  {
309
308
  [imageStyle["d-load-completed"]]: loadSuccess,
310
309
  },
311
310
  {
312
311
  "d-imag-rendering-crisp-edges": imagRenderingSet,
313
312
  },
314
313
  className
315
314
  )}
316
315
  src={getQualityImage(imgSrc, NetWorkTypeQuality[getNetWorkType])}
317
316
  lazyLoad={isChartH5 ? false : lazyLoad}
318
317
  onError={imageErrorHandle}
319
318
  onLoad={imageLoad.bind(this, imgSrc)}
320
319
  {...otherOption}
321
320
  />
322
321
  )
323
322
  )
324
323
  lazyLoad: true,
325
324
  isSkuImage: false,
326
325
  hideErrorImage: false,
327
326
  imagRenderingSet: true,
328
327
  src: null,
329
328
  style: null,
330
329
  width: null,
331
330
  height: null,
332
331
  backgroundColor: null,
333
332
  className: null,
334
333
  errorSrc: null,
335
334
  onLoad: null,
336
335
  onError: null,
336
+ import React, { useCallback, useEffect, useRef, useState } from 'react'
337
337
  TaroEventType,
338
338
  const {
339
339
  src,
340
340
  lazyLoad,
341
341
  imagRenderingSet,
342
342
  width,
343
343
  height,
344
344
  className,
345
345
  isSkuImage,
346
346
  hideErrorImage,
347
347
  style,
348
348
  backgroundColor,
349
349
  errorSrc,
350
350
  onLoad,
351
351
  onError,
352
352
  ...otherOption
353
353
  } = props
354
354
  getNetWorkType === NetWorkTypeQuality.default &&
355
355
  (getNetWorkType = global.info.sysInfo.netWorkType)
356
356
  const [loadSuccess, setLoadSuccess] = useState(false)
357
357
  const [imageErrState, setImageErrState] = useState(false)
358
358
  const [componentShowState, setComponentShowState] = useState(false)
359
359
  const measureRef = useRef < HTMLElement | null > (null)
360
360
  const [measureComplete, setMeasureComplete] = useState(false)
361
361
  const [imgSrc, setImgSrc] = useState(src)
362
362
  const [hasRetrySuccess, setHasRetrySuccess] = useState(false)
363
363
  const hasRetryRef = useRef(false)
364
364
  const componentShowStateRef = useRef(false)
365
365
  const requestSrcRef = useRef(src)
366
366
  const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
367
367
  const enableAvifOptimize = isImageOptimizeEnable()
368
368
  const avifSupport = getAvifSupport()
369
369
  const webpSupport = getWebpSupport()
370
370
 
371
371
 
372
372
  const getRequestSrc = useCallback((src) => {
373
373
  const requestSrc = getQualityImage(
374
374
  imgSrc,
375
375
  { isSkuImage, size: measureRef?.current?.offsetWidth }
376
376
  )
377
377
  requestSrcRef.current = requestSrc
378
378
  return requestSrc
379
379
  }, [src])
380
380
  const imageErrorRetry = (src) => {
381
381
  return new Promise((resolve, reject) => {
382
382
  if(fetch && window && window.Image){
383
383
  fetch(src)
384
384
  .then(response => {
385
385
  const {ok, status} = response
386
386
  if (ok) {
387
387
  const originUrl = src.replace(/\.(jpe?g|png).*/, '.$1')
388
388
  response.blob().then(blob => {
389
389
  if(URL){
390
390
  const url = URL.createObjectURL(blob)
391
391
  const img = new window.Image()
392
392
  img.src = url;
393
393
  img.onload = () => {
394
394
  resolve({
395
395
  ok: true,
396
396
  url
397
397
  })
398
398
  setTimeout(() => {
399
399
  URL.revokeObjectURL(url)
400
400
  }, 1000)
401
401
  };
402
402
  img.onerror = () => {
403
403
  reportSGM({status, text: '图片解析异常', type: 'imageParseError', requestSrc: src})
404
404
  URL.revokeObjectURL(url)
405
405
  resolve({
406
406
  ok: true,
407
407
  url: originUrl
408
408
  })
409
409
  };
410
410
  }else{
411
411
  resolve({
412
412
  ok: true,
413
413
  url: originUrl
414
414
  })
415
415
  }
416
416
  }).catch(error => {
417
417
  resolve({
418
418
  ok: true,
419
419
  url: originUrl
420
420
  })
421
421
  console.error('LazyLoadImage imageErrorRetry() error:', error)
422
422
  });
423
423
  }else {
424
424
  if(status === 404){
425
425
  resolve({
426
426
  ok: false,
427
427
  text: '访问图片不存在',
428
428
  type: 'noSuchUrlImage',
429
429
  })
430
430
  }else{
431
431
  resolve({
432
432
  ok: false,
433
433
  status: status,
434
434
  text: '其它图片问题',
435
435
  type: 'otherImageError',
436
436
  })
437
437
  }
438
438
  }
439
439
  })
440
440
  .catch(error => {
441
441
  resolve({
442
442
  ok: false,
443
443
  text: '网络异常',
444
444
  type: 'networkError',
445
445
  })
446
446
  console.error('LazyLoadImage imageErrorRetry() error:', error)
447
447
  });
448
448
  }else{
449
449
  resolve({
450
450
  ok: false,
451
451
  text: '不支持重试',
452
452
  type: 'notSupportRetry',
453
453
  })
454
454
  }
455
455
  })
456
456
 
457
457
 
458
458
  const reportSGM = ({status, text, type, requestSrc = imgSrc}) => {
459
459
  const { shopId, venderId } = global.info.queryInfo || {}
460
460
  sgmCustomReport({
461
461
  code: getSgmCustomCode(`${SgmCustomCode.IMAGE_LOAD}_${type}`),
462
462
  msg: {
463
463
  avifSupport,
464
464
  webpSupport,
465
465
  shopId,
466
466
  venderId,
467
467
  originSrc: src,
468
468
  requestSrc,
469
469
  status,
470
470
  text
471
471
  },
472
472
  })
473
473
  }
474
474
  const imageErrorHandle = useCallback(
475
475
  (e) => {
476
476
  console.log(' ==============> 图片加载错误', e)
477
477
  if (!hasRetryRef.current) {
478
478
  hasRetryRef.current = true
479
479
  if(src){
480
480
  try{
481
481
  imageErrorRetry(requestSrcRef.current).then((result) => {
482
482
  const { status, ok, text, type, url } = result || {}
483
483
  if(ok){
484
484
  setImgSrc(url)
485
485
  setHasRetrySuccess(true)
486
486
  }else{
487
487
  errorSrc && setImgSrc(errorSrc)
488
488
  hideErrorImage && setImageErrState(true)
489
489
  typeof onError === 'function' && onError(e, src, props)
490
490
  reportSGM({status, text, type, requestSrc: requestSrcRef.current})
491
491
  }
492
492
  })
493
493
  }catch(e){
494
494
  console.error('LazyLoadImage imageErrorHandle() error:', e)
495
495
  errorSrc && setImgSrc(errorSrc)
496
496
  hideErrorImage && setImageErrState(true)
497
497
  typeof onError === 'function' && onError(e, src, props)
498
498
  }
499
499
  }
500
500
  }else{
501
501
  reportSGM({status: '', text: '渲染原始图片渲染异常', type: 'renderOriginImageError'})
502
502
  }
503
503
  },
504
504
  [src, hasRetryRef.current],
505
505
  )
506
506
 
507
507
 
508
508
  const imageLoad = useCallback(
509
509
  (_src, event) => {
510
510
  setLoadSuccess(true)
511
511
  typeof onLoad === 'function' && onLoad(event, src, props)
512
512
  },
513
513
  [src],
514
514
  )
515
515
 
516
516
  const changeStyleIncludeWidthAndHeightAndBgColor = () => {
517
517
  const changeStyle = {}
518
518
  width && (changeStyle['width'] = width)
519
519
  height && (changeStyle['height'] = height)
520
520
  backgroundColor && (changeStyle['backgroundColor'] = backgroundColor)
521
521
  return changeStyle
522
522
  }
523
523
  useEffect(() => {
524
524
  setMeasureComplete(true)
525
525
  if (needShowHighVersion) return
526
526
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
527
527
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
528
528
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
529
529
  !componentShowStateRef.current && dealPageScrollInfo(res)
530
530
  })
531
531
  }, [])
532
532
 
533
533
  const dealPageScrollInfo = (res) => {
534
534
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
535
535
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
536
536
  if (measureRef.current) {
537
537
  const eleClientRect =
538
538
  measureRef.current.getBoundingClientRect()
539
539
  const getContainerHeightOffSetY =
540
540
  displayHeight * 1.5 + offSetY
541
541
  const eleOffsetTop = Math.ceil(eleClientRect.top)
542
542
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
543
543
  if (!componentShowStateRef.current) {
544
544
  if (getContainerHeightOffSetY > eleOffsetTop) {
545
545
  componentShowStateRef.current = true
546
546
  setComponentShowState(true)
547
547
  }
548
548
  }
549
549
  }
550
550
  }
551
551
  return (
552
552
  isH5AndJdShopView &&
553
553
  global?.config?.needImageLazy !== false &&
554
554
  !needShowHighVersion &&
555
555
  !isAppStowShop ? (
556
556
  <View
557
557
  ref={measureRef}
558
558
  className={classNames(
559
559
  imageStyle["d-app-lazy-image"],
560
560
  {
561
561
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
562
562
  },
563
563
  {
564
564
  [imageStyle["d-hide-image-error"]]: imageErrState,
565
565
  },
566
566
  {
567
567
  [imageStyle["d-load-completed"]]: loadSuccess,
568
568
  },
569
569
  {
570
570
  "d-imag-rendering-crisp-edges":
571
571
  !global.info.pageInfo.isVipShop && imagRenderingSet,
572
572
  },
573
573
  "J_html5ImageBg",
574
574
  className
575
575
  )}
576
576
  style={{
577
577
  ...style,
578
578
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
579
579
  }}
580
580
  {...otherOption}
581
581
  >
582
582
  {(componentShowState || lazyLoad === false) && (
583
583
  <img
584
584
  src={getQualityImage(
585
585
  imgSrc,
586
586
  global.info.pageInfo.isVipShop
587
587
  ? NetWorkTypeQuality["perfect"]
588
588
  : NetWorkTypeQuality[getNetWorkType]
589
589
  )}
590
590
  onLoad={imageLoad.bind(this, imgSrc)}
591
591
  onError={imageErrorHandle}
592
592
  />
593
593
  )}
594
594
  </View>
595
595
  ) : enableAvifOptimize ? (
596
596
  [
597
597
  measureComplete ? (
598
598
  <Image
599
599
  key={hasRetrySuccess? "realImageRetry": "realImage"}
600
600
  style={{
601
601
  ...style,
602
602
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
603
603
  }}
604
604
  className={classNames(
605
605
  imageStyle["d-lazy-image"],
606
606
  {
607
607
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
608
608
  },
609
609
  {
610
610
  [imageStyle["d-hide-image-error"]]: imageErrState,
611
611
  },
612
612
  {
613
613
  [imageStyle["d-load-completed"]]: loadSuccess,
614
614
  },
615
615
  {
616
616
  "d-imag-rendering-crisp-edges": imagRenderingSet,
617
617
  },
618
618
  className
619
619
  )}
620
620
  src={hasRetrySuccess? imgSrc: getRequestSrc(imgSrc)}
621
621
  lazyLoad={isChartH5 ? false : lazyLoad}
622
622
  onError={imageErrorHandle}
623
623
  onLoad={imageLoad.bind(this, imgSrc)}
624
624
  {...otherOption}
625
625
  />
626
626
  ) : (
627
627
  <Image
628
628
  key={"defaultImage"}
629
629
  style={{
630
630
  ...style,
631
631
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
632
632
  }}
633
633
  className={classNames(
634
634
  imageStyle["d-lazy-image"],
635
635
  {
636
636
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
637
637
  },
638
638
  {
639
639
  [imageStyle["d-hide-image-error"]]: imageErrState,
640
640
  },
641
641
  {
642
642
  [imageStyle["d-load-completed"]]: loadSuccess,
643
643
  },
644
644
  {
645
645
  "d-imag-rendering-crisp-edges": imagRenderingSet,
646
646
  },
647
647
  className
648
648
  )}
649
649
  src={isSkuImage ? DEFAULT_SKU_SRC : DEFAULT_SRC}
650
650
  />
651
651
  ),
652
652
  loadSuccess ? null : <View key={"measureRef"} ref={measureRef}></View>,
653
653
  ]
654
654
  ) : (
655
655
  <Image
656
656
  style={{
657
657
  ...style,
658
658
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
659
659
  }}
660
660
  className={classNames(
661
661
  imageStyle["d-lazy-image"],
662
662
  {
663
663
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
664
664
  },
665
665
  {
666
666
  [imageStyle["d-hide-image-error"]]: imageErrState,
667
667
  },
668
668
  {
669
669
  [imageStyle["d-load-completed"]]: loadSuccess,
670
670
  },
671
671
  {
672
672
  "d-imag-rendering-crisp-edges": imagRenderingSet,
673
673
  },
674
674
  className
675
675
  )}
676
676
  src={getQualityImage(imgSrc, NetWorkTypeQuality[getNetWorkType])}
677
677
  lazyLoad={isChartH5 ? false : lazyLoad}
678
678
  onError={imageErrorHandle}
679
679
  onLoad={imageLoad.bind(this, imgSrc)}
680
680
  {...otherOption}
681
681
  />
682
682
  )
683
683
  )
684
684
  lazyLoad: true,
685
685
  isSkuImage: false,
686
686
  hideErrorImage: false,
687
687
  imagRenderingSet: true,
688
688
  src: null,
689
689
  style: null,
690
690
  width: null,
691
691
  height: null,
692
692
  backgroundColor: null,
693
693
  className: null,
694
694
  errorSrc: null,
695
695
  onLoad: null,
696
696
  onError: null,