@conecli/cone-render 0.9.1-isv2.0 → 0.9.1-isv2.1

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 (102) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/common/environmentType.ts +1 -0
  4. package/dist/common/index.h5.ts +1 -1
  5. package/dist/common/index.jd.ts +1 -1
  6. package/dist/common/index.ts +1 -1
  7. package/dist/common/index.weapp.ts +1 -1
  8. package/dist/common/jdplayerSdk.ts +1 -0
  9. package/dist/common/jssdk.ts +1 -0
  10. package/dist/common/pageType.ts +1 -0
  11. package/dist/common/sgmCustomCode.ts +1 -0
  12. package/dist/common/token/index.h5.ts +1 -1
  13. package/dist/common/token/token.jd.ts +1 -1
  14. package/dist/common/token/token.ts +1 -1
  15. package/dist/common/wxappApi.jd.ts +1 -0
  16. package/dist/components/ErrorBoundary.tsx +1 -1
  17. package/dist/components/base/CommonFloorHead/index.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/index.tsx +1 -1
  23. package/dist/components/base/Dialog/index.module.scss +5 -0
  24. package/dist/components/base/Dialog/index.tsx +1 -1
  25. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  26. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  28. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  29. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  30. package/dist/components/base/InViewRender/index.tsx +1 -1
  31. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  32. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  33. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  34. package/dist/components/base/LazyLoadImage/index.h5.module.scss +20 -20
  35. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  36. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  37. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  38. package/dist/components/base/NetworkDataError/const.ts +1 -1
  39. package/dist/components/base/NetworkDataError/index.module.scss +4 -0
  40. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  41. package/dist/components/base/Price/Double/index.tsx +1 -1
  42. package/dist/components/base/Price/index.tsx +1 -1
  43. package/dist/components/decorate/DecorateFloorModule/index.module.scss +21 -2
  44. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  45. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  46. package/dist/components/floorItem.jd.tsx +1 -1
  47. package/dist/components/floorItem.tsx +1 -1
  48. package/dist/components/floorItem.weapp.tsx +1 -1
  49. package/dist/components/isv/Floor/index.tsx +1 -1
  50. package/dist/components/remoteFloorItem.tsx +1 -1
  51. package/dist/interface/common.ts +1 -1
  52. package/dist/interface/component.ts +1 -1
  53. package/dist/interface/jumpEventReport.ts +1 -1
  54. package/dist/interface/service.ts +1 -1
  55. package/dist/interface/utils.ts +1 -1
  56. package/dist/jumpEventReport/base.ts +1 -1
  57. package/dist/jumpEventReport/const.ts +1 -1
  58. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  59. package/dist/jumpEventReport/index.h5.ts +1 -1
  60. package/dist/jumpEventReport/index.jd.ts +1 -1
  61. package/dist/jumpEventReport/index.weapp.ts +1 -1
  62. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  63. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  64. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  65. package/dist/jumpEventReport/web/report.ts +1 -1
  66. package/dist/jumpEventReport/web.base.ts +1 -1
  67. package/dist/jumpEventReport/web.jd.ts +1 -1
  68. package/dist/jumpEventReport/web.jdb.ts +1 -1
  69. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  70. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  71. package/dist/jumpEventReport/web.pc.ts +1 -0
  72. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  73. package/dist/jumpEventReport/web.tjm.ts +1 -0
  74. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  75. package/dist/modules/ContainerFloorList/index.h5.module.scss +17 -1
  76. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  77. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  78. package/dist/open/api/environment.ts +1 -1
  79. package/dist/open/api/index.ts +1 -1
  80. package/dist/open/api/jump copy.ts +1 -1
  81. package/dist/open/api/request.ts +1 -1
  82. package/dist/open/api/shopMember.ts +1 -1
  83. package/dist/open/api/track.ts +1 -1
  84. package/dist/open/api/util.ts +1 -1
  85. package/dist/open/components/index.ts +1 -1
  86. package/dist/sass/app.h5.scss +44 -3
  87. package/dist/sass/base.scss +12 -0
  88. package/dist/service/fetchGateway.ts +1 -1
  89. package/dist/service/http/const.ts +1 -1
  90. package/dist/service/requestServer.ts +1 -1
  91. package/dist/utils/connectNativeJsBridge.ts +1 -1
  92. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  93. package/dist/utils/draExceptionAndProfile.ts +1 -1
  94. package/dist/utils/h5Utils.ts +1 -1
  95. package/dist/utils/index.h5.ts +1 -1
  96. package/dist/utils/index.ts +1 -1
  97. package/dist/utils/index.weapp.ts +1 -1
  98. package/dist/utils/jm-common.js +1 -1
  99. package/dist/utils/sgmCodeUtils.ts +1 -0
  100. package/dist/utils/utils.ts +1 -1
  101. package/package.json +1 -1
  102. package/dist/customHooks/useDocumentVisibilitychange.ts +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 {
180
180
  src,
181
181
  lazyLoad,
182
182
  imagRenderingSet,
183
183
  width,
184
184
  height,
185
185
  className,
186
186
  isSkuImage,
187
187
  hideErrorImage,
188
188
  style,
189
189
  backgroundColor,
190
190
  errorSrc,
191
191
  onLoad,
192
192
  onError,
193
193
  ...otherOption
194
194
  } = props
195
195
  getNetWorkType === NetWorkTypeQuality.default &&
196
196
  (getNetWorkType = global.info.sysInfo.netWorkType)
197
197
  const [loadSuccess, setLoadSuccess] = useState(false)
198
198
  const [imageErrState, setImageErrState] = useState(false)
199
199
  const [componentShowState, setComponentShowState] = useState(false)
200
200
  const measureRef = useRef < HTMLElement | null > (null)
201
201
  const [measureComplete, setMeasureComplete] = useState(false)
202
202
  const [imgSrc, setImgSrc] = useState(src)
203
203
  const [hasRetrySuccess, setHasRetrySuccess] = useState(false)
204
204
  const hasRetryRef = useRef(false)
205
205
  const componentShowStateRef = useRef(false)
206
206
  const requestSrcRef = useRef(src)
207
207
  const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
208
208
  const enableAvifOptimize = isImageOptimizeEnable()
209
209
 
210
210
  const getRequestSrc = useCallback((src) => {
211
211
  const requestSrc = getQualityImage(
212
212
  imgSrc,
213
213
  { isSkuImage, size: measureRef?.current?.offsetWidth }
214
214
  )
215
215
  requestSrcRef.current = requestSrc
216
216
  return requestSrc
217
217
  }, [src])
218
218
  const imageErrorRetry = (src) => {
219
219
  return new Promise((resolve, reject) => {
220
220
  if(fetch && window && window.Image){
221
221
  fetch(src)
222
222
  .then(response => {
223
223
  const {ok, status} = response
224
224
  if (ok) {
225
225
  response.blob().then(blob => {
226
226
  const url = URL.createObjectURL(blob)
227
227
  const img = new window.Image()
228
228
  img.src = url;
229
229
  img.onload = () => {
230
230
  resolve({
231
231
  ok: true,
232
232
  url
233
233
  })
234
234
  setTimeout(() => {
235
235
  URL.revokeObjectURL(url)
236
236
  }, 1000)
237
237
  };
238
238
  img.onerror = () => {
239
239
  resolve({
240
240
  ok: false,
241
241
  text: '图片解析异常',
242
242
  type: 'imageParseError',
243
243
  })
244
244
  URL.revokeObjectURL(url)
245
245
  };
246
246
  })
247
247
  }else {
248
248
  if(status === 404){
249
249
  resolve({
250
250
  ok: false,
251
251
  text: '访问图片不存在',
252
252
  type: 'noSuchUrlImage',
253
253
  })
254
254
  }else{
255
255
  resolve({
256
256
  ok: false,
257
257
  status: status,
258
258
  text: '其它图片问题',
259
259
  type: 'otherImageError',
260
260
  })
261
261
  }
262
262
  }
263
263
  })
264
264
  .catch(error => {
265
265
  resolve({
266
266
  ok: false,
267
267
  text: '网络异常',
268
268
  type: 'networkError',
269
269
  })
270
270
  console.error('LazyLoadImage imageErrorRetry() error:', error)
271
271
  });
272
272
  }else{
273
273
  resolve({
274
274
  ok: false,
275
275
  text: '不支持重试',
276
276
  type: 'notSupportRetry',
277
277
  })
278
278
  }
279
279
  })
280
280
 
281
281
  const imageErrorHandle = useCallback(
282
282
  (e) => {
283
283
  console.log(' ==============> 图片加载错误', e)
284
284
  if (!hasRetryRef.current) {
285
285
  hasRetryRef.current = true
286
286
  if(src){
287
287
  try{
288
288
  imageErrorRetry(requestSrcRef.current).then((result) => {
289
289
  const { status, ok, text, type, url } = result || {}
290
290
  if(ok){
291
291
  setImgSrc(url)
292
292
  setHasRetrySuccess(true)
293
293
  }else{
294
294
  errorSrc && setImgSrc(errorSrc)
295
295
  hideErrorImage && setImageErrState(true)
296
296
  typeof onError === 'function' && onError(e, src, props)
297
297
  const { shopId, venderId } = global.info.queryInfo || {}
298
298
  sgmCustomReport({
299
299
  code: getSgmCustomCode(`${SgmCustomCode.IMAGE_LOAD}_${type}`),
300
300
  msg: {
301
301
  shopId,
302
302
  venderId,
303
303
  originSrc: src,
304
304
  requestSrc: requestSrcRef.current,
305
305
  status,
306
306
  text
307
307
  },
308
308
  })
309
309
  }
310
310
  })
311
311
  }catch(e){
312
312
  console.error('LazyLoadImage imageErrorHandle() error:', e)
313
313
  errorSrc && setImgSrc(errorSrc)
314
314
  hideErrorImage && setImageErrState(true)
315
315
  typeof onError === 'function' && onError(e, src, props)
316
316
  }
317
317
  }
318
318
  }
319
319
  },
320
320
  [src, hasRetryRef.current],
321
321
  )
322
322
 
323
323
 
324
324
  const imageLoad = useCallback(
325
325
  (_src, event) => {
326
326
  setLoadSuccess(true)
327
327
  typeof onLoad === 'function' && onLoad(event, src, props)
328
328
  },
329
329
  [src],
330
330
  )
331
331
 
332
332
  const changeStyleIncludeWidthAndHeightAndBgColor = () => {
333
333
  const changeStyle = {}
334
334
  width && (changeStyle['width'] = width)
335
335
  height && (changeStyle['height'] = height)
336
336
  backgroundColor && (changeStyle['backgroundColor'] = backgroundColor)
337
337
  return changeStyle
338
338
  }
339
339
  useEffect(() => {
340
340
  setMeasureComplete(true)
341
341
  if (needShowHighVersion) return
342
342
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
343
343
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
344
344
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
345
345
  !componentShowStateRef.current && dealPageScrollInfo(res)
346
346
  })
347
347
  }, [])
348
348
 
349
349
  const dealPageScrollInfo = (res) => {
350
350
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
351
351
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
352
352
  if (measureRef.current) {
353
353
  const eleClientRect =
354
354
  measureRef.current.getBoundingClientRect()
355
355
  const getContainerHeightOffSetY =
356
356
  displayHeight * 1.5 + offSetY
357
357
  const eleOffsetTop = Math.ceil(eleClientRect.top)
358
358
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
359
359
  if (!componentShowStateRef.current) {
360
360
  if (getContainerHeightOffSetY > eleOffsetTop) {
361
361
  componentShowStateRef.current = true
362
362
  setComponentShowState(true)
363
363
  }
364
364
  }
365
365
  }
366
366
  }
367
367
  return (
368
368
  isH5AndJdShopView &&
369
369
  global?.config?.needImageLazy !== false &&
370
370
  !needShowHighVersion &&
371
371
  !isAppStowShop ? (
372
372
  <View
373
373
  ref={measureRef}
374
374
  className={classNames(
375
375
  imageStyle["d-app-lazy-image"],
376
376
  {
377
377
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
378
378
  },
379
379
  {
380
380
  [imageStyle["d-hide-image-error"]]: imageErrState,
381
381
  },
382
382
  {
383
383
  [imageStyle["d-load-completed"]]: loadSuccess,
384
384
  },
385
385
  {
386
386
  "d-imag-rendering-crisp-edges":
387
387
  !global.info.pageInfo.isVipShop && imagRenderingSet,
388
388
  },
389
389
  "J_html5ImageBg",
390
390
  className
391
391
  )}
392
392
  style={{
393
393
  ...style,
394
394
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
395
395
  }}
396
396
  {...otherOption}
397
397
  >
398
398
  {(componentShowState || lazyLoad === false) && (
399
399
  <img
400
400
  src={getQualityImage(
401
401
  imgSrc,
402
402
  global.info.pageInfo.isVipShop
403
403
  ? NetWorkTypeQuality["perfect"]
404
404
  : NetWorkTypeQuality[getNetWorkType]
405
405
  )}
406
406
  onLoad={imageLoad.bind(this, imgSrc)}
407
407
  onError={imageErrorHandle}
408
408
  />
409
409
  )}
410
410
  </View>
411
411
  ) : enableAvifOptimize ? (
412
412
  [
413
413
  measureComplete ? (
414
414
  <Image
415
415
  key={hasRetrySuccess? "realImageRetry": "realImage"}
416
416
  style={{
417
417
  ...style,
418
418
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
419
419
  }}
420
420
  className={classNames(
421
421
  imageStyle["d-lazy-image"],
422
422
  {
423
423
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
424
424
  },
425
425
  {
426
426
  [imageStyle["d-hide-image-error"]]: imageErrState,
427
427
  },
428
428
  {
429
429
  [imageStyle["d-load-completed"]]: loadSuccess,
430
430
  },
431
431
  {
432
432
  "d-imag-rendering-crisp-edges": imagRenderingSet,
433
433
  },
434
434
  className
435
435
  )}
436
436
  src={hasRetrySuccess? imgSrc: getRequestSrc(imgSrc)}
437
437
  lazyLoad={isChartH5 ? false : lazyLoad}
438
438
  onError={imageErrorHandle}
439
439
  onLoad={imageLoad.bind(this, imgSrc)}
440
440
  {...otherOption}
441
441
  />
442
442
  ) : (
443
443
  <Image
444
444
  key={"defaultImage"}
445
445
  style={{
446
446
  ...style,
447
447
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
448
448
  }}
449
449
  className={classNames(
450
450
  imageStyle["d-lazy-image"],
451
451
  {
452
452
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
453
453
  },
454
454
  {
455
455
  [imageStyle["d-hide-image-error"]]: imageErrState,
456
456
  },
457
457
  {
458
458
  [imageStyle["d-load-completed"]]: loadSuccess,
459
459
  },
460
460
  {
461
461
  "d-imag-rendering-crisp-edges": imagRenderingSet,
462
462
  },
463
463
  className
464
464
  )}
465
465
  src={isSkuImage ? DEFAULT_SKU_SRC : DEFAULT_SRC}
466
466
  />
467
467
  ),
468
468
  loadSuccess ? null : <View key={"measureRef"} ref={measureRef}></View>,
469
469
  ]
470
470
  ) : (
471
471
  <Image
472
472
  style={{
473
473
  ...style,
474
474
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
475
475
  }}
476
476
  className={classNames(
477
477
  imageStyle["d-lazy-image"],
478
478
  {
479
479
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
480
480
  },
481
481
  {
482
482
  [imageStyle["d-hide-image-error"]]: imageErrState,
483
483
  },
484
484
  {
485
485
  [imageStyle["d-load-completed"]]: loadSuccess,
486
486
  },
487
487
  {
488
488
  "d-imag-rendering-crisp-edges": imagRenderingSet,
489
489
  },
490
490
  className
491
491
  )}
492
492
  src={getQualityImage(imgSrc, NetWorkTypeQuality[getNetWorkType])}
493
493
  lazyLoad={isChartH5 ? false : lazyLoad}
494
494
  onError={imageErrorHandle}
495
495
  onLoad={imageLoad.bind(this, imgSrc)}
496
496
  {...otherOption}
497
497
  />
498
498
  )
499
499
  )
500
500
  lazyLoad: true,
501
501
  isSkuImage: false,
502
502
  hideErrorImage: false,
503
503
  imagRenderingSet: true,
504
504
  src: null,
505
505
  style: null,
506
506
  width: null,
507
507
  height: null,
508
508
  backgroundColor: null,
509
509
  className: null,
510
510
  errorSrc: null,
511
511
  onLoad: null,
512
512
  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
+ }
@@ -0,0 +1 @@
1
+ import React, {useEffect, useRef} from 'react'
2
  const { title, openAppParams, style, hasCommonHeader = true, hasDownloadTips = true, headerParams } = props
1
3
  const headerRef:any = useRef(null)
2
4
  useEffect(() => {
3
5
  hasCommonHeader && initCommonHeader()
4
6
  hasDownloadTips && initDownloadAppLayerConfigData()
5
7
  }, [])
6
8
  const scrollEventFunc = () => {
7
9
  const stickyTop = headerRef.current?.getBoundingClientRect()?.top || 0;
8
10
  const rootScrollEleNode = document.querySelector('#J_shopHomeRoot')
9
11
  if (rootScrollEleNode && rootScrollEleNode.scrollTop > stickyTop) {
10
12
  headerRef.current.classList.add('d-mobile-header-sticky');
11
13
  } else {
12
14
  headerRef.current.classList.remove('d-mobile-header-sticky');
13
15
  }
14
16
  }
15
17
  useEffect(() => {
16
18
  if(!headerRef.current) return
17
19
  const rootScrollEleNode = document.querySelector('#J_shopHomeRoot')
18
20
  rootScrollEleNode && rootScrollEleNode.addEventListener('scroll', scrollEventFunc);
19
21
  return () => {
20
22
  rootScrollEleNode && rootScrollEleNode.removeEventListener('scroll', scrollEventFunc)
21
23
  }
22
24
  },[])
23
25
  const initCommonHeader = () => {
24
26
  if (window?.MCommonHeaderBottom) {
25
27
  const mchb = new MCommonHeaderBottom()
26
28
  const headerArg = {
27
29
  moduleName: 'shop',
28
30
  hrederId: 'm_common_header',
29
31
  title,
30
32
  stype: 1,
31
33
  onClickJdkey: function () {
32
34
  console.log('==>m_common_header jdkey click.')
33
35
  },
34
36
  ...headerParams
35
37
  }
36
38
  mchb.header(headerArg)
37
39
  }
38
40
  }
39
41
  const initDownloadAppLayerConfigData = () => {
40
42
  const getEle = document.getElementById('m_common_tip')
41
43
  getEle &&
42
44
  window.$ &&
43
45
  window.$.downloadAppLayerConfigData &&
44
46
  window.$.downloadAppLayerConfigData({
45
47
  tipId: 'm_common_tip',
46
48
  M_sourceFrom: 'jshop',
47
49
  bottom: 74,
48
50
  onClickTipX: () => {
49
51
  Taro.eventCenter.trigger(
50
52
  TaroEventType.DOWN_LOAD_APP_CLOSE_CHANGE,
51
53
  true,
52
54
  )
53
55
  },
54
56
  downloadAppPlugIn: {
55
57
  M_sourceFrom: 'jshop',
56
58
  openAppBtnId: 'download_openapp',
57
59
  downAppURl: '//conecli.com/downloadApp/download.html?channel=jd-m',
58
60
  inteneUrl: 'openapp.jdmobile://virtual?',
59
61
  inteneUrlParams: {
60
62
  category: 'jump',
61
63
  des: 'jshopMain',
62
64
  shopId: `${global.info.queryInfo.shopId || ''}`,
63
65
  venderId: `${global.info.queryInfo.venderId || ''}`,
64
66
  sourceType: global.info.queryInfo?.sourceType || 'M-H5',
65
67
  sourceValue: global.info.queryInfo?.sourceValue || 'Mshop',
66
68
  ...openAppParams,
67
69
  },
68
70
  },
69
71
  })
70
72
  }
71
73
  return !isWxMiniH5View && !isJdApp ? (
72
74
  <View
73
75
  className={mobileCommonHeaderStyle['d-mobile-header-layout']}
74
76
  style={style}
75
77
  ref={headerRef}
76
78
  >
77
79
  <View
78
80
  id="m_common_tip"
79
81
  className={mobileCommonHeaderStyle['d-mobile-common-tip']}
80
82
  />
81
83
  {hasCommonHeader && (
82
84
  <View
83
85
  id="m_common_header"
84
86
  className={mobileCommonHeaderStyle['d-mobile-common-header']}
85
87
  />
86
88
  )}
87
89
  </View>
88
90
  ) : null
89
91
  title: '店铺',
90
92
  openAppParams: {},
@@ -1 +1 @@
1
- import { NETWORK_DATA_TYPE } from '../../../common/const'
2
1
  [NETWORK_DATA_TYPE.NO_NET_WORK]: '网络连接已断开',
3
2
  [NETWORK_DATA_TYPE.DATA_ERROR]: '数据加载失败',
4
3
  [NETWORK_DATA_TYPE.NO_DATA]: '你访问的内容飞到太空了',
5
4
  [NETWORK_DATA_TYPE.RISK]: '活动太火爆',
6
5
  [NETWORK_DATA_TYPE.NO_NET_WORK]: '请检查您的网络设置',
7
6
  [NETWORK_DATA_TYPE.DATA_ERROR]: '请稍后重试',
8
7
  [NETWORK_DATA_TYPE.NO_DATA]: '',
9
8
  [NETWORK_DATA_TYPE.RISK]: '页面加载失败,请稍后再试',
10
9
  NETWORK_DATA_TYPE.NO_NET_WORK,
11
10
  NETWORK_DATA_TYPE.DATA_ERROR,
12
11
  NETWORK_DATA_TYPE.NO_DATA,
13
12
  NETWORK_DATA_TYPE.RISK,
14
13
  No_Data_Bmall:'no-data-bmall',
14
+ import { NETWORK_DATA_TYPE } from '../../../common/const'
15
15
  [NETWORK_DATA_TYPE.NO_NET_WORK]: '网络连接已断开',
16
16
  [NETWORK_DATA_TYPE.DATA_ERROR]: '数据加载失败',
17
17
  [NETWORK_DATA_TYPE.NO_DATA]: '你访问的内容飞到太空了',
18
18
  [NETWORK_DATA_TYPE.RISK]: '活动太火爆',
19
19
  [NETWORK_DATA_TYPE.NO_NET_WORK]: '请检查您的网络设置',
20
20
  [NETWORK_DATA_TYPE.DATA_ERROR]: '请稍后重试',
21
21
  [NETWORK_DATA_TYPE.NO_DATA]: '',
22
22
  [NETWORK_DATA_TYPE.RISK]: '页面加载失败,请稍后再试',
23
23
  NETWORK_DATA_TYPE.NO_NET_WORK,
24
24
  NETWORK_DATA_TYPE.DATA_ERROR,
25
25
  NETWORK_DATA_TYPE.NO_DATA,
26
26
  NETWORK_DATA_TYPE.RISK,
27
27
  No_Data_Bmall:'no-data-bmall',
@@ -50,6 +50,10 @@
50
50
  .d-no-data-tip-1 {
51
51
  background-image: url('https://img14.360buyimg.com/imagetools/jfs/t1/152550/40/8432/21643/5fc9cae0E5391a506/523da679188ff687.png');
52
52
  }
53
+
54
+ .d-no-data-tip-2 {
55
+ background-image: url('https://img11.360buyimg.com/imagetools/jfs/t1/142705/35/17776/5911/5fd1e62dE4fbc2300/3ee1d4160db1dac6.png');
56
+ }
53
57
  .d-no-network-err-tip {
54
58
  background-image: url('https://img14.360buyimg.com/imagetools/jfs/t1/146556/1/17745/7493/5fd1e62dE86e86669/96f5c91befa8e991.png');
55
59
  }