@conecli/cone-render 0.9.1-shop2.4 → 0.9.1-shop2.40

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 (117) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/assets/icon_blue_info.svg +1 -0
  3. package/dist/common/const.ts +1 -1
  4. package/dist/common/environmentType.ts +1 -0
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.ts +1 -0
  10. package/dist/common/pageType.ts +1 -1
  11. package/dist/common/sgmCustomCode.ts +1 -0
  12. package/dist/common/token/token.jd.ts +1 -1
  13. package/dist/common/token/token.ts +1 -1
  14. package/dist/common/wxappApi.jd.ts +1 -0
  15. package/dist/components/ErrorBoundary.tsx +1 -1
  16. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  17. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  18. package/dist/components/base/CountDown/index.module.scss +49 -44
  19. package/dist/components/base/CountDown/index.tsx +1 -1
  20. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  21. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  22. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  23. package/dist/components/base/CustomVideo/common.ts +1 -0
  24. package/dist/components/base/CustomVideo/index.tsx +1 -1
  25. package/dist/components/base/Dialog/index.module.scss +16 -0
  26. package/dist/components/base/Dialog/index.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  28. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  29. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  30. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  31. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  32. package/dist/components/base/InViewRender/index.tsx +1 -1
  33. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  34. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  35. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  36. package/dist/components/base/LazyLoadImage/index.h5.module.scss +23 -20
  37. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  38. package/dist/components/base/MobileCommonHeader/index.module.scss +8 -0
  39. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  40. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  41. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  42. package/dist/components/base/Price/Base/index.tsx +1 -1
  43. package/dist/components/base/Price/Double/index.module.scss +8 -0
  44. package/dist/components/base/Price/Double/index.tsx +1 -1
  45. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  46. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  47. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  48. package/dist/components/decorate/DecorateFloorModule/index.module.scss +11 -0
  49. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  50. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  51. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  52. package/dist/components/floorItem.jd.tsx +1 -1
  53. package/dist/components/floorItem.tsx +1 -1
  54. package/dist/components/floorItem.weapp.tsx +1 -1
  55. package/dist/components/isv/Floor/index.tsx +1 -1
  56. package/dist/components/remoteFloorItem.tsx +1 -1
  57. package/dist/interface/common.ts +1 -1
  58. package/dist/interface/component.ts +1 -1
  59. package/dist/interface/jumpEventReport.ts +1 -1
  60. package/dist/interface/service.ts +1 -1
  61. package/dist/interface/utils.ts +1 -1
  62. package/dist/jumpEventReport/base.ts +1 -1
  63. package/dist/jumpEventReport/const.ts +1 -1
  64. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  65. package/dist/jumpEventReport/index.h5.ts +1 -1
  66. package/dist/jumpEventReport/index.jd.ts +1 -1
  67. package/dist/jumpEventReport/index.weapp.ts +1 -1
  68. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  69. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  70. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  71. package/dist/jumpEventReport/web/report.ts +1 -1
  72. package/dist/jumpEventReport/web.base.ts +1 -1
  73. package/dist/jumpEventReport/web.jd.ts +1 -1
  74. package/dist/jumpEventReport/web.jdb.ts +1 -1
  75. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  76. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  77. package/dist/jumpEventReport/web.pc.ts +1 -1
  78. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  79. package/dist/jumpEventReport/web.tjm.ts +1 -0
  80. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  81. package/dist/modules/ContainerFloorList/index.h5.module.scss +30 -1
  82. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  83. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  84. package/dist/open/api/device.ts +1 -1
  85. package/dist/open/api/environment.ts +1 -1
  86. package/dist/open/api/index.ts +1 -1
  87. package/dist/open/api/jump copy.ts +1 -1
  88. package/dist/open/api/request.ts +1 -1
  89. package/dist/open/api/shopMember.ts +1 -1
  90. package/dist/open/api/track.ts +1 -1
  91. package/dist/open/api/util.ts +1 -1
  92. package/dist/open/components/index.ts +1 -1
  93. package/dist/sass/app.h5.scss +274 -212
  94. package/dist/sass/base.scss +195 -137
  95. package/dist/service/fetchGateway.ts +1 -1
  96. package/dist/service/http/colorSign.ts +1 -1
  97. package/dist/service/http/const.ts +1 -1
  98. package/dist/service/http/h5Http.ts +1 -0
  99. package/dist/service/http/index.h5.ts +1 -0
  100. package/dist/service/requestServer.h5.ts +1 -0
  101. package/dist/service/requestServer.ts +1 -1
  102. package/dist/utils/connectNativeJsBridge.ts +1 -1
  103. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  104. package/dist/utils/draExceptionAndProfile.ts +1 -1
  105. package/dist/utils/h5Utils.ts +1 -1
  106. package/dist/utils/index.h5.ts +1 -1
  107. package/dist/utils/index.ts +1 -1
  108. package/dist/utils/index.weapp.ts +1 -1
  109. package/dist/utils/jm-common.js +1 -1
  110. package/dist/utils/jumpExtMapUtil.js +1 -0
  111. package/dist/utils/sColor.js +1 -0
  112. package/dist/utils/sgmCodeUtils.ts +1 -0
  113. package/dist/utils/taroRenderUtil.ts +1 -1
  114. package/dist/utils/utils.ts +1 -1
  115. package/package.json +26 -3
  116. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
  117. package/dist/utils/memberFormatUtils.js +0 -1
@@ -1 +1 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react'
2
1
  getQualityImage,
3
2
  isH5AndJdShopView,
4
3
  isJdApp,
5
4
  isChartH5,
6
5
  isH5AndJdShopViewH5Scroll,
7
6
  getNativePageScrollRes,
8
7
  latestFromNativeMsgStorage,
9
8
  const {
10
9
  src,
11
10
  lazyLoad,
12
11
  imagRenderingSet,
13
12
  width,
14
13
  height,
15
14
  className,
16
15
  isSkuImage,
17
16
  hideErrorImage,
18
17
  style,
19
18
  backgroundColor,
20
19
  errorSrc,
21
20
  onLoad,
22
21
  onError,
23
22
  ...otherOption
24
23
  } = props
25
24
  getNetWorkType === NetWorkTypeQuality.default &&
26
25
  (getNetWorkType = taroJdBaseInfo.info.sysInfo.netWorkType)
27
26
  const [loadSuccess, setLoadSuccess] = useState(false)
28
27
  const [imageErrState, setImageErrState] = useState(false)
29
28
  const [componentShowState, setComponentShowState] = useState(false)
30
29
  const [imgSrc, setImgSrc] = useState(src)
31
30
  const componentLazyRef = useRef<HTMLElement | null>(null)
32
31
  const componentShowStateRef = useRef(false)
33
32
  const needShowHighVersion =
34
33
  isH5AndJdShopViewH5Scroll &&
35
34
  !(
36
35
  global.info.queryInfo?.downgraded &&
37
36
  global.info.queryInfo.downgraded === 'true'
38
37
  )
39
38
  const imageError = useCallback(
40
39
  (e) => {
41
40
  console.log('图片加载错误', e)
42
41
  errorSrc && setImgSrc(errorSrc)
43
42
  hideErrorImage && setImageErrState(true)
44
43
  typeof onError === 'function' && onError(e, src, props)
45
44
  },
46
45
  [src],
47
46
  )
48
47
 
49
48
  const imageLoad = useCallback(
50
49
  (_src, event) => {
51
50
  setLoadSuccess(true)
52
51
  typeof onLoad === 'function' && onLoad(event, src, props)
53
52
  },
54
53
  [src],
55
54
  )
56
55
 
57
56
  const changeStyleIncludeWidthAndHeightAndBgColor = () => {
58
57
  const changeStyle = {}
59
58
  width && (changeStyle['width'] = width)
60
59
  height && (changeStyle['height'] = height)
61
60
  backgroundColor && (changeStyle['backgroundColor'] = backgroundColor)
62
61
  return changeStyle
63
62
  }
64
63
  useEffect(() => {
65
64
  if (needShowHighVersion) return
66
65
  const latestRes =
67
66
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
68
67
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
69
68
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
70
69
  !componentShowStateRef.current && dealPageScrollInfo(res)
71
70
  })
72
71
  }, [])
73
72
 
74
73
  const dealPageScrollInfo = (res) => {
75
74
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
76
75
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined')
77
76
  return
78
77
  if (componentLazyRef.current) {
79
78
  const eleClientRect = componentLazyRef.current.getBoundingClientRect()
80
79
  const getContainerHeightOffSetY = displayHeight * 1.5 + offSetY
81
80
  const eleOffsetTop = Math.ceil(eleClientRect.top)
82
81
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
83
82
  if (!componentShowStateRef.current) {
84
83
  if (getContainerHeightOffSetY > eleOffsetTop) {
85
84
  componentShowStateRef.current = true
86
85
  setComponentShowState(true)
87
86
  }
88
87
  }
89
88
  }
90
89
  }
91
90
  <View
92
91
  ref={ componentLazyRef }
93
92
  className={classNames(
94
93
  imageStyle['d-app-lazy-image'],
95
94
  {
96
95
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
97
96
  },
98
97
  {
99
98
  [imageStyle['d-hide-image-error']]: imageErrState,
100
99
  },
101
100
  {
102
101
  [imageStyle['d-load-completed']]: loadSuccess,
103
102
  },
104
103
  {
105
104
  'd-imag-rendering-crisp-edges':
106
105
  !taroJdBaseInfo.info.pageInfo.isVipShop &&
107
106
  imagRenderingSet,
108
107
  },
109
108
  'J_html5ImageBg',
110
109
  className,
111
110
  )}
112
111
  style={{
113
112
  ...style,
114
113
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
115
114
  >
116
115
  {(componentShowState || lazyLoad === false) && <img
117
116
  src={getQualityImage(
118
117
  imgSrc,
119
118
  taroJdBaseInfo.info.pageInfo.isVipShop
120
119
  ? NetWorkTypeQuality['perfect']
121
120
  : NetWorkTypeQuality[getNetWorkType],
122
121
  )}
123
122
  onLoad={imageLoad.bind(this, imgSrc)}
124
123
  onError={imageError}
125
124
  />}
126
125
  </View>
127
126
  ) : (
128
127
  <Image
129
128
  style={{
130
129
  ...style,
131
130
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
132
131
  }}
133
132
  className={classNames(
134
133
  imageStyle['d-lazy-image'],
135
134
  {
136
135
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
137
136
  },
138
137
  {
139
138
  [imageStyle['d-hide-image-error']]: imageErrState,
140
139
  },
141
140
  {
142
141
  [imageStyle['d-load-completed']]: loadSuccess,
143
142
  },
144
143
  {
145
144
  'd-imag-rendering-crisp-edges': imagRenderingSet,
146
145
  },
147
146
  className,
148
147
  )}
149
148
  src={getQualityImage(
150
149
  imgSrc,
151
150
  NetWorkTypeQuality[getNetWorkType],
152
151
  )}
153
152
  lazyLoad={isChartH5 ? false : lazyLoad}
154
153
  onError={imageError}
155
154
  onLoad={imageLoad.bind(this, imgSrc)}
156
155
  {...otherOption}
157
156
  />
158
157
  )
159
158
  lazyLoad: true,
160
159
  isSkuImage: false,
161
160
  hideErrorImage: false,
162
161
  imagRenderingSet: true,
163
162
  src: null,
164
163
  style: null,
165
164
  width: null,
166
165
  height: null,
167
166
  backgroundColor: null,
168
167
  className: null,
169
168
  errorSrc: null,
170
169
  onLoad: null,
171
170
  onError: null,
171
+ import React, { useCallback, useEffect, useRef, useState } from 'react'
172
172
  TaroEventType,
173
173
  const styleSheets = document.styleSheets
174
174
  const internalStyleSheets = []
175
175
  for (let i = 0; i < styleSheets.length; i++) {
176
176
  const sheet = styleSheets[i]
177
177
  const ownerNode = sheet.ownerNode
178
178
  if (ownerNode && ownerNode.nodeName === 'STYLE') {
179
179
  internalStyleSheets.push(sheet)
180
180
  }
181
181
  }
182
182
  console.warn("🚗 ~~ file: index.h5.tsx:47 ~~ getRuleBySelector() ~~ selector:", selector)
183
183
  for(let i = 0; i < internalStyleSheets.length; i++){
184
184
  try {
185
185
  const sheet = internalStyleSheets[i]
186
186
  const rules = sheet.cssRules || sheet.rules
187
187
  for (const rule of rules) {
188
188
  if (rule?.selectorText?.match(new RegExp(selector + '$'))) {
189
189
  return rule
190
190
  }
191
191
  }
192
192
  } catch (e) {
193
193
  console.warn('因安全限制无法访问样式表:', e)
194
194
  }
195
195
  }
196
196
  return null
197
197
  const {
198
198
  src,
199
199
  lazyLoad,
200
200
  imagRenderingSet,
201
201
  width,
202
202
  height,
203
203
  className,
204
204
  isSkuImage,
205
205
  hideErrorImage,
206
206
  style,
207
207
  backgroundColor,
208
208
  errorSrc,
209
209
  onLoad,
210
210
  onError,
211
211
  ...otherOption
212
212
  } = props
213
213
  getNetWorkType === NetWorkTypeQuality.default &&
214
214
  (getNetWorkType = global.info.sysInfo.netWorkType)
215
215
  const [loadSuccess, setLoadSuccess] = useState(false)
216
216
  const [imageErrState, setImageErrState] = useState(false)
217
217
  const [componentShowState, setComponentShowState] = useState(false)
218
218
  const measureRef = useRef < HTMLElement | null > (null)
219
219
  const [measureComplete, setMeasureComplete] = useState(false)
220
220
  const [imgSrc, setImgSrc] = useState(src)
221
221
  const [hasRetrySuccess, setHasRetrySuccess] = useState(false)
222
222
  const hasRetryRef = useRef(false)
223
223
  const componentShowStateRef = useRef(false)
224
224
  const requestSrcRef = useRef(src)
225
225
  const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
226
226
  const enableAvifOptimize = isImageOptimizeEnable()
227
227
  const avifSupport = getAvifSupport()
228
228
  const webpSupport = getWebpSupport()
229
229
 
230
230
 
231
231
  const getRequestSrc = useCallback((src) => {
232
232
  const requestSrc = getQualityImage(
233
233
  imgSrc,
234
234
  { isSkuImage, size: measureRef?.current?.getBoundingClientRect()?.width }
235
235
  )
236
236
  requestSrcRef.current = requestSrc
237
237
  return requestSrc
238
238
  }, [src])
239
239
  const imageErrorRetry = (src) => {
240
240
  return new Promise((resolve, reject) => {
241
241
  if(fetch && window && window.Image){
242
242
  fetch(src)
243
243
  .then(response => {
244
244
  const {ok, status} = response
245
245
  if (ok) {
246
246
  const originUrl = src.replace(/\.(jpe?g|png).*/, '.$1')
247
247
  response.blob().then(blob => {
248
248
  if(URL){
249
249
  const url = URL.createObjectURL(blob)
250
250
  const img = new window.Image()
251
251
  img.src = url;
252
252
  img.onload = () => {
253
253
  reportSGM({status, text: '再次请求并且onload了', type: 'retryAndOnload', requestSrc: src, resolveUrl: url})
254
254
  resolve({
255
255
  ok: true,
256
256
  url
257
257
  })
258
258
  setTimeout(() => {
259
259
  URL.revokeObjectURL(url)
260
260
  }, 2000)
261
261
  };
262
262
  img.onerror = () => {
263
263
  reportSGM({status, text: '图片解析异常', type: 'imageParseError', requestSrc: src})
264
264
  URL.revokeObjectURL(url)
265
265
  resolve({
266
266
  ok: true,
267
267
  url: originUrl
268
268
  })
269
269
  };
270
270
  }else{
271
271
  resolve({
272
272
  ok: true,
273
273
  url: originUrl
274
274
  })
275
275
  }
276
276
  }).catch(error => {
277
277
  resolve({
278
278
  ok: true,
279
279
  url: originUrl
280
280
  })
281
281
  console.error('LazyLoadImage imageErrorRetry() error:', error)
282
282
  });
283
283
  }else {
284
284
  if(status === 404){
285
285
  resolve({
286
286
  ok: false,
287
287
  text: '访问图片不存在',
288
288
  type: 'noSuchUrlImage',
289
289
  })
290
290
  }else{
291
291
  resolve({
292
292
  ok: false,
293
293
  status: status,
294
294
  text: '其它图片问题',
295
295
  type: 'otherImageError',
296
296
  })
297
297
  }
298
298
  }
299
299
  })
300
300
  .catch(error => {
301
301
  resolve({
302
302
  ok: false,
303
303
  text: '网络异常',
304
304
  type: 'networkError',
305
305
  })
306
306
  console.error('LazyLoadImage imageErrorRetry() error:', error)
307
307
  });
308
308
  }else{
309
309
  resolve({
310
310
  ok: false,
311
311
  text: '不支持重试',
312
312
  type: 'notSupportRetry',
313
313
  })
314
314
  }
315
315
  })
316
316
 
317
317
 
318
318
  const reportSGM = ({status, text, type, requestSrc = imgSrc, resolveUrl = ''}) => {
319
319
  const { shopId, venderId } = global.info.queryInfo || {}
320
320
  sgmCustomReport({
321
321
  code: getSgmCustomCode(`${SgmCustomCode.IMAGE_LOAD}_${type}`),
322
322
  msg: {
323
323
  avifSupport,
324
324
  webpSupport,
325
325
  shopId,
326
326
  venderId,
327
327
  originSrc: src,
328
328
  requestSrc,
329
329
  resolveUrl,
330
330
  status,
331
331
  text
332
332
  },
333
333
  })
334
334
  }
335
335
  const imageErrorHandle = useCallback(
336
336
  (e) => {
337
337
  console.log(' ==============> 图片加载错误', e)
338
338
  if (!hasRetryRef.current) {
339
339
  hasRetryRef.current = true
340
340
  if(src){
341
341
  try{
342
342
  imageErrorRetry(requestSrcRef.current).then((result) => {
343
343
  const { status, ok, text, type, url } = result || {}
344
344
  if(ok){
345
345
  setImgSrc(url)
346
346
  setHasRetrySuccess(true)
347
347
  }else{
348
348
  errorSrc && setImgSrc(errorSrc)
349
349
  hideErrorImage && setImageErrState(true)
350
350
  typeof onError === 'function' && onError(e, src, props)
351
351
  reportSGM({status, text, type, requestSrc: requestSrcRef.current})
352
352
  }
353
353
  })
354
354
  }catch(e){
355
355
  console.error('LazyLoadImage imageErrorHandle() error:', e)
356
356
  errorSrc && setImgSrc(errorSrc)
357
357
  hideErrorImage && setImageErrState(true)
358
358
  typeof onError === 'function' && onError(e, src, props)
359
359
  }
360
360
  }
361
361
  }else{
362
362
  reportSGM({status: '', text: '渲染原始图片渲染异常', type: 'renderOriginImageError'})
363
363
  if(imgSrc.includes('blob:')){
364
364
  reportSGM({status: '', text: '渲染本地blob图片异常', type: 'renderBlobImageError'})
365
365
  }else{
366
366
  reportSGM({status: '', text: '渲染本地非blob图片异常', type: 'renderNoBlobImageError'})
367
367
  }
368
368
  }
369
369
  },
370
370
  [src, hasRetryRef.current],
371
371
  )
372
372
 
373
373
 
374
374
  const imageLoad = useCallback(
375
375
  (_src, event) => {
376
376
  setLoadSuccess(true)
377
377
  typeof onLoad === 'function' && onLoad(event, src, props)
378
378
  },
379
379
  [src],
380
380
  )
381
381
 
382
382
  const changeStyleIncludeWidthAndHeightAndBgColor = () => {
383
383
  const changeStyle = {}
384
384
  width && (changeStyle['width'] = width)
385
385
  height && (changeStyle['height'] = height)
386
386
  backgroundColor && (changeStyle['backgroundColor'] = backgroundColor)
387
387
  return changeStyle
388
388
  }
389
389
  useEffect(() => {
390
390
  try{
391
391
  const { mode } = otherOption
392
392
  if(mode && mode === 'heightFix'){
393
393
  className?.split(/\s/)?.forEach(item => {
394
394
  const userDefinedClass = getRuleBySelector('.' + item)
395
395
  const userDefinedHeight = userDefinedClass?.style?.height
396
396
  if(userDefinedHeight === '' || userDefinedHeight === 'auto'){
397
397
  console.warn("🚗 ~~ 发现一例用户使用图片组件设置了 mode='heightFix' 并且没有定义一个具体高度:", userDefinedHeight, {
398
398
  code: getSgmCustomCode(`imageUsageCheck`),
399
399
  msg: {
400
400
  userDefinedClass: item,
401
401
  userDefinedHeight
402
402
  },
403
403
  })
404
404
  sgmCustomReport({
405
405
  code: getSgmCustomCode(`imageUsageCheck`),
406
406
  msg: {
407
407
  userDefinedClass: item,
408
408
  userDefinedHeight
409
409
  },
410
410
  })
411
411
  }
412
412
  })
413
413
  }
414
414
  }catch(e){
415
415
  console.warn('imageUsageCheck error:', e)
416
416
  }
417
417
  setMeasureComplete(true)
418
418
  if (needShowHighVersion) return
419
419
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
420
420
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
421
421
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
422
422
  !componentShowStateRef.current && dealPageScrollInfo(res)
423
423
  })
424
424
  }, [])
425
425
 
426
426
  const dealPageScrollInfo = (res) => {
427
427
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
428
428
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
429
429
  if (measureRef.current) {
430
430
  const eleClientRect =
431
431
  measureRef.current.getBoundingClientRect()
432
432
  const getContainerHeightOffSetY =
433
433
  displayHeight * 1.5 + offSetY
434
434
  const eleOffsetTop = Math.ceil(eleClientRect.top)
435
435
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
436
436
  if (!componentShowStateRef.current) {
437
437
  if (getContainerHeightOffSetY > eleOffsetTop) {
438
438
  componentShowStateRef.current = true
439
439
  setComponentShowState(true)
440
440
  }
441
441
  }
442
442
  }
443
443
  }
444
444
  return (
445
445
  isH5AndJdShopView &&
446
446
  global?.config?.needImageLazy !== false &&
447
447
  !needShowHighVersion &&
448
448
  !isAppStowShop ? (
449
449
  <View
450
450
  ref={measureRef}
451
451
  className={classNames(
452
452
  imageStyle["d-app-lazy-image"],
453
453
  {
454
454
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
455
455
  },
456
456
  {
457
457
  [imageStyle["d-hide-image-error"]]: imageErrState,
458
458
  },
459
459
  {
460
460
  [imageStyle["d-load-completed"]]: loadSuccess,
461
461
  },
462
462
  {
463
463
  "d-imag-rendering-crisp-edges":
464
464
  !global.info.pageInfo.isVipShop && imagRenderingSet,
465
465
  },
466
466
  "J_html5ImageBg",
467
467
  className
468
468
  )}
469
469
  style={{
470
470
  ...style,
471
471
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
472
472
  }}
473
473
  {...otherOption}
474
474
  >
475
475
  {(componentShowState || lazyLoad === false) && (
476
476
  <img
477
477
  src={getQualityImage(
478
478
  imgSrc,
479
479
  global.info.pageInfo.isVipShop
480
480
  ? NetWorkTypeQuality["perfect"]
481
481
  : NetWorkTypeQuality[getNetWorkType]
482
482
  )}
483
483
  onLoad={imageLoad.bind(this, imgSrc)}
484
484
  onError={imageErrorHandle}
485
485
  />
486
486
  )}
487
487
  </View>
488
488
  ) : enableAvifOptimize ? (
489
489
  [
490
490
  measureComplete ? (
491
491
  <Image
492
492
  key={hasRetrySuccess? "realImageRetry": "realImage"}
493
493
  style={{
494
494
  ...style,
495
495
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
496
496
  }}
497
497
  className={classNames(
498
498
  imageStyle["d-lazy-image"],
499
499
  {
500
500
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
501
501
  },
502
502
  {
503
503
  [imageStyle["d-hide-image-error"]]: imageErrState,
504
504
  },
505
505
  {
506
506
  [imageStyle["d-load-completed"]]: loadSuccess,
507
507
  },
508
508
  {
509
509
  "d-imag-rendering-crisp-edges": imagRenderingSet,
510
510
  },
511
511
  className
512
512
  )}
513
513
  src={hasRetrySuccess? imgSrc: getRequestSrc(imgSrc)}
514
514
  lazyLoad={isChartH5 ? false : lazyLoad}
515
515
  onError={imageErrorHandle}
516
516
  onLoad={imageLoad.bind(this, imgSrc)}
517
517
  {...otherOption}
518
518
  />
519
519
  ) : (
520
520
  <Image
521
521
  key="defaultImage"
522
522
  style={{
523
523
  ...style,
524
524
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
525
525
  }}
526
526
  className={classNames(
527
527
  imageStyle["d-lazy-image"],
528
528
  {
529
529
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
530
530
  },
531
531
  {
532
532
  [imageStyle["d-hide-image-error"]]: imageErrState,
533
533
  },
534
534
  {
535
535
  [imageStyle["d-load-completed"]]: loadSuccess,
536
536
  },
537
537
  {
538
538
  "d-imag-rendering-crisp-edges": imagRenderingSet,
539
539
  },
540
540
  className
541
541
  )}
542
542
  src={isSkuImage ? DEFAULT_SKU_SRC : DEFAULT_SRC}
543
543
  />
544
544
  ),
545
545
  loadSuccess ? null : <View key="measureRef" ref={measureRef}></View>,
546
546
  ]
547
547
  ) : (
548
548
  <Image
549
549
  style={{
550
550
  ...style,
551
551
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
552
552
  }}
553
553
  className={classNames(
554
554
  imageStyle["d-lazy-image"],
555
555
  {
556
556
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
557
557
  },
558
558
  {
559
559
  [imageStyle["d-hide-image-error"]]: imageErrState,
560
560
  },
561
561
  {
562
562
  [imageStyle["d-load-completed"]]: loadSuccess,
563
563
  },
564
564
  {
565
565
  "d-imag-rendering-crisp-edges": imagRenderingSet,
566
566
  },
567
567
  className
568
568
  )}
569
569
  src={getQualityImage(imgSrc, NetWorkTypeQuality[getNetWorkType])}
570
570
  lazyLoad={isChartH5 ? false : lazyLoad}
571
571
  onError={imageErrorHandle}
572
572
  onLoad={imageLoad.bind(this, imgSrc)}
573
573
  {...otherOption}
574
574
  />
575
575
  )
576
576
  )
577
577
  lazyLoad: true,
578
578
  isSkuImage: false,
579
579
  hideErrorImage: false,
580
580
  imagRenderingSet: true,
581
581
  src: null,
582
582
  style: null,
583
583
  width: null,
584
584
  height: null,
585
585
  backgroundColor: null,
586
586
  className: null,
587
587
  errorSrc: null,
588
588
  onLoad: null,
589
589
  onError: null,
@@ -7,3 +7,11 @@
7
7
  position: relative;
8
8
  }
9
9
  }
10
+ :global {
11
+ .d-mobile-header-sticky {
12
+ position: fixed;
13
+ top: 0;
14
+ width: 100%;
15
+ z-index: 999;
16
+ }
17
+ }