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

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 (73) 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/pageType.ts +1 -1
  9. package/dist/common/sgmCustomCode.ts +1 -1
  10. package/dist/components/ErrorBoundary.tsx +1 -1
  11. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  12. package/dist/components/base/CustomVideo/common.ts +1 -0
  13. package/dist/components/base/CustomVideo/index.tsx +1 -1
  14. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  15. package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
  16. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  17. package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
  18. package/dist/components/base/LazyLoadImage/index.h5.module.scss +11 -3
  19. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  20. package/dist/components/base/LazyLoadImage/index.tsx +1 -1
  21. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  22. package/dist/components/base/NetworkDataError/index.module.scss +3 -0
  23. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  24. package/dist/components/base/Price/Base/index.tsx +1 -1
  25. package/dist/components/base/Price/Double/index.tsx +1 -1
  26. package/dist/components/decorate/DecorateFloorModule/index.module.scss +11 -0
  27. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  28. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  29. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  30. package/dist/components/floorItem.jd.tsx +1 -1
  31. package/dist/components/floorItem.tsx +1 -1
  32. package/dist/components/floorItem.weapp.tsx +1 -1
  33. package/dist/components/isv/Floor/index.tsx +1 -1
  34. package/dist/components/remoteFloorItem.tsx +1 -1
  35. package/dist/interface/common.ts +1 -1
  36. package/dist/interface/component.ts +1 -1
  37. package/dist/interface/jumpEventReport.ts +1 -1
  38. package/dist/interface/service.ts +1 -1
  39. package/dist/jumpEventReport/base.ts +1 -1
  40. package/dist/jumpEventReport/const.ts +1 -1
  41. package/dist/jumpEventReport/index.jd.ts +1 -1
  42. package/dist/jumpEventReport/index.weapp.ts +1 -1
  43. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  44. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  45. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  46. package/dist/jumpEventReport/web.base.ts +1 -1
  47. package/dist/jumpEventReport/web.jd.ts +1 -1
  48. package/dist/jumpEventReport/web.tjm.ts +1 -1
  49. package/dist/modules/ContainerFloorList/index.h5.module.scss +1 -0
  50. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  51. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  52. package/dist/open/api/device.ts +1 -1
  53. package/dist/open/api/request.ts +1 -1
  54. package/dist/open/api/shopMember.ts +1 -1
  55. package/dist/open/api/util.ts +1 -1
  56. package/dist/open/components/index.ts +1 -1
  57. package/dist/sass/app.h5.scss +5 -0
  58. package/dist/sass/base.scss +45 -0
  59. package/dist/service/http/colorSign.ts +1 -1
  60. package/dist/service/http/h5Http.ts +1 -0
  61. package/dist/service/http/index.h5.ts +1 -0
  62. package/dist/service/requestServer.h5.ts +1 -0
  63. package/dist/service/requestServer.ts +1 -1
  64. package/dist/utils/connectNativeJsBridge.ts +1 -1
  65. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  66. package/dist/utils/h5Utils.ts +1 -1
  67. package/dist/utils/index.h5.ts +1 -1
  68. package/dist/utils/index.ts +1 -1
  69. package/dist/utils/index.weapp.ts +1 -1
  70. package/dist/utils/sgmCodeUtils.ts +1 -1
  71. package/dist/utils/taroRenderUtil.ts +1 -1
  72. package/dist/utils/utils.ts +1 -1
  73. 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
  UtilsInterFace
365
365
  nativePageShowToast,
366
366
  ToastAndroidType,
367
367
  ToastIosType,
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
  isJdApp,
378
378
  isWxApp,
379
379
  isWxMiniH5View,
380
380
  isJdAndHarmonyDevice,
381
381
  isH5AndJingGouMini,
382
382
  urlCookie,
383
383
  sgmCustomReport,
384
384
  draCustomReport,
385
385
  remoteCustomReport,
386
386
  draInterfaceCustomReport,
387
387
  draBusinessCustomReport,
388
388
  isMemberPage,
389
389
  isH5AndJdShopViewH5Scroll,
390
390
  isH5AndJdShopH5CustomScrollView,
391
391
  isAppClassifyPage,
392
392
  isAppHomeForMarketPage,
393
393
  isPc,
394
394
  ipLoc_djd,
395
395
  jdAppVersionCompare,
396
396
  isTjScence,
397
397
  isH5AdnJxMini,
398
398
  isTjM,
399
399
  isTjJxM,
400
400
  isTJApp,
401
401
  isH5AdnHaoWuJie,
402
402
  tjChannel,
403
403
  dealNativePixelToCssPixel,
404
404
  isAppStowShop,
405
405
  isJdAndroidX5Core,
406
406
  parseQueryUrlObj,
407
407
  isIpadDevice,
408
408
  isSupportHybridHttpRequest,
409
409
  addHttps,
410
410
  clearTaroStorageKey,
411
411
  countStringify,
412
412
  dateFormat,
413
413
  dealAddress,
414
414
  dealShopContentData as originDealShopContentData,
415
415
  debounce,
416
416
  filterUrlQueryData,
417
417
  formatTabActiveMenuType,
418
418
  getAvifSupport,
419
419
  getWebpSupport,
420
420
  getTaroStorageKeyValue,
421
421
  getWxAppCookieStr,
422
422
  isH5,
423
423
  isMin,
424
424
  isJdMin,
425
425
  isWxMin,
426
426
  isWxMinAndWxapp,
427
427
  isJdMinAndHarmony,
428
428
  lodashThrottle,
429
429
  objectToUrlEncode,
430
430
  parseQueryUrlString,
431
431
  removeTaroStorageKey,
432
432
  setLowSmallPicUrl,
433
433
  setTaroStorage,
434
434
  showFailToast,
435
435
  showNormalToast,
436
436
  showSuccessToast,
437
437
  sliceArrToChunkList,
438
438
  throttle,
439
439
  getQualityImageNew,
440
440
  getQualityImageOld,
441
441
  isOpenJdAppUrl,
442
442
  jdOpenAppParams,
443
443
  createJdOpenAppUrl,
444
444
  isEmpty,
445
445
  getJdAppReportPageSource,
446
446
  dealJdOpenAppData,
447
447
  getBorderStyle,
448
448
  SgmCustomCode,
449
449
  } from '../common/sgmCustomCode'
450
450
  const getNum = Number(num)
451
451
  let _changeLayoutWidth = layoutWidth
452
452
  if (!_changeLayoutWidth) {
453
453
  _changeLayoutWidth =
454
454
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
455
455
  ? _ShopSystemInfo.windowWidth
456
456
  : Taro.getSystemInfoSync()?.windowWidth
457
457
  }
458
458
  return Math.round((getNum / widthSize) * _changeLayoutWidth)
459
459
  changeSize,
460
460
  designWidth = 750,
461
461
  systemInfo,
462
462
  const getRootFontSize =
463
463
  (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
464
464
  const getRealRootFontSize =
465
465
  getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
466
466
  return Math.ceil(
467
467
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
468
468
  getRealRootFontSize,
469
469
  )
470
470
  console.log(
471
471
  '获取系统宽度systemInfo?.windowWidth',
472
472
  systemInfo?.windowWidth,
473
473
  'taroToTransformRoutimePXNumber(changeWidth)',
474
474
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
475
475
  )
476
476
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
477
477
  ? systemInfo?.windowWidth -
478
478
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
479
479
  : systemInfo?.windowWidth ?? 0
480
480
  const systemInfo = Taro.getSystemInfoSync()
481
481
  if (params && params?.pageWidth && params?.pageHeight) {
482
482
  systemInfo.windowWidth = params?.pageWidth
483
483
  systemInfo.windowHeight = params?.pageHeight
484
484
  console.warn("松果安卓app内获折叠屏信息重置系统信息宽度值",params,",systemInfo信息集合为",systemInfo)
485
485
  }else {
486
486
  if (isJdApp && isAndroidDevice && systemInfo) {
487
487
  const getWinWidth = window.innerWidth;
488
488
  const getWinHeight = window.innerHeight;
489
489
  const getScreenWidth = window.screen.width;
490
490
  const getScreenHeight = window.screen.height;
491
491
  const isLandscape = getScreenWidth >= getScreenHeight;
492
492
  const { windowWidth,windowHeight, screenWidth, screenHeight } = systemInfo
493
493
  if (windowWidth <= 0) {
494
494
  systemInfo.initWindowWidth = windowWidth;
495
495
  if(isLandscape){
496
496
  systemInfo.windowWidth = getScreenHeight
497
497
  systemInfo.windowHeight = getScreenWidth
498
498
  systemInfo.screenWidth = getScreenHeight
499
499
  systemInfo.screenHeight = getScreenWidth
500
500
  }else {
501
501
  systemInfo.windowWidth = getScreenWidth
502
502
  systemInfo.windowHeight = getScreenHeight
503
503
  systemInfo.screenWidth = getScreenWidth
504
504
  systemInfo.screenHeight = getScreenHeight
505
505
  }
506
506
  console.warn(`松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight}`)
507
507
  sgmCustomReport({
508
508
  type: 2,
509
509
  code: 'android_jdapp_width_error_info',
510
510
  msg: {
511
511
  title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
512
512
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
513
513
  taroSysInfo: systemInfo
514
514
  }
515
515
  })
516
516
  }else {
517
517
  let _getChangeWinWidthState = false
518
518
  if( getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth){
519
519
  if(isLandscape){
520
520
  systemInfo.windowWidth = getScreenHeight
521
521
  systemInfo.windowHeight = getScreenWidth
522
522
  systemInfo.screenWidth = getScreenHeight
523
523
  systemInfo.screenHeight = getScreenWidth
524
524
  }else {
525
525
  systemInfo.windowWidth = getScreenWidth
526
526
  systemInfo.windowHeight = getScreenHeight
527
527
  systemInfo.screenWidth = getScreenWidth
528
528
  systemInfo.screenHeight = getScreenHeight
529
529
  }
530
530
  _getChangeWinWidthState = true
531
531
  }
532
532
  _getChangeWinWidthState && console.warn(`松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`)
533
533
  _getChangeWinWidthState && sgmCustomReport({
534
534
  type: 2,
535
535
  code: 'android_jdapp_width_error_info',
536
536
  msg: {
537
537
  title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
538
538
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
539
539
  taroSysInfo: systemInfo
540
540
  }
541
541
  })
542
542
  }
543
543
  }
544
544
  }
545
545
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
546
546
  console.warn('====获取系统信息=====', systemInfo)
547
547
  return systemInfo
548
548
  let result: boolean | null = null
549
549
  return function() {
550
550
  if (result === null) {
551
551
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
552
552
  if(!isJdApp){
553
553
  console.warn("🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~")
554
554
  isIgnoreOptimizeFromServer = true
555
555
  result = true
556
556
  return true
557
557
  }
558
558
  const enableAvifOptimize = appVersionCheckPass
559
559
  if(enableAvifOptimize){
560
560
  const configData = global.getDynamicConfig('avifSwitch')
561
561
  console.warn("🚗 ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:", buildType)
562
562
  console.warn("🚗 ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:", configData)
563
563
  const { globalOn = true, ignoreOptimizeFromServer = false, page = {}, grayscale = {}, whiteList = [], blackList = [] } = configData || {}
564
564
  const {shopId = '0', venderId = '0'} = parseQueryUrlObj
565
565
  let imageEnableResult = true
566
566
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
567
567
  console.warn("🚗 ~~ file: index.h5.ts:213 ~~ returnfunction ~~ grayscale[buildType]:", grayscale[buildType])
568
568
  if (blackList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
569
569
  imageEnableResult = false
570
570
  console.warn("🚗 ~~ file: utils.ts:198 命中黑名单~")
571
571
  }else if(whiteList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
572
572
  isIgnoreOptimizeFromServer = true
573
573
  imageEnableResult = true
574
574
  console.warn("🚗 ~~ file: utils.ts:205 命中白名单~")
575
575
  }else if(grayscale[buildType] && isInGrayscale(grayscale[buildType])){
576
576
  isIgnoreOptimizeFromServer = true
577
577
  imageEnableResult = true
578
578
  console.warn("🚗 ~~ file: utils.ts:214 命中灰度~")
579
579
  }else{
580
580
  imageEnableResult = globalOn === true || page[buildType] === true
581
581
  if(globalOn === true){
582
582
  isIgnoreOptimizeFromServer = true
583
583
  console.warn("🚗 ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~")
584
584
  }else if(page[buildType] === true){
585
585
  console.warn("🚗 ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~")
586
586
  }else{
587
587
  console.warn("🚗 ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!")
588
588
  }
589
589
  }
590
590
  result = imageEnableResult
591
591
  return imageEnableResult
592
592
  }else{
593
593
  result = false
594
594
  return false
595
595
  }
596
596
  } else {
597
597
  return result
598
598
  }
599
599
  }
600
600
  if(typeof options === 'object' && isImageOptimizeEnable()){
601
601
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
602
602
  }else{
603
603
  return getQualityImageOld(imgUrl, options)
604
604
  }
605
605
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
606
606
  windowWidth: window.innerWidth,
607
607
  containerWidth: getContainerWidth(buildType, {
608
608
  windowWidth: window.innerWidth,
609
609
  }),
610
610
  screenWidth: window.innerWidth,
611
611
  platform: '',
612
612
  model: '',
613
613
  system: '',
614
614
  }
615
615
  return getSystemInfo
616
616
  console.log('进入commonshowToast, 传入参数options为: ', options)
617
617
  const params = Object.assign(
618
618
  {},
619
619
  {
620
620
  title: '',
621
621
  duration: 1500,
622
622
  },
623
623
  options,
624
624
  )
625
625
  params.duration = params.duration / 1000
626
626
  if (isJdApp) {
627
627
  const showSuccessType = isIosDevice
628
628
  ? ToastIosType.SUCCESS
629
629
  : ToastAndroidType.SUCCESS
630
630
  const duration = isAndroidDevice ? 0 : params.duration
631
631
  nativePageShowToast(options.title, showSuccessType, duration)
632
632
  console.log('执行原生toast success')
633
633
  } else {
634
634
  showSuccessToast(options)
635
635
  }
636
636
  const params = Object.assign(
637
637
  {},
638
638
  {
639
639
  title: '',
640
640
  duration: 1500,
641
641
  },
642
642
  options,
643
643
  )
644
644
  params.duration = params.duration / 1000
645
645
  if (isJdApp) {
646
646
  const showSuccessType = isIosDevice
647
647
  ? ToastIosType.FAIL
648
648
  : ToastAndroidType.FAIL
649
649
  const duration = isAndroidDevice ? 0 : params.duration
650
650
  nativePageShowToast(options.title, showSuccessType, duration)
651
651
  console.log('执行原生toast fail')
652
652
  } else {
653
653
  console.log('执行H5 toast fail')
654
654
  showFailToast(options)
655
655
  }
656
656
  const params = Object.assign(
657
657
  {},
658
658
  {
659
659
  title: '',
660
660
  duration: 1500,
661
661
  },
662
662
  options,
663
663
  )
664
664
  params.duration = params.duration / 1000
665
665
  if (isJdApp) {
666
666
  const showSuccessType = isIosDevice ?
667
667
  ToastIosType.NORMAL :
668
668
  ToastAndroidType.NORMAL
669
669
  const duration = isAndroidDevice ? 0 : params.duration
670
670
  nativePageShowToast(options.title, showSuccessType, duration)
671
671
  } else {
672
672
  showNormalToast(options)
673
673
  }
674
674
  const createLoadingEle = document.createElement('div')
675
675
  createLoadingEle.id = 'J_shopLoading'
676
676
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
677
677
  createLoadingEle.innerHTML =
678
678
  `<div class='d-loading-content'>
679
679
  <span class='d-shop-loading-icon'></span>
680
680
  <p class='d-shop-text'>${text}</p>
681
681
  </div>`
682
682
  const getEle = document.body
683
683
  ? document.body
684
684
  : document.getElementsByTagName('body')[0]
685
685
  getEle.appendChild(createLoadingEle)
686
686
  const getEle = document.getElementById('J_shopLoading')
687
687
  getEle && getEle.remove()
688
688
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(
689
689
  params,
690
690
  )
691
691
  if (!systemInfo.system && window) {
692
692
  systemInfo.system = window.navigator.userAgent
693
693
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
694
694
  }
695
695
  const isIOS = !!systemInfo?.system.match(/ios/i)
696
696
  const isAndroid = !!systemInfo?.system.match(/android/i)
697
697
  systemInfo.navBarHeight = 0
698
698
  systemInfo.statusBarHeight = 0
699
699
  systemInfo.capsulePosition = null
700
700
  systemInfo.isIOS = isIOS
701
701
  systemInfo.isAndroid = isAndroid
702
702
  _ShopSystemInfo = systemInfo
703
703
  return systemInfo
704
704
  return originDealShopContentData(pageData, sgmCustomReport, isvdev)
705
705
  const numScale = Number(scale)
706
706
  if(isNaN(numScale)){
707
707
  console.warn(`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`)
708
708
  return false
709
709
  }
710
710
  const { venderId } = global.info.queryInfo || {}
711
711
  const id = venderId
712
712
  if(!id && numScale !== 1){
713
713
  return false
714
714
  }
715
715
  const useScale = Math.max(0, Math.min(1, numScale))
716
716
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0
717
717
  if(reportKey){
718
718
  sgmCustomReport({
719
719
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
720
720
  msg: '灰度调用',
721
721
  })
722
722
  console.log(`基于KEY[${reportKey}]的灰度调用1次~`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`))
723
723
  if(isMatch){
724
724
  sgmCustomReport({
725
725
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
726
726
  msg: '灰度命中',
727
727
  })
728
728
  console.log(`基于KEY[${reportKey}]的命中1次灰度!`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`))
729
729
  }
730
730
  }
731
731
  return isMatch
732
732
  isJdApp,
733
733
  isWxApp,
734
734
  isIosDevice,
735
735
  isAndroidDevice,
736
736
  isJdAndIosDevice,
737
737
  isJdAndAndroidDevice,
738
738
  isJdAndHarmonyDevice,
739
739
  isJdAndroidX5Core,
740
740
  isMin,
741
741
  isWxMin,
742
742
  isWxMinAndWxapp,
743
743
  isJdMinAndHarmony,
744
744
  isJdMin,
745
745
  isH5,
746
746
  isH5AndJdShopView,
747
747
  isChartH5,
748
748
  isH5AndJdShopViewNativeScroll,
749
749
  isH5AndJdShopViewH5Scroll,
750
750
  isH5AndJdShopH5CustomScrollView,
751
751
  isH5AndJingGouMini,
752
752
  isWxMiniH5View,
753
753
  urlCookie,
754
754
  sliceArrToChunkList,
755
755
  dealAddress,
756
756
  objectToUrlEncode,
757
757
  parseQueryUrlString,
758
758
  setLowSmallPicUrl,
759
759
  setTaroStorage,
760
760
  getTaroStorageKeyValue,
761
761
  removeTaroStorageKey,
762
762
  clearTaroStorageKey,
763
763
  getAvifSupport,
764
764
  getWebpSupport,
765
765
  getQualityImage,
766
766
  countStringify,
767
767
  getWxAppCookieStr,
768
768
  getSystemInfos,
769
769
  pxTransformFromData,
770
770
  dealShopContentDataAndReport as dealShopContentData,
771
771
  dateFormat,
772
772
  throttle,
773
773
  lodashThrottle,
774
774
  debounce,
775
775
  addHttps,
776
776
  commonShowSuccessToast as showSuccessToast,
777
777
  commonShowFailToast as showFailToast,
778
778
  commonShowNormalToast as showNormalToast,
779
779
  showShopLoading,
780
780
  hideShopLoading,
781
781
  stopNativeScrollEvent,
782
782
  getAppChannelType,
783
783
  formatTabActiveMenuType,
784
784
  filterUrlQueryData,
785
785
  sgmCustomReport,
786
786
  draCustomReport,
787
787
  remoteCustomReport,
788
788
  draInterfaceCustomReport,
789
789
  draBusinessCustomReport,
790
790
  isMemberPage,
791
791
  getFloorDataToDataDefines,
792
792
  isOpenJdAppUrl,
793
793
  jdOpenAppParams,
794
794
  createJdOpenAppUrl,
795
795
  isEmpty,
796
796
  getJdAppReportPageSource,
797
797
  isAppClassifyPage,
798
798
  isAppHomeForMarketPage,
799
799
  isImageOptimizeEnable,
800
800
  isPc,
801
801
  ipLoc_djd,
802
802
  isTjScence,
803
803
  isH5AdnJxMini,
804
804
  isTjM,
805
805
  isTjJxM,
806
806
  isTJApp,
807
807
  isH5AdnHaoWuJie,
808
808
  tjChannel,
809
809
  dealJdOpenAppData,
810
810
  jdAppVersionCompare,
811
811
  dealNativePixelToCssPixel,
812
812
  isAppStowShop,
813
813
  getSgmCustomCode,
814
814
  handleSgmCodeTaroVersion,
815
815
  isInGrayscale,
816
816
  isIpadDevice,
817
817
  getBorderStyle,
818
818
  isSupportHybridHttpRequest,