@conecli/cone-render 0.8.41 → 0.8.42

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.
@@ -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 = taroJdBaseInfo.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 [imgSrc, setImgSrc] = useState(src)
25
24
  const componentLazyRef = useRef<HTMLElement | null>(null)
26
25
  const componentShowStateRef = useRef(false)
27
26
  const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
28
27
  const imageError = useCallback(
29
28
  (e) => {
30
29
  console.log('图片加载错误', e)
31
30
  errorSrc && setImgSrc(errorSrc)
32
31
  hideErrorImage && setImageErrState(true)
33
32
  typeof onError === 'function' && onError(e, src, props)
34
33
  },
35
34
  [src],
36
35
  )
37
36
 
38
37
  const imageLoad = useCallback(
39
38
  (_src, event) => {
40
39
  setLoadSuccess(true)
41
40
  typeof onLoad === 'function' && onLoad(event, src, props)
42
41
  },
43
42
  [src],
44
43
  )
45
44
 
46
45
  const changeStyleIncludeWidthAndHeightAndBgColor = () => {
47
46
  const changeStyle = {}
48
47
  width && (changeStyle['width'] = width)
49
48
  height && (changeStyle['height'] = height)
50
49
  backgroundColor && (changeStyle['backgroundColor'] = backgroundColor)
51
50
  return changeStyle
52
51
  }
53
52
  useEffect(() => {
54
53
  if(needShowHighVersion) return
55
54
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
56
55
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
57
56
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
58
57
  !componentShowStateRef.current && dealPageScrollInfo(res)
59
58
  })
60
59
  }, [])
61
60
 
62
61
  const dealPageScrollInfo = (res) => {
63
62
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
64
63
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
65
64
  if (componentLazyRef.current) {
66
65
  const eleClientRect =
67
66
  componentLazyRef.current.getBoundingClientRect()
68
67
  const getContainerHeightOffSetY =
69
68
  displayHeight * 1.5 + offSetY
70
69
  const eleOffsetTop = Math.ceil(eleClientRect.top)
71
70
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
72
71
  if (!componentShowStateRef.current) {
73
72
  if (getContainerHeightOffSetY > eleOffsetTop) {
74
73
  componentShowStateRef.current = true
75
74
  setComponentShowState(true)
76
75
  }
77
76
  }
78
77
  }
79
78
  }
80
79
  return (
81
80
  (isH5AndJdShopView && global?.config?.needImageLazy !== false && !needShowHighVersion && !isAppStowShop) ? (
82
81
  <View
83
82
  ref={ componentLazyRef }
84
83
  className={classNames(
85
84
  imageStyle['d-app-lazy-image'],
86
85
  {
87
86
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
88
87
  },
89
88
  {
90
89
  [imageStyle['d-hide-image-error']]: imageErrState,
91
90
  },
92
91
  {
93
92
  [imageStyle['d-load-completed']]: loadSuccess,
94
93
  },
95
94
  {
96
95
  'd-imag-rendering-crisp-edges':
97
96
  !taroJdBaseInfo.info.pageInfo.isVipShop &&
98
97
  imagRenderingSet,
99
98
  },
100
99
  'J_html5ImageBg',
101
100
  className,
102
101
  )}
103
102
  style={{
104
103
  ...style,
105
104
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
106
105
  }}
107
106
  {...otherOption}
108
107
  >
109
108
  {(componentShowState || lazyLoad === false) && <img
110
109
  src={getQualityImage(
111
110
  imgSrc,
112
111
  taroJdBaseInfo.info.pageInfo.isVipShop
113
112
  ? NetWorkTypeQuality['perfect']
114
113
  : NetWorkTypeQuality[getNetWorkType],
115
114
  )}
116
115
  onLoad={imageLoad.bind(this, imgSrc)}
117
116
  onError={imageError}
118
117
  />}
119
118
  </View>
120
119
  ) : (
121
120
  <Image
122
121
  style={{
123
122
  ...style,
124
123
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
125
124
  }}
126
125
  className={classNames(
127
126
  imageStyle['d-lazy-image'],
128
127
  {
129
128
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
130
129
  },
131
130
  {
132
131
  [imageStyle['d-hide-image-error']]: imageErrState,
133
132
  },
134
133
  {
135
134
  [imageStyle['d-load-completed']]: loadSuccess,
136
135
  },
137
136
  {
138
137
  'd-imag-rendering-crisp-edges': imagRenderingSet,
139
138
  },
140
139
  className,
141
140
  )}
142
141
  src={getQualityImage(
143
142
  imgSrc,
144
143
  NetWorkTypeQuality[getNetWorkType],
145
144
  )}
146
145
  lazyLoad={isChartH5 ? false : lazyLoad}
147
146
  onError={imageError}
148
147
  onLoad={imageLoad.bind(this, imgSrc)}
149
148
  {...otherOption}
150
149
  />
151
150
  )
152
151
  )
153
152
  lazyLoad: true,
154
153
  isSkuImage: false,
155
154
  hideErrorImage: false,
156
155
  imagRenderingSet: true,
157
156
  src: null,
158
157
  style: null,
159
158
  width: null,
160
159
  height: null,
161
160
  backgroundColor: null,
162
161
  className: null,
163
162
  errorSrc: null,
164
163
  onLoad: null,
165
164
  onError: null,
165
+ import React, { useCallback, useEffect, useRef, useState } from 'react'
166
166
  TaroEventType,
167
167
  const {
168
168
  src,
169
169
  lazyLoad,
170
170
  imagRenderingSet,
171
171
  width,
172
172
  height,
173
173
  className,
174
174
  isSkuImage,
175
175
  hideErrorImage,
176
176
  style,
177
177
  backgroundColor,
178
178
  errorSrc,
179
179
  onLoad,
180
180
  onError,
181
181
  ...otherOption
182
182
  } = props
183
183
  getNetWorkType === NetWorkTypeQuality.default &&
184
184
  (getNetWorkType = global.info.sysInfo.netWorkType)
185
185
  const [loadSuccess, setLoadSuccess] = useState(false)
186
186
  const [imageErrState, setImageErrState] = useState(false)
187
187
  const [componentShowState, setComponentShowState] = useState(false)
188
188
  const measureRef = useRef < HTMLElement | null > (null)
189
189
  const [measureComplete, setMeasureComplete] = useState(false)
190
190
  const [imgSrc, setImgSrc] = useState(src)
191
191
  const [hasRetrySuccess, setHasRetrySuccess] = useState(false)
192
192
  const hasRetryRef = useRef(false)
193
193
  const componentShowStateRef = useRef(false)
194
194
  const requestSrcRef = useRef(src)
195
195
  const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
196
196
  const enableAvifOptimize = isImageOptimizeEnable()
197
197
 
198
198
  const getRequestSrc = useCallback((src) => {
199
199
  const requestSrc = getQualityImage(
200
200
  imgSrc,
201
201
  { isSkuImage, size: measureRef?.current?.offsetWidth }
202
202
  )
203
203
  requestSrcRef.current = requestSrc
204
204
  return requestSrc
205
205
  }, [src])
206
206
  const imageErrorRetry = (src) => {
207
207
  return new Promise((resolve, reject) => {
208
208
  if(fetch && window && window.Image){
209
209
  fetch(src)
210
210
  .then(response => {
211
211
  const {ok, status} = response
212
212
  if (ok) {
213
213
  response.blob().then(blob => {
214
214
  const url = URL.createObjectURL(blob)
215
215
  const img = new window.Image()
216
216
  img.src = url;
217
217
  img.onload = () => {
218
218
  resolve({
219
219
  ok: true,
220
220
  url
221
221
  })
222
222
  setTimeout(() => {
223
223
  URL.revokeObjectURL(url)
224
224
  }, 1000)
225
225
  };
226
226
  img.onerror = () => {
227
227
  resolve({
228
228
  ok: false,
229
229
  text: '图片解析异常',
230
230
  type: 'imageParseError',
231
231
  })
232
232
  URL.revokeObjectURL(url)
233
233
  };
234
234
  })
235
235
  }else {
236
236
  if(status === 404){
237
237
  resolve({
238
238
  ok: false,
239
239
  text: '访问图片不存在',
240
240
  type: 'noSuchUrlImage',
241
241
  })
242
242
  }else{
243
243
  resolve({
244
244
  ok: false,
245
245
  status: status,
246
246
  text: '其它图片问题',
247
247
  type: 'otherImageError',
248
248
  })
249
249
  }
250
250
  }
251
251
  })
252
252
  .catch(error => {
253
253
  resolve({
254
254
  ok: false,
255
255
  text: '网络异常',
256
256
  type: 'networkError',
257
257
  })
258
258
  console.error('LazyLoadImage imageErrorRetry() error:', error)
259
259
  });
260
260
  }else{
261
261
  resolve({
262
262
  ok: false,
263
263
  text: '不支持重试',
264
264
  type: 'notSupportRetry',
265
265
  })
266
266
  }
267
267
  })
268
268
 
269
269
  const imageErrorHandle = useCallback(
270
270
  (e) => {
271
271
  console.log(' ==============> 图片加载错误', e)
272
272
  if (!hasRetryRef.current) {
273
273
  hasRetryRef.current = true
274
274
  if(src){
275
275
  try{
276
276
  imageErrorRetry(requestSrcRef.current).then((result) => {
277
277
  const { status, ok, text, type, url } = result || {}
278
278
  if(ok){
279
279
  setImgSrc(url)
280
280
  setHasRetrySuccess(true)
281
281
  }else{
282
282
  errorSrc && setImgSrc(errorSrc)
283
283
  hideErrorImage && setImageErrState(true)
284
284
  typeof onError === 'function' && onError(e, src, props)
285
285
  const { shopId, venderId } = global.info.queryInfo || {}
286
286
  sgmCustomReport({
287
287
  code: getSgmCustomCode(`${SgmCustomCode.IMAGE_LOAD}_${type}`),
288
288
  msg: {
289
289
  shopId,
290
290
  venderId,
291
291
  originSrc: src,
292
292
  requestSrc: requestSrcRef.current,
293
293
  status,
294
294
  text
295
295
  },
296
296
  })
297
297
  }
298
298
  })
299
299
  }catch(e){
300
300
  console.error('LazyLoadImage imageErrorHandle() error:', e)
301
301
  errorSrc && setImgSrc(errorSrc)
302
302
  hideErrorImage && setImageErrState(true)
303
303
  typeof onError === 'function' && onError(e, src, props)
304
304
  }
305
305
  }
306
306
  }
307
307
  },
308
308
  [src, hasRetryRef.current],
309
309
  )
310
310
 
311
311
 
312
312
  const imageLoad = useCallback(
313
313
  (_src, event) => {
314
314
  setLoadSuccess(true)
315
315
  typeof onLoad === 'function' && onLoad(event, src, props)
316
316
  },
317
317
  [src],
318
318
  )
319
319
 
320
320
  const changeStyleIncludeWidthAndHeightAndBgColor = () => {
321
321
  const changeStyle = {}
322
322
  width && (changeStyle['width'] = width)
323
323
  height && (changeStyle['height'] = height)
324
324
  backgroundColor && (changeStyle['backgroundColor'] = backgroundColor)
325
325
  return changeStyle
326
326
  }
327
327
  useEffect(() => {
328
328
  setMeasureComplete(true)
329
329
  if (needShowHighVersion) return
330
330
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
331
331
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
332
332
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
333
333
  !componentShowStateRef.current && dealPageScrollInfo(res)
334
334
  })
335
335
  }, [])
336
336
 
337
337
  const dealPageScrollInfo = (res) => {
338
338
  const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
339
339
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
340
340
  if (measureRef.current) {
341
341
  const eleClientRect =
342
342
  measureRef.current.getBoundingClientRect()
343
343
  const getContainerHeightOffSetY =
344
344
  displayHeight * 1.5 + offSetY
345
345
  const eleOffsetTop = Math.ceil(eleClientRect.top)
346
346
  const eleOffsetHeight = Math.ceil(eleClientRect.height)
347
347
  if (!componentShowStateRef.current) {
348
348
  if (getContainerHeightOffSetY > eleOffsetTop) {
349
349
  componentShowStateRef.current = true
350
350
  setComponentShowState(true)
351
351
  }
352
352
  }
353
353
  }
354
354
  }
355
355
  return (
356
356
  isH5AndJdShopView &&
357
357
  global?.config?.needImageLazy !== false &&
358
358
  !needShowHighVersion &&
359
359
  !isAppStowShop ? (
360
360
  <View
361
361
  ref={measureRef}
362
362
  className={classNames(
363
363
  imageStyle["d-app-lazy-image"],
364
364
  {
365
365
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
366
366
  },
367
367
  {
368
368
  [imageStyle["d-hide-image-error"]]: imageErrState,
369
369
  },
370
370
  {
371
371
  [imageStyle["d-load-completed"]]: loadSuccess,
372
372
  },
373
373
  {
374
374
  "d-imag-rendering-crisp-edges":
375
375
  !global.info.pageInfo.isVipShop && imagRenderingSet,
376
376
  },
377
377
  "J_html5ImageBg",
378
378
  className
379
379
  )}
380
380
  style={{
381
381
  ...style,
382
382
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
383
383
  }}
384
384
  {...otherOption}
385
385
  >
386
386
  {(componentShowState || lazyLoad === false) && (
387
387
  <img
388
388
  src={getQualityImage(
389
389
  imgSrc,
390
390
  global.info.pageInfo.isVipShop
391
391
  ? NetWorkTypeQuality["perfect"]
392
392
  : NetWorkTypeQuality[getNetWorkType]
393
393
  )}
394
394
  onLoad={imageLoad.bind(this, imgSrc)}
395
395
  onError={imageErrorHandle}
396
396
  />
397
397
  )}
398
398
  </View>
399
399
  ) : enableAvifOptimize ? (
400
400
  [
401
401
  measureComplete ? (
402
402
  <Image
403
403
  key={hasRetrySuccess? "realImageRetry": "realImage"}
404
404
  style={{
405
405
  ...style,
406
406
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
407
407
  }}
408
408
  className={classNames(
409
409
  imageStyle["d-lazy-image"],
410
410
  {
411
411
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
412
412
  },
413
413
  {
414
414
  [imageStyle["d-hide-image-error"]]: imageErrState,
415
415
  },
416
416
  {
417
417
  [imageStyle["d-load-completed"]]: loadSuccess,
418
418
  },
419
419
  {
420
420
  "d-imag-rendering-crisp-edges": imagRenderingSet,
421
421
  },
422
422
  className
423
423
  )}
424
424
  src={hasRetrySuccess? imgSrc: getRequestSrc(imgSrc)}
425
425
  lazyLoad={isChartH5 ? false : lazyLoad}
426
426
  onError={imageErrorHandle}
427
427
  onLoad={imageLoad.bind(this, imgSrc)}
428
428
  {...otherOption}
429
429
  />
430
430
  ) : (
431
431
  <Image
432
432
  key={"defaultImage"}
433
433
  style={{
434
434
  ...style,
435
435
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
436
436
  }}
437
437
  className={classNames(
438
438
  imageStyle["d-lazy-image"],
439
439
  {
440
440
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
441
441
  },
442
442
  {
443
443
  [imageStyle["d-hide-image-error"]]: imageErrState,
444
444
  },
445
445
  {
446
446
  [imageStyle["d-load-completed"]]: loadSuccess,
447
447
  },
448
448
  {
449
449
  "d-imag-rendering-crisp-edges": imagRenderingSet,
450
450
  },
451
451
  className
452
452
  )}
453
453
  src={isSkuImage ? DEFAULT_SKU_SRC : DEFAULT_SRC}
454
454
  />
455
455
  ),
456
456
  loadSuccess ? null : <View key={"measureRef"} ref={measureRef}></View>,
457
457
  ]
458
458
  ) : (
459
459
  <Image
460
460
  style={{
461
461
  ...style,
462
462
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
463
463
  }}
464
464
  className={classNames(
465
465
  imageStyle["d-lazy-image"],
466
466
  {
467
467
  [imageStyle["d-lazy-sku-image"]]: isSkuImage,
468
468
  },
469
469
  {
470
470
  [imageStyle["d-hide-image-error"]]: imageErrState,
471
471
  },
472
472
  {
473
473
  [imageStyle["d-load-completed"]]: loadSuccess,
474
474
  },
475
475
  {
476
476
  "d-imag-rendering-crisp-edges": imagRenderingSet,
477
477
  },
478
478
  className
479
479
  )}
480
480
  src={getQualityImage(imgSrc, NetWorkTypeQuality[getNetWorkType])}
481
481
  lazyLoad={isChartH5 ? false : lazyLoad}
482
482
  onError={imageErrorHandle}
483
483
  onLoad={imageLoad.bind(this, imgSrc)}
484
484
  {...otherOption}
485
485
  />
486
486
  )
487
487
  )
488
488
  lazyLoad: true,
489
489
  isSkuImage: false,
490
490
  hideErrorImage: false,
491
491
  imagRenderingSet: true,
492
492
  src: null,
493
493
  style: null,
494
494
  width: null,
495
495
  height: null,
496
496
  backgroundColor: null,
497
497
  className: null,
498
498
  errorSrc: null,
499
499
  onLoad: null,
500
500
  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
+ }
@@ -1 +1 @@
1
- import React, { useEffect, useContext, useState } from 'react'
2
1
  const { title, openAppParams, style, hasCommonHeader = true, hasDownloadTips = true, headerParams } = props
3
2
  useEffect(() => {
4
3
  hasCommonHeader && initCommonHeader()
5
4
  hasDownloadTips && initDownloadAppLayerConfigData()
6
5
  }, [])
7
6
  const initCommonHeader = () => {
8
7
  if (window?.MCommonHeaderBottom) {
9
8
  const mchb = new MCommonHeaderBottom()
10
9
  const headerArg = {
11
10
  moduleName: 'shop',
12
11
  hrederId: 'm_common_header',
13
12
  title,
14
13
  stype: 1,
15
14
  onClickJdkey: function () {
16
15
  console.log('==>m_common_header jdkey click.')
17
16
  },
18
17
  ...headerParams
19
18
  }
20
19
  mchb.header(headerArg)
21
20
  }
22
21
  }
23
22
  const initDownloadAppLayerConfigData = () => {
24
23
  const getEle = document.getElementById('m_common_tip')
25
24
  getEle &&
26
25
  window.$ &&
27
26
  window.$.downloadAppLayerConfigData &&
28
27
  window.$.downloadAppLayerConfigData({
29
28
  tipId: 'm_common_tip',
30
29
  M_sourceFrom: 'jshop',
31
30
  bottom: 74,
32
31
  onClickTipX: () => {
33
32
  Taro.eventCenter.trigger(
34
33
  TaroEventType.DOWN_LOAD_APP_CLOSE_CHANGE,
35
34
  true,
36
35
  )
37
36
  },
38
37
  downloadAppPlugIn: {
39
38
  M_sourceFrom: 'jshop',
40
39
  openAppBtnId: 'download_openapp',
41
40
  downAppURl: '//conecli.com/downloadApp/download.html?channel=jd-m',
42
41
  inteneUrl: 'openapp.jdmobile://virtual?',
43
42
  inteneUrlParams: {
44
43
  category: 'jump',
45
44
  des: 'jshopMain',
46
45
  shopId: `${global.info.queryInfo.shopId || ''}`,
47
46
  venderId: `${global.info.queryInfo.venderId || ''}`,
48
47
  sourceType: global.info.queryInfo?.sourceType || 'M-H5',
49
48
  sourceValue: global.info.queryInfo?.sourceValue || 'Mshop',
50
49
  ...openAppParams,
51
50
  },
52
51
  },
53
52
  })
54
53
  }
55
54
  return !isWxMiniH5View && !isJdApp ? (
56
55
  <View
57
56
  className={mobileCommonHeaderStyle['d-mobile-header-layout']}
58
57
  style={style}
59
58
  >
60
59
  <View
61
60
  id="m_common_tip"
62
61
  className={mobileCommonHeaderStyle['d-mobile-common-tip']}
63
62
  />
64
63
  {hasCommonHeader && (
65
64
  <View
66
65
  id="m_common_header"
67
66
  className={mobileCommonHeaderStyle['d-mobile-common-header']}
68
67
  />
69
68
  )}
70
69
  </View>
71
70
  ) : null
72
71
  title: '店铺',
73
72
  openAppParams: {},
73
+ import React, {useEffect, useRef} from 'react'
74
74
  const { title, openAppParams, style, hasCommonHeader = true, hasDownloadTips = true, headerParams } = props
75
75
  const headerRef:any = useRef(null)
76
76
  useEffect(() => {
77
77
  hasCommonHeader && initCommonHeader()
78
78
  hasDownloadTips && initDownloadAppLayerConfigData()
79
79
  }, [])
80
80
  const scrollEventFunc = () => {
81
81
  const stickyTop = headerRef.current?.getBoundingClientRect()?.top || 0;
82
82
  const rootScrollEleNode = document.querySelector('#J_shopHomeRoot')
83
83
  if (rootScrollEleNode && rootScrollEleNode.scrollTop > stickyTop) {
84
84
  headerRef.current.classList.add('d-mobile-header-sticky');
85
85
  } else {
86
86
  headerRef.current.classList.remove('d-mobile-header-sticky');
87
87
  }
88
88
  }
89
89
  useEffect(() => {
90
90
  if(!headerRef.current) return
91
91
  const rootScrollEleNode = document.querySelector('#J_shopHomeRoot')
92
92
  rootScrollEleNode && rootScrollEleNode.addEventListener('scroll', scrollEventFunc);
93
93
  return () => {
94
94
  rootScrollEleNode && rootScrollEleNode.removeEventListener('scroll', scrollEventFunc)
95
95
  }
96
96
  },[])
97
97
  const initCommonHeader = () => {
98
98
  if (window?.MCommonHeaderBottom) {
99
99
  const mchb = new MCommonHeaderBottom()
100
100
  const headerArg = {
101
101
  moduleName: 'shop',
102
102
  hrederId: 'm_common_header',
103
103
  title,
104
104
  stype: 1,
105
105
  onClickJdkey: function () {
106
106
  console.log('==>m_common_header jdkey click.')
107
107
  },
108
108
  ...headerParams
109
109
  }
110
110
  mchb.header(headerArg)
111
111
  }
112
112
  }
113
113
  const initDownloadAppLayerConfigData = () => {
114
114
  const getEle = document.getElementById('m_common_tip')
115
115
  getEle &&
116
116
  window.$ &&
117
117
  window.$.downloadAppLayerConfigData &&
118
118
  window.$.downloadAppLayerConfigData({
119
119
  tipId: 'm_common_tip',
120
120
  M_sourceFrom: 'jshop',
121
121
  bottom: 74,
122
122
  onClickTipX: () => {
123
123
  Taro.eventCenter.trigger(
124
124
  TaroEventType.DOWN_LOAD_APP_CLOSE_CHANGE,
125
125
  true,
126
126
  )
127
127
  },
128
128
  downloadAppPlugIn: {
129
129
  M_sourceFrom: 'jshop',
130
130
  openAppBtnId: 'download_openapp',
131
131
  downAppURl: '//conecli.com/downloadApp/download.html?channel=jd-m',
132
132
  inteneUrl: 'openapp.jdmobile://virtual?',
133
133
  inteneUrlParams: {
134
134
  category: 'jump',
135
135
  des: 'jshopMain',
136
136
  shopId: `${global.info.queryInfo.shopId || ''}`,
137
137
  venderId: `${global.info.queryInfo.venderId || ''}`,
138
138
  sourceType: global.info.queryInfo?.sourceType || 'M-H5',
139
139
  sourceValue: global.info.queryInfo?.sourceValue || 'Mshop',
140
140
  ...openAppParams,
141
141
  },
142
142
  },
143
143
  })
144
144
  }
145
145
  return !isWxMiniH5View && !isJdApp ? (
146
146
  <View
147
147
  className={mobileCommonHeaderStyle['d-mobile-header-layout']}
148
148
  style={style}
149
149
  ref={headerRef}
150
150
  >
151
151
  <View
152
152
  id="m_common_tip"
153
153
  className={mobileCommonHeaderStyle['d-mobile-common-tip']}
154
154
  />
155
155
  {hasCommonHeader && (
156
156
  <View
157
157
  id="m_common_header"
158
158
  className={mobileCommonHeaderStyle['d-mobile-common-header']}
159
159
  />
160
160
  )}
161
161
  </View>
162
162
  ) : null
163
163
  title: '店铺',
164
164
  openAppParams: {},