@conecli/cone-render 0.10.1-shop-beta.4 → 0.10.1-shop-beta.5

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 (63) 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 -1
  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/sgmCustomCode.ts +1 -1
  9. package/dist/components/ErrorBoundary.tsx +1 -1
  10. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  11. package/dist/components/base/CustomVideo/index.tsx +1 -1
  12. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  13. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  14. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  15. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  16. package/dist/components/base/LazyLoadImage/index.h5.module.scss +4 -0
  17. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  18. package/dist/components/base/LazyLoadImage/index.tsx +1 -1
  19. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  20. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  21. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  22. package/dist/components/decorate/DecorateFloorModule/index.module.scss +11 -0
  23. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  24. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  25. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  26. package/dist/components/floorItem.jd.tsx +1 -1
  27. package/dist/components/floorItem.tsx +1 -1
  28. package/dist/components/floorItem.weapp.tsx +1 -1
  29. package/dist/components/remoteFloorItem.tsx +1 -1
  30. package/dist/interface/common.ts +1 -1
  31. package/dist/interface/component.ts +1 -1
  32. package/dist/interface/jumpEventReport.ts +1 -1
  33. package/dist/interface/service.ts +1 -1
  34. package/dist/jumpEventReport/base.ts +1 -1
  35. package/dist/jumpEventReport/const.ts +1 -1
  36. package/dist/jumpEventReport/index.jd.ts +1 -1
  37. package/dist/jumpEventReport/index.weapp.ts +1 -1
  38. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  39. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  40. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  41. package/dist/jumpEventReport/web.base.ts +1 -1
  42. package/dist/jumpEventReport/web.jd.ts +1 -1
  43. package/dist/jumpEventReport/web.tjm.ts +1 -1
  44. package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -0
  45. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  46. package/dist/open/api/device.ts +1 -1
  47. package/dist/open/api/request.ts +1 -1
  48. package/dist/open/api/shopMember.ts +1 -1
  49. package/dist/open/api/util.ts +1 -1
  50. package/dist/open/components/index.ts +1 -1
  51. package/dist/sass/app.h5.scss +5 -0
  52. package/dist/sass/base.scss +45 -0
  53. package/dist/service/requestServer.ts +1 -1
  54. package/dist/utils/connectNativeJsBridge.ts +1 -1
  55. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  56. package/dist/utils/h5Utils.ts +1 -1
  57. package/dist/utils/index.h5.ts +1 -1
  58. package/dist/utils/index.ts +1 -1
  59. package/dist/utils/index.weapp.ts +1 -1
  60. package/dist/utils/sgmCodeUtils.ts +1 -1
  61. package/dist/utils/taroRenderUtil.ts +1 -1
  62. package/dist/utils/utils.ts +1 -1
  63. package/package.json +24 -23
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  nativePageShowToast,
3
2
  ToastAndroidType,
4
3
  ToastIosType,
5
4
  getMPaasConfigByNative,
6
5
  getAppChannelType,
7
6
  isAndroidDevice,
8
7
  isH5AndJdShopView,
9
8
  isChartH5,
10
9
  isH5AndJdShopViewNativeScroll,
11
10
  isIosDevice,
12
11
  isJdAndAndroidDevice,
13
12
  isJdAndIosDevice,
14
13
  isJdApp,
15
14
  isWxApp,
16
15
  isWxMiniH5View,
17
16
  isJdAndHarmonyDevice,
18
17
  isH5AndJingGouMini,
19
18
  urlCookie,
20
19
  sgmCustomReport,
21
20
  isMemberPage,
22
21
  isH5AndJdShopViewH5Scroll,
23
22
  isH5AndJdShopH5CustomScrollView,
24
23
  isAppClassifyPage,
25
24
  isPc,
26
25
  ipLoc_djd,
27
26
  jdAppVersionCompare,
28
27
  isTjScence,
29
28
  isH5AdnJxMini,
30
29
  isTjM,
31
30
  isTjJxM,
32
31
  isTJApp,
33
32
  isH5AdnHaoWuJie,
34
33
  tjChannel,
35
34
  dealNativePixelToCssPixel,
36
35
  isAppStowShop,
37
36
  isJdAndroidX5Core,
38
37
  parseQueryUrlObj,
39
38
  addHttps,
40
39
  clearTaroStorageKey,
41
40
  countStringify,
42
41
  dateFormat,
43
42
  dealAddress,
44
43
  dealShopContentData as originDealShopContentData,
45
44
  debounce,
46
45
  filterUrlQueryData,
47
46
  formatTabActiveMenuType,
48
47
  getAvifSupport,
49
48
  getWebpSupport,
50
49
  getTaroStorageKeyValue,
51
50
  getWxAppCookieStr,
52
51
  isH5,
53
52
  isMin,
54
53
  isJdMin,
55
54
  isWxMin,
56
55
  isWxMinAndWxapp,
57
56
  isJdMinAndHarmony,
58
57
  lodashThrottle,
59
58
  objectToUrlEncode,
60
59
  parseQueryUrlString,
61
60
  removeTaroStorageKey,
62
61
  setLowSmallPicUrl,
63
62
  setTaroStorage,
64
63
  showFailToast,
65
64
  showNormalToast,
66
65
  showSuccessToast,
67
66
  sliceArrToChunkList,
68
67
  throttle,
69
68
  getQualityImageNew,
70
69
  getQualityImageOld,
71
70
  isOpenJdAppUrl,
72
71
  jdOpenAppParams,
73
72
  createJdOpenAppUrl,
74
73
  isEmpty,
75
74
  getJdAppReportPageSource,
76
75
  dealJdOpenAppData,
77
76
  const getNum = Number(num)
78
77
  let _changeLayoutWidth = layoutWidth
79
78
  if (!_changeLayoutWidth) {
80
79
  _changeLayoutWidth =
81
80
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
82
81
  ? _ShopSystemInfo.windowWidth
83
82
  : Taro.getSystemInfoSync()?.windowWidth
84
83
  }
85
84
  return Math.round((getNum / widthSize) * _changeLayoutWidth)
86
85
  changeSize,
87
86
  designWidth = 750,
88
87
  systemInfo,
89
88
  const getRootFontSize =
90
89
  (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
91
90
  const getRealRootFontSize =
92
91
  getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
93
92
  return Math.ceil(
94
93
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
95
94
  getRealRootFontSize,
96
95
  )
97
96
  console.log(
98
97
  '获取系统宽度systemInfo?.windowWidth',
99
98
  systemInfo?.windowWidth,
100
99
  'taroToTransformRoutimePXNumber(changeWidth)',
101
100
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
102
101
  )
103
102
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
104
103
  ? systemInfo?.windowWidth -
105
104
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
106
105
  : systemInfo?.windowWidth ?? 0
107
106
  const systemInfo = Taro.getSystemInfoSync()
108
107
  if (params && params?.pageWidth && params?.pageHeight) {
109
108
  systemInfo.windowWidth = params?.pageWidth
110
109
  systemInfo.windowHeight = params?.pageHeight
111
110
  }
112
111
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
113
112
  console.warn('====获取系统信息=====', systemInfo)
114
113
  return systemInfo
115
114
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
116
115
  const supportBuildType = /app-view|app-member|app-classify|member-home/
117
116
  const scopeCheckPass = supportBuildType.test(buildType || '')
118
117
  const enableAvifOptimize = appVersionCheckPass && scopeCheckPass
119
118
  if (enableAvifOptimize) {
120
119
  const configData = global.getDynamicConfig('avifSwitch')
121
120
  if (!hasOutputLog) {
122
121
  console.warn(
123
122
  '� ~~ file: utils.ts:187 ~~ isImageOptimizeEnable ~~ enableAvifOptimize:',
124
123
  enableAvifOptimize,
125
124
  ' appVersionCheckPass:',
126
125
  appVersionCheckPass,
127
126
  ' scopeCheckPass:',
128
127
  scopeCheckPass,
129
128
  )
130
129
  console.warn(
131
130
  '� ~~ file: utils.ts:188 ~~ global.getDynamicConfig ~~ configData:',
132
131
  configData,
133
132
  )
134
133
  }
135
134
  const {
136
135
  globalOn = true,
137
136
  ignoreOptimizeFromServer = false,
138
137
  page = {},
139
138
  whiteList = [],
140
139
  blackList = [],
141
140
  } = configData || {}
142
141
  const { shopId = '0', venderId = '0' } = parseQueryUrlObj
143
142
  let imageEnableResult = true
144
143
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
145
144
  if (
146
145
  blackList.find(
147
146
  (item) => item.sId === Number(shopId) || item.vId === Number(venderId),
148
147
  )
149
148
  ) {
150
149
  imageEnableResult = false
151
150
  if (!hasOutputLog) {
152
151
  console.warn('� ~~ file: utils.ts:198 命中黑名单!')
153
152
  }
154
153
  } else if (
155
154
  whiteList.find(
156
155
  (item) => item.sId === Number(shopId) || item.vId === Number(venderId),
157
156
  )
158
157
  ) {
159
158
  imageEnableResult = true
160
159
  if (!hasOutputLog) {
161
160
  console.warn('� ~~ file: utils.ts:205 命中白名单!')
162
161
  }
163
162
  } else {
164
163
  imageEnableResult = globalOn === true || page[buildType] === true
165
164
  if (!hasOutputLog) {
166
165
  console.warn(
167
166
  '� ~~ file: utils.ts:211 走全局开关+页面开关控制逻辑,开关结果:',
168
167
  imageEnableResult,
169
168
  )
170
169
  }
171
170
  }
172
171
  if (!hasOutputLog) {
173
172
  hasOutputLog = true
174
173
  }
175
174
  return imageEnableResult
176
175
  } else {
177
176
  return false
178
177
  }
179
178
  if (typeof options === 'object' && isImageOptimizeEnable()) {
180
179
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
181
180
  } else {
182
181
  return getQualityImageOld(imgUrl, options)
183
182
  }
184
183
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
185
184
  windowWidth: window.innerWidth,
186
185
  containerWidth: getContainerWidth(buildType, {
187
186
  windowWidth: window.innerWidth,
188
187
  }),
189
188
  screenWidth: window.innerWidth,
190
189
  platform: '',
191
190
  model: '',
192
191
  system: '',
193
192
  }
194
193
  if (isJdApp && isAndroidDevice && getSystemInfo.windowWidth <= 0) {
195
194
  getSystemInfo.windowWidth = getSystemInfo.screenWidth
196
195
  getSystemInfo['containerWidth'] = getContainerWidth(
197
196
  buildType,
198
197
  getSystemInfo,
199
198
  )
200
199
  }
201
200
  return getSystemInfo
202
201
  const params = Object.assign(
203
202
  {},
204
203
  {
205
204
  title: '',
206
205
  duration: 1500,
207
206
  },
208
207
  options,
209
208
  )
210
209
  params.duration = params.duration / 1000
211
210
  if (isJdApp) {
212
211
  const showSuccessType = isIosDevice
213
212
  ? ToastIosType.SUCCESS
214
213
  : ToastAndroidType.SUCCESS
215
214
  const duration = isAndroidDevice ? 0 : params.duration
216
215
  nativePageShowToast(options.title, showSuccessType, duration)
217
216
  console.log('执行原生toast success')
218
217
  } else {
219
218
  showSuccessToast(options)
220
219
  }
221
220
  const params = Object.assign(
222
221
  {},
223
222
  {
224
223
  title: '',
225
224
  duration: 1500,
226
225
  },
227
226
  options,
228
227
  )
229
228
  params.duration = params.duration / 1000
230
229
  if (isJdApp) {
231
230
  const showSuccessType = isIosDevice
232
231
  ? ToastIosType.FAIL
233
232
  : ToastAndroidType.FAIL
234
233
  const duration = isAndroidDevice ? 0 : params.duration
235
234
  nativePageShowToast(options.title, showSuccessType, duration)
236
235
  console.log('执行原生toast fail')
237
236
  } else {
238
237
  console.log('执行H5 toast fail')
239
238
  showFailToast(options)
240
239
  }
241
240
  const params = Object.assign(
242
241
  {},
243
242
  {
244
243
  title: '',
245
244
  duration: 1500,
246
245
  },
247
246
  options,
248
247
  )
249
248
  params.duration = params.duration / 1000
250
249
  if (isJdApp) {
251
250
  const showSuccessType = isIosDevice
252
251
  ? ToastIosType.NORMAL
253
252
  : ToastAndroidType.NORMAL
254
253
  const duration = isAndroidDevice ? 0 : params.duration
255
254
  nativePageShowToast(options.title, showSuccessType, duration)
256
255
  } else {
257
256
  showNormalToast(options)
258
257
  }
259
258
  const createLoadingEle = document.createElement('div')
260
259
  createLoadingEle.id = 'J_shopLoading'
261
260
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
262
261
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
263
262
  <span class='d-shop-loading-icon'></span>
264
263
  <p class='d-shop-text'>${text}</p>
265
264
  </div>`
266
265
  const getEle = document.body
267
266
  ? document.body
268
267
  : document.getElementsByTagName('body')[0]
269
268
  getEle.appendChild(createLoadingEle)
270
269
  const getEle = document.getElementById('J_shopLoading')
271
270
  getEle && getEle.remove()
272
271
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes =
273
272
  getReviseSystemInfo(params)
274
273
  if (!systemInfo.system && window) {
275
274
  systemInfo.system = window.navigator.userAgent
276
275
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
277
276
  }
278
277
  const isIOS = !!systemInfo?.system.match(/ios/i)
279
278
  const isAndroid = !!systemInfo?.system.match(/android/i)
280
279
  systemInfo.navBarHeight = 0
281
280
  systemInfo.statusBarHeight = 0
282
281
  systemInfo.capsulePosition = null
283
282
  systemInfo.isIOS = isIOS
284
283
  systemInfo.isAndroid = isAndroid
285
284
  _ShopSystemInfo = systemInfo
286
285
  return systemInfo
287
286
  return originDealShopContentData(pageData, sgmCustomReport, isvdev)
288
287
  isJdApp,
289
288
  isWxApp,
290
289
  isIosDevice,
291
290
  isAndroidDevice,
292
291
  isJdAndIosDevice,
293
292
  isJdAndAndroidDevice,
294
293
  isJdAndHarmonyDevice,
295
294
  isJdAndroidX5Core,
296
295
  isMin,
297
296
  isWxMin,
298
297
  isWxMinAndWxapp,
299
298
  isJdMinAndHarmony,
300
299
  isJdMin,
301
300
  isH5,
302
301
  isH5AndJdShopView,
303
302
  isChartH5,
304
303
  isH5AndJdShopViewNativeScroll,
305
304
  isH5AndJdShopViewH5Scroll,
306
305
  isH5AndJdShopH5CustomScrollView,
307
306
  isH5AndJingGouMini,
308
307
  isWxMiniH5View,
309
308
  urlCookie,
310
309
  sliceArrToChunkList,
311
310
  dealAddress,
312
311
  objectToUrlEncode,
313
312
  parseQueryUrlString,
314
313
  setLowSmallPicUrl,
315
314
  setTaroStorage,
316
315
  getTaroStorageKeyValue,
317
316
  removeTaroStorageKey,
318
317
  clearTaroStorageKey,
319
318
  getAvifSupport,
320
319
  getWebpSupport,
321
320
  getQualityImage,
322
321
  countStringify,
323
322
  getWxAppCookieStr,
324
323
  getSystemInfos,
325
324
  pxTransformFromData,
326
325
  dealShopContentDataAndReport as dealShopContentData,
327
326
  dateFormat,
328
327
  throttle,
329
328
  lodashThrottle,
330
329
  debounce,
331
330
  addHttps,
332
331
  commonShowSuccessToast as showSuccessToast,
333
332
  commonShowFailToast as showFailToast,
334
333
  commonShowNormalToast as showNormalToast,
335
334
  showShopLoading,
336
335
  hideShopLoading,
337
336
  getAppChannelType,
338
337
  formatTabActiveMenuType,
339
338
  filterUrlQueryData,
340
339
  sgmCustomReport,
341
340
  isMemberPage,
342
341
  getFloorDataToDataDefines,
343
342
  isOpenJdAppUrl,
344
343
  jdOpenAppParams,
345
344
  createJdOpenAppUrl,
346
345
  isEmpty,
347
346
  getJdAppReportPageSource,
348
347
  isAppClassifyPage,
349
348
  isImageOptimizeEnable,
350
349
  isPc,
351
350
  ipLoc_djd,
352
351
  isTjScence,
353
352
  isH5AdnJxMini,
354
353
  isTjM,
355
354
  isTjJxM,
356
355
  isTJApp,
357
356
  isH5AdnHaoWuJie,
358
357
  tjChannel,
359
358
  dealJdOpenAppData,
360
359
  jdAppVersionCompare,
361
360
  dealNativePixelToCssPixel,
362
361
  isAppStowShop,
363
362
  getSgmCustomCode,
363
+ import Taro from "@tarojs/taro";
364
364
  nativePageShowToast,
365
365
  ToastAndroidType,
366
366
  ToastIosType,
367
367
  getMPaasConfigByNative,
368
368
  stopNativeScrollEvent,
369
369
  getAppChannelType,
370
370
  isAndroidDevice,
371
371
  isH5AndJdShopView,
372
372
  isChartH5,
373
373
  isH5AndJdShopViewNativeScroll,
374
374
  isIosDevice,
375
375
  isJdAndAndroidDevice,
376
376
  isJdAndIosDevice,
377
377
  isJdAndHarmonyDevice,
378
378
  isJdApp,
379
379
  isWxApp,
380
380
  isWxMiniH5View,
381
381
  isH5AndJingGouMini,
382
382
  urlCookie,
383
383
  sgmCustomReport,
384
384
  isMemberPage,
385
385
  isH5AndJdShopViewH5Scroll,
386
386
  isH5AndJdShopH5CustomScrollView,
387
387
  isAppClassifyPage,
388
388
  isAppHomeForMarketPage,
389
389
  isPc,
390
390
  ipLoc_djd,
391
391
  jdAppVersionCompare,
392
392
  dealNativePixelToCssPixel,
393
393
  isAppStowShop,
394
394
  isJdAndroidX5Core,
395
395
  isTjScence,
396
396
  isH5AdnJxMini,
397
397
  isTjM,
398
398
  isTjJxM,
399
399
  isTJApp,
400
400
  isH5AdnHaoWuJie,
401
401
  tjChannel,
402
402
  parseQueryUrlObj,
403
403
  isIpadDevice,
404
404
  addHttps,
405
405
  clearTaroStorageKey,
406
406
  countStringify,
407
407
  dateFormat,
408
408
  dealAddress,
409
409
  dealShopContentData as originDealShopContentData,
410
410
  debounce,
411
411
  filterUrlQueryData,
412
412
  formatTabActiveMenuType,
413
413
  getAvifSupport,
414
414
  getWebpSupport,
415
415
  getTaroStorageKeyValue,
416
416
  getWxAppCookieStr,
417
417
  isH5,
418
418
  isMin,
419
419
  isJdMin,
420
420
  isWxMin,
421
421
  isWxMinAndWxapp,
422
422
  isJdMinAndHarmony,
423
423
  lodashThrottle,
424
424
  objectToUrlEncode,
425
425
  parseQueryUrlString,
426
426
  removeTaroStorageKey,
427
427
  setLowSmallPicUrl,
428
428
  setTaroStorage,
429
429
  showFailToast,
430
430
  showNormalToast,
431
431
  showSuccessToast,
432
432
  sliceArrToChunkList,
433
433
  throttle,
434
434
  getQualityImageNew,
435
435
  getQualityImageOld,
436
436
  isOpenJdAppUrl,
437
437
  jdOpenAppParams,
438
438
  createJdOpenAppUrl,
439
439
  isEmpty,
440
440
  getJdAppReportPageSource,
441
441
  dealJdOpenAppData,
442
442
  const getNum = Number(num);
443
443
  let _changeLayoutWidth = layoutWidth;
444
444
  if (!_changeLayoutWidth) {
445
445
  _changeLayoutWidth =
446
446
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
447
447
  ? _ShopSystemInfo.windowWidth
448
448
  : Taro.getSystemInfoSync()?.windowWidth;
449
449
  }
450
450
  return Math.round((getNum / widthSize) * _changeLayoutWidth);
451
451
  changeSize,
452
452
  designWidth = 750,
453
453
  systemInfo
454
454
  const getRootFontSize =
455
455
  (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
456
456
  const getRealRootFontSize =
457
457
  getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
458
458
  return Math.ceil(
459
459
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
460
460
  getRealRootFontSize
461
461
  );
462
462
  console.log(
463
463
  "获取系统宽度systemInfo?.windowWidth",
464
464
  systemInfo?.windowWidth,
465
465
  "taroToTransformRoutimePXNumber(changeWidth)",
466
466
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
467
467
  );
468
468
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
469
469
  ? systemInfo?.windowWidth -
470
470
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
471
471
  : systemInfo?.windowWidth ?? 0;
472
472
  const systemInfo = Taro.getSystemInfoSync();
473
473
  if (params && params?.pageWidth && params?.pageHeight) {
474
474
  systemInfo.windowWidth = params?.pageWidth;
475
475
  systemInfo.windowHeight = params?.pageHeight;
476
476
  }
477
477
  systemInfo["containerWidth"] = getContainerWidth(buildType, systemInfo);
478
478
  console.warn("====获取系统信息=====", systemInfo);
479
479
  return systemInfo;
480
480
  let result: boolean | null = null;
481
481
  return function () {
482
482
  if (result === null) {
483
483
  const appVersionCheckPass =
484
484
  jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
485
485
  if (!isJdApp) {
486
486
  console.warn("� ~~ file: utils.ts:191 站外H5默认打开图片优化~");
487
487
  isIgnoreOptimizeFromServer = true;
488
488
  result = true;
489
489
  return true;
490
490
  }
491
491
  const enableAvifOptimize = appVersionCheckPass;
492
492
  if (enableAvifOptimize) {
493
493
  const configData = global.getDynamicConfig("avifSwitch");
494
494
  console.warn(
495
495
  "� ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:",
496
496
  buildType
497
497
  );
498
498
  console.warn(
499
499
  "� ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:",
500
500
  configData
501
501
  );
502
502
  const {
503
503
  globalOn = true,
504
504
  ignoreOptimizeFromServer = false,
505
505
  page = {},
506
506
  grayscale = {},
507
507
  whiteList = [],
508
508
  blackList = [],
509
509
  } = configData || {};
510
510
  const { shopId = "0", venderId = "0" } = parseQueryUrlObj;
511
511
  let imageEnableResult = true;
512
512
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
513
513
  if (
514
514
  blackList.find(
515
515
  (item) =>
516
516
  item.sId === Number(shopId) || item.vId === Number(venderId)
517
517
  )
518
518
  ) {
519
519
  imageEnableResult = false;
520
520
  console.warn("� ~~ file: utils.ts:198 命中黑名单~");
521
521
  } else if (
522
522
  whiteList.find(
523
523
  (item) =>
524
524
  item.sId === Number(shopId) || item.vId === Number(venderId)
525
525
  )
526
526
  ) {
527
527
  isIgnoreOptimizeFromServer = true;
528
528
  imageEnableResult = true;
529
529
  console.warn("� ~~ file: utils.ts:205 命中白名单~");
530
530
  } else if (
531
531
  grayscale[buildType] &&
532
532
  isInGrayscale(grayscale[buildType], "imageOptimizeSwitch")
533
533
  ) {
534
534
  isIgnoreOptimizeFromServer = true;
535
535
  imageEnableResult = true;
536
536
  console.warn("� ~~ file: utils.ts:214 命中灰度~");
537
537
  } else {
538
538
  imageEnableResult = globalOn === true || page[buildType] === true;
539
539
  if (globalOn === true) {
540
540
  isIgnoreOptimizeFromServer = true;
541
541
  console.warn(
542
542
  "� ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~"
543
543
  );
544
544
  } else if (page[buildType] === true) {
545
545
  console.warn(
546
546
  "� ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~"
547
547
  );
548
548
  } else {
549
549
  console.warn(
550
550
  "� ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!"
551
551
  );
552
552
  }
553
553
  }
554
554
  result = imageEnableResult;
555
555
  return imageEnableResult;
556
556
  } else {
557
557
  result = false;
558
558
  return false;
559
559
  }
560
560
  } else {
561
561
  return result;
562
562
  }
563
563
  };
564
564
  if (typeof options === "object" && isImageOptimizeEnable()) {
565
565
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
566
566
  } else {
567
567
  return getQualityImageOld(imgUrl, options);
568
568
  }
569
569
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
570
570
  windowWidth: window.innerWidth,
571
571
  containerWidth: getContainerWidth(buildType, {
572
572
  windowWidth: window.innerWidth,
573
573
  }),
574
574
  screenWidth: window.innerWidth,
575
575
  platform: "",
576
576
  model: "",
577
577
  system: "",
578
578
  };
579
579
  if (isJdApp && isAndroidDevice && getSystemInfo.windowWidth <= 0) {
580
580
  getSystemInfo.windowWidth = getSystemInfo.screenWidth;
581
581
  getSystemInfo["containerWidth"] = getContainerWidth(
582
582
  buildType,
583
583
  getSystemInfo
584
584
  );
585
585
  }
586
586
  return getSystemInfo;
587
587
  const params = Object.assign(
588
588
  {},
589
589
  {
590
590
  title: "",
591
591
  duration: 1500,
592
592
  },
593
593
  options
594
594
  );
595
595
  params.duration = params.duration / 1000;
596
596
  if (isJdApp) {
597
597
  const showSuccessType = isIosDevice
598
598
  ? ToastIosType.SUCCESS
599
599
  : ToastAndroidType.SUCCESS;
600
600
  const duration = isAndroidDevice ? 0 : params.duration;
601
601
  nativePageShowToast(options.title, showSuccessType, duration);
602
602
  console.log("执行原生toast success");
603
603
  } else {
604
604
  showSuccessToast(options);
605
605
  }
606
606
  const params = Object.assign(
607
607
  {},
608
608
  {
609
609
  title: "",
610
610
  duration: 1500,
611
611
  },
612
612
  options
613
613
  );
614
614
  params.duration = params.duration / 1000;
615
615
  if (isJdApp) {
616
616
  const showSuccessType = isIosDevice
617
617
  ? ToastIosType.FAIL
618
618
  : ToastAndroidType.FAIL;
619
619
  const duration = isAndroidDevice ? 0 : params.duration;
620
620
  nativePageShowToast(options.title, showSuccessType, duration);
621
621
  console.log("执行原生toast fail");
622
622
  } else {
623
623
  console.log("执行H5 toast fail");
624
624
  showFailToast(options);
625
625
  }
626
626
  const params = Object.assign(
627
627
  {},
628
628
  {
629
629
  title: "",
630
630
  duration: 1500,
631
631
  },
632
632
  options
633
633
  );
634
634
  params.duration = params.duration / 1000;
635
635
  if (isJdApp) {
636
636
  const showSuccessType = isIosDevice
637
637
  ? ToastIosType.NORMAL
638
638
  : ToastAndroidType.NORMAL;
639
639
  const duration = isAndroidDevice ? 0 : params.duration;
640
640
  nativePageShowToast(options.title, showSuccessType, duration);
641
641
  } else {
642
642
  showNormalToast(options);
643
643
  }
644
644
  const createLoadingEle = document.createElement("div");
645
645
  createLoadingEle.id = "J_shopLoading";
646
646
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
647
647
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
648
648
  <span class='d-shop-loading-icon'></span>
649
649
  <p class='d-shop-text'>${text}</p>
650
650
  </div>`;
651
651
  const getEle = document.body
652
652
  ? document.body
653
653
  : document.getElementsByTagName("body")[0];
654
654
  getEle.appendChild(createLoadingEle);
655
655
  const getEle = document.getElementById("J_shopLoading");
656
656
  getEle && getEle.remove();
657
657
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes =
658
658
  getReviseSystemInfo(params);
659
659
  if (!systemInfo.system && window) {
660
660
  systemInfo.system = window.navigator.userAgent;
661
661
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
662
662
  }
663
663
  const isIOS = !!systemInfo?.system.match(/ios/i);
664
664
  const isAndroid = !!systemInfo?.system.match(/android/i);
665
665
  systemInfo.navBarHeight = 0;
666
666
  systemInfo.statusBarHeight = 0;
667
667
  systemInfo.capsulePosition = null;
668
668
  systemInfo.isIOS = isIOS;
669
669
  systemInfo.isAndroid = isAndroid;
670
670
  _ShopSystemInfo = systemInfo;
671
671
  return systemInfo;
672
672
  return originDealShopContentData(pageData, sgmCustomReport, isvdev);
673
673
  const numScale = Number(scale);
674
674
  if (isNaN(numScale)) {
675
675
  console.warn(
676
676
  `The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`
677
677
  );
678
678
  return false;
679
679
  }
680
680
  const { venderId } = global.info.queryInfo || {};
681
681
  const id = venderId;
682
682
  if (!id && numScale !== 1) {
683
683
  return false;
684
684
  }
685
685
  const useScale = Math.max(0, Math.min(1, numScale));
686
686
  const isMatch =
687
687
  numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
688
688
  if (reportKey) {
689
689
  sgmCustomReport({
690
690
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
691
691
  msg: "灰度调用",
692
692
  });
693
693
  console.log(
694
694
  `基于KEY[${reportKey}]的灰度调用1次~`,
695
695
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`)
696
696
  );
697
697
  if (isMatch) {
698
698
  sgmCustomReport({
699
699
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
700
700
  msg: "灰度命中",
701
701
  });
702
702
  console.log(
703
703
  `基于KEY[${reportKey}]的命中1次灰度!`,
704
704
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`)
705
705
  );
706
706
  }
707
707
  }
708
708
  return isMatch;
709
709
  isJdApp,
710
710
  isWxApp,
711
711
  isIosDevice,
712
712
  isAndroidDevice,
713
713
  isJdAndIosDevice,
714
714
  isJdAndAndroidDevice,
715
715
  isJdAndHarmonyDevice,
716
716
  isJdAndroidX5Core,
717
717
  isMin,
718
718
  isWxMin,
719
719
  isWxMinAndWxapp,
720
720
  isJdMinAndHarmony,
721
721
  isJdMin,
722
722
  isH5,
723
723
  isH5AndJdShopView,
724
724
  isChartH5,
725
725
  isH5AndJdShopViewNativeScroll,
726
726
  isH5AndJdShopViewH5Scroll,
727
727
  isH5AndJdShopH5CustomScrollView,
728
728
  isH5AndJingGouMini,
729
729
  isWxMiniH5View,
730
730
  urlCookie,
731
731
  sliceArrToChunkList,
732
732
  dealAddress,
733
733
  objectToUrlEncode,
734
734
  parseQueryUrlString,
735
735
  setLowSmallPicUrl,
736
736
  setTaroStorage,
737
737
  getTaroStorageKeyValue,
738
738
  removeTaroStorageKey,
739
739
  clearTaroStorageKey,
740
740
  getAvifSupport,
741
741
  getWebpSupport,
742
742
  getQualityImage,
743
743
  countStringify,
744
744
  getWxAppCookieStr,
745
745
  getSystemInfos,
746
746
  pxTransformFromData,
747
747
  dealShopContentDataAndReport as dealShopContentData,
748
748
  dateFormat,
749
749
  throttle,
750
750
  lodashThrottle,
751
751
  debounce,
752
752
  addHttps,
753
753
  commonShowSuccessToast as showSuccessToast,
754
754
  commonShowFailToast as showFailToast,
755
755
  commonShowNormalToast as showNormalToast,
756
756
  showShopLoading,
757
757
  hideShopLoading,
758
758
  stopNativeScrollEvent,
759
759
  getAppChannelType,
760
760
  formatTabActiveMenuType,
761
761
  filterUrlQueryData,
762
762
  sgmCustomReport,
763
763
  isMemberPage,
764
764
  getFloorDataToDataDefines,
765
765
  isOpenJdAppUrl,
766
766
  jdOpenAppParams,
767
767
  createJdOpenAppUrl,
768
768
  isEmpty,
769
769
  getJdAppReportPageSource,
770
770
  isAppClassifyPage,
771
771
  isAppHomeForMarketPage,
772
772
  isImageOptimizeEnable,
773
773
  isPc,
774
774
  ipLoc_djd,
775
775
  isTjScence,
776
776
  isH5AdnJxMini,
777
777
  isTjM,
778
778
  isTjJxM,
779
779
  isTJApp,
780
780
  isH5AdnHaoWuJie,
781
781
  tjChannel,
782
782
  dealJdOpenAppData,
783
783
  jdAppVersionCompare,
784
784
  dealNativePixelToCssPixel,
785
785
  isAppStowShop,
786
786
  getSgmCustomCode,
787
787
  handleSgmCodeTaroVersion,
788
788
  isInGrayscale,
789
789
  isIpadDevice,