@conecli/cone-render 0.10.1-beta.4 → 0.10.1-beta.6

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