@conecli/cone-render 0.9.1-shop2.3 → 0.9.1-shop2.31

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