@conecli/cone-render 0.10.1-shop3.2 → 0.10.1-shop3.21

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 (75) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/common/index.h5.ts +1 -1
  4. package/dist/common/index.jd.ts +1 -1
  5. package/dist/common/index.ts +1 -1
  6. package/dist/common/index.weapp.ts +1 -1
  7. package/dist/common/jssdk.ts +1 -1
  8. package/dist/common/token/index.h5.ts +1 -1
  9. package/dist/common/token/token.jd.ts +1 -1
  10. package/dist/common/wxappApi.ts +1 -1
  11. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  12. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  13. package/dist/components/base/CountDown/index.tsx +1 -1
  14. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  15. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  16. package/dist/components/base/Dialog/index.module.scss +11 -0
  17. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  18. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  19. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  20. package/dist/components/base/InViewRender/index.tsx +1 -1
  21. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  22. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  23. package/dist/components/base/NetworkDataError/const.ts +1 -1
  24. package/dist/components/base/NetworkDataError/index.module.scss +116 -70
  25. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  26. package/dist/components/base/Price/Base/index.module.scss +6 -0
  27. package/dist/components/base/Price/Base/index.tsx +1 -1
  28. package/dist/components/base/Price/Double/index.module.scss +6 -0
  29. package/dist/components/base/Price/Double/index.tsx +1 -1
  30. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  31. package/dist/components/floorItem.weapp.tsx +1 -1
  32. package/dist/interface/common.ts +1 -1
  33. package/dist/interface/component.ts +1 -1
  34. package/dist/interface/jumpEventReport.ts +1 -1
  35. package/dist/interface/service.ts +1 -1
  36. package/dist/jumpEventReport/base.ts +1 -1
  37. package/dist/jumpEventReport/const.ts +1 -1
  38. package/dist/jumpEventReport/index.h5.ts +1 -1
  39. package/dist/jumpEventReport/index.weapp.ts +1 -1
  40. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  41. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  42. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  43. package/dist/jumpEventReport/web/report.ts +1 -1
  44. package/dist/jumpEventReport/web.base.ts +1 -1
  45. package/dist/jumpEventReport/web.jd.ts +1 -1
  46. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  47. package/dist/libs/taroAppReport.js +2 -2
  48. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -53
  49. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  50. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  51. package/dist/open/api/environment.ts +1 -1
  52. package/dist/open/api/shopMember.ts +1 -1
  53. package/dist/open/api/util.ts +1 -1
  54. package/dist/sass/app.h5.scss +273 -224
  55. package/dist/service/fetchGateway.ts +1 -1
  56. package/dist/service/fetchGateway.weapp.ts +1 -0
  57. package/dist/service/http/colorSign.ts +1 -1
  58. package/dist/service/http/const.ts +1 -1
  59. package/dist/service/http/h5Http.ts +1 -1
  60. package/dist/service/requestServer.h5.ts +1 -1
  61. package/dist/service/requestServer.ts +1 -1
  62. package/dist/service/requestServer.weapp.ts +1 -0
  63. package/dist/utils/connectNativeJsBridge.ts +1 -1
  64. package/dist/utils/h5Utils.ts +1 -1
  65. package/dist/utils/index.h5.ts +1 -1
  66. package/dist/utils/index.ts +1 -1
  67. package/dist/utils/index.weapp.ts +1 -1
  68. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  69. package/dist/utils/jumpExtMapUtil.ts +1 -0
  70. package/dist/utils/log.ts +1 -0
  71. package/dist/utils/sColor.js +1 -0
  72. package/dist/utils/utils.ts +1 -1
  73. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  74. package/dist/wxapp/common/user_info.js +1 -1
  75. package/package.json +158 -141
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  UtilsInterFace
3
2
  nativePageShowToast,
4
3
  ToastAndroidType,
5
4
  ToastIosType,
6
5
  stopNativeScrollEvent,
7
6
  getAppChannelType,
8
7
  isAndroidDevice,
9
8
  isH5AndJdShopView,
10
9
  isChartH5,
11
10
  isH5AndJdShopViewNativeScroll,
12
11
  isIosDevice,
13
12
  isJdAndAndroidDevice,
14
13
  isJdAndIosDevice,
15
14
  isJdApp,
16
15
  isWxApp,
17
16
  isWxMiniH5View,
18
17
  isJdAndHarmonyDevice,
19
18
  isH5AndJingGouMini,
20
19
  urlCookie,
21
20
  sgmCustomReport,
22
21
  draCustomReport,
23
22
  remoteCustomReport,
24
23
  draInterfaceCustomReport,
25
24
  draBusinessCustomReport,
26
25
  isMemberPage,
27
26
  isH5AndJdShopViewH5Scroll,
28
27
  isH5AndJdShopH5CustomScrollView,
29
28
  isAppClassifyPage,
30
29
  isAppHomeForMarketPage,
31
30
  isPc,
32
31
  ipLoc_djd,
33
32
  jdAppVersionCompare,
34
33
  isTjScence,
35
34
  isH5AdnJxMini,
36
35
  isTjM,
37
36
  isTjJxM,
38
37
  isTJApp,
39
38
  isH5AdnHaoWuJie,
40
39
  tjChannel,
41
40
  dealNativePixelToCssPixel,
42
41
  isAppStowShop,
43
42
  isJdAndroidX5Core,
44
43
  parseQueryUrlObj,
45
44
  isIpadDevice,
46
45
  isSupportHybridHttpRequest,
47
46
  isLanguageForEn,
48
47
  addHttps,
49
48
  clearTaroStorageKey,
50
49
  countStringify,
51
50
  dateFormat,
52
51
  dealAddress,
53
52
  dealShopContentData as originDealShopContentData,
54
53
  debounce,
55
54
  filterUrlQueryData,
56
55
  formatTabActiveMenuType,
57
56
  getAvifSupport,
58
57
  getWebpSupport,
59
58
  getTaroStorageKeyValue,
60
59
  getWxAppCookieStr,
61
60
  isH5,
62
61
  isMin,
63
62
  isJdMin,
64
63
  isWxMin,
65
64
  isWxMinAndWxapp,
66
65
  isJdMinAndHarmony,
67
66
  lodashThrottle,
68
67
  objectToUrlEncode,
69
68
  parseQueryUrlString,
70
69
  removeTaroStorageKey,
71
70
  setLowSmallPicUrl,
72
71
  setTaroStorage,
73
72
  showFailToast,
74
73
  showNormalToast,
75
74
  showSuccessToast,
76
75
  sliceArrToChunkList,
77
76
  throttle,
78
77
  getQualityImageNew,
79
78
  getQualityImageOld,
80
79
  isOpenJdAppUrl,
81
80
  jdOpenAppParams,
82
81
  createJdOpenAppUrl,
83
82
  isEmpty,
84
83
  getJdAppReportPageSource,
85
84
  dealJdOpenAppData,
86
85
  getBorderStyle,
87
86
  SgmCustomCode,
88
87
  } from '../common/sgmCustomCode'
89
88
  const getNum = Number(num)
90
89
  let _changeLayoutWidth = layoutWidth
91
90
  if (!_changeLayoutWidth) {
92
91
  _changeLayoutWidth =
93
92
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
94
93
  ? _ShopSystemInfo.windowWidth
95
94
  : Taro.getSystemInfoSync()?.windowWidth
96
95
  }
97
96
  return Math.round((getNum / widthSize) * _changeLayoutWidth)
98
97
  changeSize,
99
98
  designWidth = 750,
100
99
  systemInfo,
101
100
  const getRootFontSize =
102
101
  (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
103
102
  const getRealRootFontSize =
104
103
  getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
105
104
  return Math.ceil(
106
105
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
107
106
  getRealRootFontSize,
108
107
  )
109
108
  console.log(
110
109
  '获取系统宽度systemInfo?.windowWidth',
111
110
  systemInfo?.windowWidth,
112
111
  'taroToTransformRoutimePXNumber(changeWidth)',
113
112
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
114
113
  )
115
114
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
116
115
  ? systemInfo?.windowWidth -
117
116
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
118
117
  : systemInfo?.windowWidth ?? 0
119
118
  const systemInfo = Taro.getSystemInfoSync()
120
119
  if (params && params?.pageWidth && params?.pageHeight) {
121
120
  systemInfo.windowWidth = params?.pageWidth
122
121
  systemInfo.windowHeight = params?.pageHeight
123
122
  console.warn("松果安卓app内获折叠屏信息重置系统信息宽度值",params,",systemInfo信息集合为",systemInfo)
124
123
  }else {
125
124
  if (isJdApp && isAndroidDevice && systemInfo) {
126
125
  const getWinWidth = window.innerWidth;
127
126
  const getWinHeight = window.innerHeight;
128
127
  const getScreenWidth = window.screen.width;
129
128
  const getScreenHeight = window.screen.height;
130
129
  const isLandscape = getScreenWidth >= getScreenHeight;
131
130
  const { windowWidth,windowHeight, screenWidth, screenHeight } = systemInfo
132
131
  if (windowWidth <= 0) {
133
132
  systemInfo.initWindowWidth = windowWidth;
134
133
  if(isLandscape){
135
134
  systemInfo.windowWidth = getScreenHeight
136
135
  systemInfo.windowHeight = getScreenWidth
137
136
  systemInfo.screenWidth = getScreenHeight
138
137
  systemInfo.screenHeight = getScreenWidth
139
138
  }else {
140
139
  systemInfo.windowWidth = getScreenWidth
141
140
  systemInfo.windowHeight = getScreenHeight
142
141
  systemInfo.screenWidth = getScreenWidth
143
142
  systemInfo.screenHeight = getScreenHeight
144
143
  }
145
144
  console.warn(`松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight}`)
146
145
  sgmCustomReport({
147
146
  type: 2,
148
147
  code: 'android_jdapp_width_error_info',
149
148
  msg: {
150
149
  title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
151
150
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
152
151
  taroSysInfo: systemInfo
153
152
  }
154
153
  })
155
154
  }else {
156
155
  let _getChangeWinWidthState = false
157
156
  if( getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth){
158
157
  if(isLandscape){
159
158
  systemInfo.windowWidth = getScreenHeight
160
159
  systemInfo.windowHeight = getScreenWidth
161
160
  systemInfo.screenWidth = getScreenHeight
162
161
  systemInfo.screenHeight = getScreenWidth
163
162
  }else {
164
163
  systemInfo.windowWidth = getScreenWidth
165
164
  systemInfo.windowHeight = getScreenHeight
166
165
  systemInfo.screenWidth = getScreenWidth
167
166
  systemInfo.screenHeight = getScreenHeight
168
167
  }
169
168
  _getChangeWinWidthState = true
170
169
  }
171
170
  _getChangeWinWidthState && console.warn(`松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`)
172
171
  _getChangeWinWidthState && sgmCustomReport({
173
172
  type: 2,
174
173
  code: 'android_jdapp_width_error_info',
175
174
  msg: {
176
175
  title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
177
176
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
178
177
  taroSysInfo: systemInfo
179
178
  }
180
179
  })
181
180
  }
182
181
  }
183
182
  }
184
183
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
185
184
  console.warn('====获取系统信息=====', systemInfo)
186
185
  return systemInfo
187
186
  let result: boolean | null = null
188
187
  return function() {
189
188
  if (result === null) {
190
189
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
191
190
  if(!isJdApp){
192
191
  console.warn("🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~")
193
192
  isIgnoreOptimizeFromServer = true
194
193
  result = true
195
194
  return true
196
195
  }
197
196
  const enableAvifOptimize = appVersionCheckPass
198
197
  if(enableAvifOptimize){
199
198
  const configData = global.getDynamicConfig('avifSwitch')
200
199
  console.warn("🚗 ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:", buildType)
201
200
  console.warn("🚗 ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:", configData)
202
201
  const { globalOn = true, ignoreOptimizeFromServer = false, page = {}, grayscale = {}, whiteList = [], blackList = [] } = configData || {}
203
202
  const {shopId = '0', venderId = '0'} = parseQueryUrlObj
204
203
  let imageEnableResult = true
205
204
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
206
205
  console.warn("🚗 ~~ file: index.h5.ts:213 ~~ returnfunction ~~ grayscale[buildType]:", grayscale[buildType])
207
206
  if (blackList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
208
207
  imageEnableResult = false
209
208
  console.warn("🚗 ~~ file: utils.ts:198 命中黑名单~")
210
209
  }else if(whiteList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
211
210
  isIgnoreOptimizeFromServer = true
212
211
  imageEnableResult = true
213
212
  console.warn("🚗 ~~ file: utils.ts:205 命中白名单~")
214
213
  }else if(grayscale[buildType] && isInGrayscale(grayscale[buildType])){
215
214
  isIgnoreOptimizeFromServer = true
216
215
  imageEnableResult = true
217
216
  console.warn("🚗 ~~ file: utils.ts:214 命中灰度~")
218
217
  }else{
219
218
  imageEnableResult = globalOn === true || page[buildType] === true
220
219
  if(globalOn === true){
221
220
  isIgnoreOptimizeFromServer = true
222
221
  console.warn("🚗 ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~")
223
222
  }else if(page[buildType] === true){
224
223
  console.warn("🚗 ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~")
225
224
  }else{
226
225
  console.warn("🚗 ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!")
227
226
  }
228
227
  }
229
228
  result = imageEnableResult
230
229
  return imageEnableResult
231
230
  }else{
232
231
  result = false
233
232
  return false
234
233
  }
235
234
  } else {
236
235
  return result
237
236
  }
238
237
  }
239
238
  if(typeof options === 'object' && isImageOptimizeEnable()){
240
239
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
241
240
  }else{
242
241
  return getQualityImageOld(imgUrl, options)
243
242
  }
244
243
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
245
244
  windowWidth: window.innerWidth,
246
245
  containerWidth: getContainerWidth(buildType, {
247
246
  windowWidth: window.innerWidth,
248
247
  }),
249
248
  screenWidth: window.innerWidth,
250
249
  platform: '',
251
250
  model: '',
252
251
  system: '',
253
252
  }
254
253
  return getSystemInfo
255
254
  console.log('进入commonshowToast, 传入参数options为: ', options)
256
255
  const params = Object.assign(
257
256
  {},
258
257
  {
259
258
  title: '',
260
259
  duration: 1500,
261
260
  },
262
261
  options,
263
262
  )
264
263
  params.duration = params.duration / 1000
265
264
  if (isJdApp) {
266
265
  const showSuccessType = isIosDevice
267
266
  ? ToastIosType.SUCCESS
268
267
  : ToastAndroidType.SUCCESS
269
268
  const duration = isAndroidDevice ? 0 : params.duration
270
269
  nativePageShowToast(options.title, showSuccessType, duration)
271
270
  console.log('执行原生toast success')
272
271
  } else {
273
272
  showSuccessToast(options)
274
273
  }
275
274
  const params = Object.assign(
276
275
  {},
277
276
  {
278
277
  title: '',
279
278
  duration: 1500,
280
279
  },
281
280
  options,
282
281
  )
283
282
  params.duration = params.duration / 1000
284
283
  if (isJdApp) {
285
284
  const showSuccessType = isIosDevice
286
285
  ? ToastIosType.FAIL
287
286
  : ToastAndroidType.FAIL
288
287
  const duration = isAndroidDevice ? 0 : params.duration
289
288
  nativePageShowToast(options.title, showSuccessType, duration)
290
289
  console.log('执行原生toast fail')
291
290
  } else {
292
291
  console.log('执行H5 toast fail')
293
292
  showFailToast(options)
294
293
  }
295
294
  const params = Object.assign(
296
295
  {},
297
296
  {
298
297
  title: '',
299
298
  duration: 1500,
300
299
  },
301
300
  options,
302
301
  )
303
302
  params.duration = params.duration / 1000
304
303
  if (isJdApp) {
305
304
  const showSuccessType = isIosDevice ?
306
305
  ToastIosType.NORMAL :
307
306
  ToastAndroidType.NORMAL
308
307
  const duration = isAndroidDevice ? 0 : params.duration
309
308
  nativePageShowToast(options.title, showSuccessType, duration)
310
309
  } else {
311
310
  showNormalToast(options)
312
311
  }
313
312
  const createLoadingEle = document.createElement('div')
314
313
  createLoadingEle.id = 'J_shopLoading'
315
314
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
316
315
  createLoadingEle.innerHTML =
317
316
  `<div class='d-loading-content'>
318
317
  <span class='d-shop-loading-icon'></span>
319
318
  <p class='d-shop-text'>${text}</p>
320
319
  </div>`
321
320
  const getEle = document.body
322
321
  ? document.body
323
322
  : document.getElementsByTagName('body')[0]
324
323
  getEle.appendChild(createLoadingEle)
325
324
  const getEle = document.getElementById('J_shopLoading')
326
325
  getEle && getEle.remove()
327
326
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(
328
327
  params,
329
328
  )
330
329
  if (!systemInfo.system && window) {
331
330
  systemInfo.system = window.navigator.userAgent
332
331
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
333
332
  }
334
333
  const isIOS = !!systemInfo?.system.match(/ios/i)
335
334
  const isAndroid = !!systemInfo?.system.match(/android/i)
336
335
  systemInfo.navBarHeight = 0
337
336
  systemInfo.statusBarHeight = 0
338
337
  systemInfo.capsulePosition = null
339
338
  systemInfo.isIOS = isIOS
340
339
  systemInfo.isAndroid = isAndroid
341
340
  _ShopSystemInfo = systemInfo
342
341
  return systemInfo
343
342
  return originDealShopContentData(pageData, sgmCustomReport, isvdev)
344
343
  const numScale = Number(scale)
345
344
  if(isNaN(numScale)){
346
345
  console.warn(`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`)
347
346
  return false
348
347
  }
349
348
  const { venderId } = global.info.queryInfo || {}
350
349
  const id = venderId
351
350
  if(!id && numScale !== 1){
352
351
  return false
353
352
  }
354
353
  const useScale = Math.max(0, Math.min(1, numScale))
355
354
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0
356
355
  if(reportKey){
357
356
  sgmCustomReport({
358
357
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
359
358
  msg: '灰度调用',
360
359
  })
361
360
  console.log(`基于KEY[${reportKey}]的灰度调用1次~`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`))
362
361
  if(isMatch){
363
362
  sgmCustomReport({
364
363
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
365
364
  msg: '灰度命中',
366
365
  })
367
366
  console.log(`基于KEY[${reportKey}]的命中1次灰度!`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`))
368
367
  }
369
368
  }
370
369
  return isMatch
371
370
  isJdApp,
372
371
  isWxApp,
373
372
  isIosDevice,
374
373
  isAndroidDevice,
375
374
  isJdAndIosDevice,
376
375
  isJdAndAndroidDevice,
377
376
  isJdAndHarmonyDevice,
378
377
  isJdAndroidX5Core,
379
378
  isMin,
380
379
  isWxMin,
381
380
  isWxMinAndWxapp,
382
381
  isJdMinAndHarmony,
383
382
  isJdMin,
384
383
  isH5,
385
384
  isH5AndJdShopView,
386
385
  isChartH5,
387
386
  isH5AndJdShopViewNativeScroll,
388
387
  isH5AndJdShopViewH5Scroll,
389
388
  isH5AndJdShopH5CustomScrollView,
390
389
  isH5AndJingGouMini,
391
390
  isWxMiniH5View,
392
391
  urlCookie,
393
392
  sliceArrToChunkList,
394
393
  dealAddress,
395
394
  objectToUrlEncode,
396
395
  parseQueryUrlString,
397
396
  setLowSmallPicUrl,
398
397
  setTaroStorage,
399
398
  getTaroStorageKeyValue,
400
399
  removeTaroStorageKey,
401
400
  clearTaroStorageKey,
402
401
  getAvifSupport,
403
402
  getWebpSupport,
404
403
  getQualityImage,
405
404
  countStringify,
406
405
  getWxAppCookieStr,
407
406
  getSystemInfos,
408
407
  pxTransformFromData,
409
408
  dealShopContentDataAndReport as dealShopContentData,
410
409
  dateFormat,
411
410
  throttle,
412
411
  lodashThrottle,
413
412
  debounce,
414
413
  addHttps,
415
414
  commonShowSuccessToast as showSuccessToast,
416
415
  commonShowFailToast as showFailToast,
417
416
  commonShowNormalToast as showNormalToast,
418
417
  showShopLoading,
419
418
  hideShopLoading,
420
419
  stopNativeScrollEvent,
421
420
  getAppChannelType,
422
421
  formatTabActiveMenuType,
423
422
  filterUrlQueryData,
424
423
  sgmCustomReport,
425
424
  draCustomReport,
426
425
  remoteCustomReport,
427
426
  draInterfaceCustomReport,
428
427
  draBusinessCustomReport,
429
428
  isMemberPage,
430
429
  getFloorDataToDataDefines,
431
430
  isOpenJdAppUrl,
432
431
  jdOpenAppParams,
433
432
  createJdOpenAppUrl,
434
433
  isEmpty,
435
434
  getJdAppReportPageSource,
436
435
  isAppClassifyPage,
437
436
  isAppHomeForMarketPage,
438
437
  isImageOptimizeEnable,
439
438
  isPc,
440
439
  ipLoc_djd,
441
440
  isTjScence,
442
441
  isH5AdnJxMini,
443
442
  isTjM,
444
443
  isTjJxM,
445
444
  isTJApp,
446
445
  isH5AdnHaoWuJie,
447
446
  tjChannel,
448
447
  dealJdOpenAppData,
449
448
  jdAppVersionCompare,
450
449
  dealNativePixelToCssPixel,
451
450
  isAppStowShop,
452
451
  getSgmCustomCode,
453
452
  handleSgmCodeTaroVersion,
454
453
  isInGrayscale,
455
454
  isIpadDevice,
456
455
  getBorderStyle,
457
456
  isSupportHybridHttpRequest,
458
457
  isLanguageForEn
458
+ import Taro from '@tarojs/taro';
459
459
  stopNativeScrollEvent,
460
460
  getAppChannelType,
461
461
  isAndroidDevice,
462
462
  isHarmonyDevice,
463
463
  isH5AndJdShopView,
464
464
  isChartH5,
465
465
  isH5AndJdShopViewNativeScroll,
466
466
  isIosDevice,
467
467
  isJdAndAndroidDevice,
468
468
  isJdAndIosDevice,
469
469
  isJdApp,
470
470
  isWxApp,
471
471
  isWxMiniH5View,
472
472
  isJdAndHarmonyDevice,
473
473
  isH5AndJingGouMini,
474
474
  urlCookie,
475
475
  sgmCustomReport,
476
476
  draCustomReport,
477
477
  remoteCustomReport,
478
478
  draInterfaceCustomReport,
479
479
  draBusinessCustomReport,
480
480
  isMemberPage,
481
481
  isH5AndJdShopViewH5Scroll,
482
482
  isH5AndJdShopH5CustomScrollView,
483
483
  isAppClassifyPage,
484
484
  isAppHomeForMarketPage,
485
485
  isPc,
486
486
  ipLoc_djd,
487
487
  jdAppVersionCompare,
488
488
  isTjScence,
489
489
  isH5AdnJxMini,
490
490
  isTjM,
491
491
  isTjJxM,
492
492
  isTJApp,
493
493
  isH5AdnHaoWuJie,
494
494
  tjChannel,
495
495
  dealNativePixelToCssPixel,
496
496
  isAppStowShop,
497
497
  isJdAndroidX5Core,
498
498
  parseQueryUrlObj,
499
499
  isIpadDevice,
500
500
  isTabletDevice,
501
501
  checkPadScreenOrientationIsLandscape,
502
502
  isSupportHybridHttpRequest,
503
503
  isLanguageForEn,
504
504
  sColor,
505
505
  draInterfaceDSMCustomReport,
506
506
  isInJdShopView,
507
507
  addHttps,
508
508
  clearTaroStorageKey,
509
509
  countStringify as h5CountStringify,
510
510
  dateFormat,
511
511
  dealAddress,
512
512
  dealShopContentData as originDealShopContentData,
513
513
  debounce,
514
514
  filterUrlQueryData,
515
515
  formatTabActiveMenuType,
516
516
  getAvifSupport,
517
517
  getWebpSupport,
518
518
  getTaroStorageKeyValue,
519
519
  getWxAppCookieStr,
520
520
  isH5,
521
521
  isMin,
522
522
  isJdMin,
523
523
  isWxMin,
524
524
  isWxMinAndWxapp,
525
525
  isJdMinAndHarmony,
526
526
  lodashThrottle,
527
527
  objectToUrlEncode,
528
528
  parseQueryUrlString,
529
529
  removeTaroStorageKey,
530
530
  setLowSmallPicUrl,
531
531
  setTaroStorage,
532
532
  showFailToast,
533
533
  showNormalToast,
534
534
  showSuccessToast,
535
535
  sliceArrToChunkList,
536
536
  throttle,
537
537
  getQualityImageNew,
538
538
  getQualityImageOld,
539
539
  isOpenJdAppUrl,
540
540
  jdOpenAppParams,
541
541
  createJdOpenAppUrl,
542
542
  isEmpty,
543
543
  getJdAppReportPageSource,
544
544
  dealJdOpenAppData,
545
545
  getBorderStyle,
546
546
  const getNum = Number(num);
547
547
  let _changeLayoutWidth = layoutWidth;
548
548
  if (!_changeLayoutWidth) {
549
549
  _changeLayoutWidth =
550
550
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
551
551
  ? _ShopSystemInfo.windowWidth
552
552
  : Taro.getSystemInfoSync()?.windowWidth;
553
553
  }
554
554
  return _ShopSystemInfo?.isJdTabletDevice && !layoutWidth
555
555
  ? Math.floor(getNum * 1.2 * (_changeLayoutWidth / 720))
556
556
  : Math.round((getNum / widthSize) * _changeLayoutWidth);
557
557
  const getRootFontSize = (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
558
558
  let getRealRootFontSize = getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
559
559
  if (_ShopSystemInfo?.isJdTabletDevice) {
560
560
  getRealRootFontSize = Math.floor(
561
561
  24 * ((systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth) / 720),
562
562
  );
563
563
  }
564
564
  return Math.ceil(
565
565
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) * getRealRootFontSize,
566
566
  );
567
567
  console.log(
568
568
  '获取系统宽度systemInfo?.windowWidth',
569
569
  systemInfo?.windowWidth,
570
570
  'taroToTransformRoutimePXNumber(changeWidth)',
571
571
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
572
572
  );
573
573
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
574
574
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
575
575
  : (systemInfo?.windowWidth ?? 0);
576
576
  const systemInfo = _ShopSystemInfo || Taro.getSystemInfoSync();
577
577
  console.log(
578
578
  '获取系统宽度systemInfo?.windowWidth',
579
579
  systemInfo?.windowWidth,
580
580
  'taroToTransformRoutimePXNumber(changeWidth)',
581
581
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
582
582
  );
583
583
  const containerWidth =
584
584
  isClassify && systemInfo?.windowWidth
585
585
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
586
586
  : (systemInfo?.windowWidth ?? 0);
587
587
  if (global?.info?.sysInfo) {
588
588
  global.info.sysInfo['containerWidth'] = containerWidth;
589
589
  }
590
590
  return (
591
591
  isJdApp &&
592
592
  (parseQueryUrlObj['device'] === 'tablet' || Math.min(rootEleWidth, window.screen.height) >= 720)
593
593
  );
594
594
  const systemInfo = Taro.getSystemInfoSync();
595
595
  if (params && params?.pageWidth && params?.pageHeight) {
596
596
  systemInfo.windowWidth = params?.pageWidth;
597
597
  systemInfo.windowHeight = params?.pageHeight;
598
598
  console.warn('松果app内获取重置系统信息宽度值', params, ',systemInfo信息集合为', systemInfo);
599
599
  } else {
600
600
  if (isPc) {
601
601
  systemInfo.windowWidth = 375;
602
602
  } else {
603
603
  const getWinWidth = window.innerWidth;
604
604
  const getWinHeight = window.innerHeight;
605
605
  const getScreenWidth = window.screen.width;
606
606
  const getScreenHeight = window.screen.height;
607
607
  const getRootEleInitWidth = params?.rootEleInitWidth || 0;
608
608
  const isReplaceSystemWidth = params?.replaceSystemWidth || false;
609
609
  systemInfo.isJdTabletDevice = checkIsJdTabletDevice(getRootEleInitWidth);
610
610
  systemInfo.isJdTabletLandscape =
611
611
  systemInfo.isJdTabletDevice && checkPadScreenOrientationIsLandscape();
612
612
  if (!systemInfo.isJdTabletDevice && isReplaceSystemWidth) {
613
613
  if (systemInfo?.windowWidth <= 0) {
614
614
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
615
615
  systemInfo.windowHeight = getScreenHeight;
616
616
  console.warn(
617
617
  '====初始化获取当前设备不是pad,但是触发屏幕宽高最小值600,系统获取宽度为0,进行重置系统宽度为根元素宽度与屏幕宽度最小值====',
618
618
  systemInfo.windowWidth,
619
619
  'getRootEleInitWidth',
620
620
  getRootEleInitWidth,
621
621
  'getScreenWidth',
622
622
  getScreenWidth,
623
623
  'getScreenHeight',
624
624
  getScreenHeight,
625
625
  );
626
626
  draBusinessCustomReport({
627
627
  type: 'jdapp_pad_width_error_info',
628
628
  errMsg: `松果app内获取当前设备不是pad,触发屏幕宽高最小值600,系统信息宽度为0,进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
629
629
  originReqDataStr: JSON.stringify({
630
630
  isJdApp,
631
631
  isAndroidDevice,
632
632
  getScreenWidth,
633
633
  getScreenHeight,
634
634
  getWinWidth,
635
635
  getWinHeight,
636
636
  getRootEleInitWidth,
637
637
  }),
638
638
  });
639
639
  }
640
640
  } else {
641
641
  if (isJdApp && isAndroidDevice && !systemInfo.isJdTabletDevice && systemInfo) {
642
642
  const isLandscape = getScreenWidth >= getScreenHeight;
643
643
  const { windowWidth, windowHeight, screenWidth, screenHeight } = systemInfo;
644
644
  if (windowWidth <= 0) {
645
645
  systemInfo.initWindowWidth = windowWidth;
646
646
  if (isLandscape) {
647
647
  systemInfo.windowWidth = getScreenHeight;
648
648
  systemInfo.windowHeight = getScreenWidth;
649
649
  systemInfo.screenWidth = getScreenHeight;
650
650
  systemInfo.screenHeight = getScreenWidth;
651
651
  } else {
652
652
  systemInfo.windowWidth = getScreenWidth;
653
653
  systemInfo.windowHeight = getScreenHeight;
654
654
  systemInfo.screenWidth = getScreenWidth;
655
655
  systemInfo.screenHeight = getScreenHeight;
656
656
  }
657
657
  console.warn(
658
658
  `松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight},根元素宽度值${getRootEleInitWidth}`,
659
659
  );
660
660
  draBusinessCustomReport({
661
661
  type: 'android_jdapp_width_error_info',
662
662
  errMsg: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
663
663
  originReqDataStr: JSON.stringify({
664
664
  isJdApp,
665
665
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
666
666
  getScreenWidth,
667
667
  getScreenHeight,
668
668
  getWinWidth,
669
669
  getWinHeight,
670
670
  getRootEleInitWidth,
671
671
  }),
672
672
  });
673
673
  sgmCustomReport({
674
674
  type: 2,
675
675
  code: 'android_jdapp_width_error_info',
676
676
  msg: {
677
677
  title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
678
678
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
679
679
  taroSysInfo: systemInfo,
680
680
  },
681
681
  });
682
682
  } else {
683
683
  let _getChangeWinWidthState = false;
684
684
  if (getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth) {
685
685
  if (isLandscape) {
686
686
  systemInfo.windowWidth = getScreenHeight;
687
687
  systemInfo.windowHeight = getScreenWidth;
688
688
  systemInfo.screenWidth = getScreenHeight;
689
689
  systemInfo.screenHeight = getScreenWidth;
690
690
  } else {
691
691
  systemInfo.windowWidth = getScreenWidth;
692
692
  systemInfo.windowHeight = getScreenHeight;
693
693
  systemInfo.screenWidth = getScreenWidth;
694
694
  systemInfo.screenHeight = getScreenHeight;
695
695
  }
696
696
  _getChangeWinWidthState = true;
697
697
  }
698
698
  _getChangeWinWidthState &&
699
699
  console.warn(
700
700
  `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`,
701
701
  );
702
702
  if (_getChangeWinWidthState) {
703
703
  draBusinessCustomReport({
704
704
  type: 'android_jdapp_width_error_info_2',
705
705
  title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
706
706
  originReqDataStr: JSON.stringify({
707
707
  isJdApp,
708
708
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
709
709
  getScreenWidth,
710
710
  getScreenHeight,
711
711
  getWinWidth,
712
712
  getWinHeight,
713
713
  getRootEleInitWidth,
714
714
  }),
715
715
  });
716
716
  sgmCustomReport({
717
717
  type: 2,
718
718
  code: 'android_jdapp_width_error_info_2',
719
719
  msg: {
720
720
  title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
721
721
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
722
722
  taroSysInfo: systemInfo,
723
723
  },
724
724
  });
725
725
  }
726
726
  }
727
727
  }
728
728
  }
729
729
 
730
730
  if (systemInfo.isJdTabletDevice) {
731
731
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
732
732
  systemInfo.windowHeight = getScreenHeight;
733
733
  if (systemInfo.isJdTabletLandscape) {
734
734
  if (window?.PAGE_DATA?.isFitJdPadRenderCenter) {
735
735
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
736
736
  systemInfo.windowHeight = Math.max(
737
737
  getRootEleInitWidth,
738
738
  getScreenWidth,
739
739
  getScreenHeight,
740
740
  );
741
741
  }
742
742
  }
743
743
  console.warn(
744
744
  '====初始化获取当前设备是否是平板设备,是否横屏====',
745
745
  systemInfo.isJdTabletDevice,
746
746
  systemInfo.isJdTabletLandscape,
747
747
  '屏幕信息',
748
748
  window.screen,
749
749
  '当前是否要求居中展示,居中展示那么宽高值要对调',
750
750
  window?.PAGE_DATA?.isFitJdPadRenderCenter,
751
751
  '当前pad最终展示的窗口宽度',
752
752
  systemInfo.windowWidth,
753
753
  );
754
754
  }
755
755
  }
756
756
  }
757
757
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo);
758
758
  console.warn('====获取系统信息=====', systemInfo);
759
759
  return systemInfo;
760
760
  let result: boolean | null = null;
761
761
  return function () {
762
762
  if (result === null) {
763
763
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
764
764
  if (!isJdApp) {
765
765
  console.warn('🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~');
766
766
  isIgnoreOptimizeFromServer = true;
767
767
  result = true;
768
768
  return true;
769
769
  }
770
770
  const enableAvifOptimize = appVersionCheckPass;
771
771
  if (enableAvifOptimize) {
772
772
  const configData = global?.getDynamicConfig('avifSwitch');
773
773
  const {
774
774
  globalOn = true,
775
775
  ignoreOptimizeFromServer = false,
776
776
  page = {},
777
777
  grayscale = {},
778
778
  whiteList = [],
779
779
  blackList = [],
780
780
  } = configData || {};
781
781
  const { shopId = '0', venderId = '0' } = parseQueryUrlObj;
782
782
  let imageEnableResult = true;
783
783
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
784
784
  if (
785
785
  blackList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
786
786
  ) {
787
787
  imageEnableResult = false;
788
788
  } else if (
789
789
  whiteList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
790
790
  ) {
791
791
  isIgnoreOptimizeFromServer = true;
792
792
  imageEnableResult = true;
793
793
  } else if (grayscale[buildType] && isInGrayscale(grayscale[buildType])) {
794
794
  isIgnoreOptimizeFromServer = true;
795
795
  imageEnableResult = true;
796
796
  } else {
797
797
  imageEnableResult = globalOn === true || page[buildType] === true;
798
798
  if (globalOn === true) {
799
799
  isIgnoreOptimizeFromServer = true;
800
800
  } else if (page[buildType] === true) {
801
801
  } else {
802
802
  }
803
803
  }
804
804
  result = imageEnableResult;
805
805
  return imageEnableResult;
806
806
  } else {
807
807
  result = false;
808
808
  return false;
809
809
  }
810
810
  } else {
811
811
  return result;
812
812
  }
813
813
  };
814
814
  if (typeof options === 'object' && isImageOptimizeEnable()) {
815
815
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
816
816
  } else {
817
817
  return getQualityImageOld(imgUrl, options);
818
818
  }
819
819
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
820
820
  windowWidth: window.innerWidth,
821
821
  containerWidth: getContainerWidth(buildType, {
822
822
  windowWidth: window.innerWidth,
823
823
  }),
824
824
  screenWidth: window.innerWidth,
825
825
  platform: '',
826
826
  model: '',
827
827
  system: '',
828
828
  };
829
829
  return getSystemInfo;
830
830
  const params = Object.assign(
831
831
  {},
832
832
  {
833
833
  title: '',
834
834
  duration: 1500,
835
835
  },
836
836
  options,
837
837
  );
838
838
  params.duration = params.duration / 1000;
839
839
  if (isJdApp && !isJdAndHarmonyDevice && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
840
840
  const showSuccessType = isIosDevice ? ToastIosType.SUCCESS : ToastAndroidType.SUCCESS;
841
841
  const duration = isAndroidDevice ? 0 : params.duration;
842
842
  nativePageShowToast(options.title, showSuccessType, duration);
843
843
  console.log('执行原生toast success');
844
844
  } else {
845
845
  showSuccessToast(options);
846
846
  }
847
847
  const params = Object.assign(
848
848
  {},
849
849
  {
850
850
  title: '',
851
851
  duration: 1500,
852
852
  },
853
853
  options,
854
854
  );
855
855
  params.duration = params.duration / 1000;
856
856
  if (isJdApp && !isJdAndHarmonyDevice && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
857
857
  const showSuccessType = isIosDevice ? ToastIosType.FAIL : ToastAndroidType.FAIL;
858
858
  const duration = isAndroidDevice ? 0 : params.duration;
859
859
  nativePageShowToast(options.title, showSuccessType, duration);
860
860
  console.log('执行原生toast fail');
861
861
  } else {
862
862
  console.log('执行H5 toast fail');
863
863
  showFailToast(options);
864
864
  }
865
865
  const params = Object.assign(
866
866
  {},
867
867
  {
868
868
  title: '',
869
869
  duration: 1500,
870
870
  },
871
871
  options,
872
872
  );
873
873
  params.duration = params.duration / 1000;
874
874
  if (isJdApp && !isJdAndHarmonyDevice && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
875
875
  const showSuccessType = isIosDevice ? ToastIosType.NORMAL : ToastAndroidType.NORMAL;
876
876
  const duration = isAndroidDevice ? 0 : params.duration;
877
877
  nativePageShowToast(options.title, showSuccessType, duration);
878
878
  } else {
879
879
  showNormalToast(options);
880
880
  }
881
881
  if (isLanguageForEn) {
882
882
  count = Number(count);
883
883
  if (count >= 1000000000) {
884
884
  return (count / 1000000000).toFixed(fixedNum) + 'B';
885
885
  } else if (count >= 1000000) {
886
886
  return (count / 1000000).toFixed(fixedNum) + 'M';
887
887
  } else if (count >= 1000) {
888
888
  return (count / 1000).toFixed(fixedNum) + 'K';
889
889
  } else {
890
890
  return count;
891
891
  }
892
892
  } else {
893
893
  return h5CountStringify(count, fixedNum, unit, maxNum);
894
894
  }
895
895
  const createLoadingEle = document.createElement('div');
896
896
  createLoadingEle.id = 'J_shopLoading';
897
897
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
898
898
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
899
899
  <span class='d-shop-loading-icon'></span>
900
900
  <p class='d-shop-text'>${text}</p>
901
901
  </div>`;
902
902
  const getEle = document.body ? document.body : document.getElementsByTagName('body')[0];
903
903
  getEle.appendChild(createLoadingEle);
904
904
  const getEle = document.getElementById('J_shopLoading');
905
905
  getEle && getEle.remove();
906
906
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(params);
907
907
  if (!systemInfo.system && window) {
908
908
  systemInfo.system = window.navigator.userAgent;
909
909
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
910
910
  }
911
911
  const isIOS = !!systemInfo?.system.match(/ios/i);
912
912
  const isAndroid = !!systemInfo?.system.match(/android/i);
913
913
  systemInfo.navBarHeight = 0;
914
914
  systemInfo.statusBarHeight = 0;
915
915
  systemInfo.capsulePosition = null;
916
916
  systemInfo.isIOS = isIOS;
917
917
  systemInfo.isAndroid = isAndroid;
918
918
  _ShopSystemInfo = systemInfo;
919
919
  return systemInfo;
920
920
  return originDealShopContentData(pageData, sgmCustomReport, isvdev);
921
921
  const numScale = Number(scale);
922
922
  if (isNaN(numScale)) {
923
923
  console.warn(
924
924
  `The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`,
925
925
  );
926
926
  return false;
927
927
  }
928
928
  const { venderId } = global.info.queryInfo || {};
929
929
  const id = venderId;
930
930
  if (!id && numScale !== 1) {
931
931
  return false;
932
932
  }
933
933
  const useScale = Math.max(0, Math.min(1, numScale));
934
934
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
935
935
  if (reportKey) {
936
936
  sgmCustomReport({
937
937
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
938
938
  msg: '灰度调用',
939
939
  });
940
940
  console.log(
941
941
  `基于KEY[${reportKey}]的灰度调用1次~`,
942
942
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
943
943
  );
944
944
  if (isMatch) {
945
945
  sgmCustomReport({
946
946
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
947
947
  msg: '灰度命中',
948
948
  });
949
949
  console.log(
950
950
  `基于KEY[${reportKey}]的命中1次灰度!`,
951
951
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
952
952
  );
953
953
  }
954
954
  }
955
955
  return isMatch;
956
956
  isJdApp,
957
957
  isWxApp,
958
958
  isIosDevice,
959
959
  isAndroidDevice,
960
960
  isHarmonyDevice,
961
961
  isJdAndIosDevice,
962
962
  isJdAndAndroidDevice,
963
963
  isJdAndHarmonyDevice,
964
964
  isJdAndroidX5Core,
965
965
  isMin,
966
966
  isWxMin,
967
967
  isWxMinAndWxapp,
968
968
  isJdMinAndHarmony,
969
969
  isJdMin,
970
970
  isH5,
971
971
  isH5AndJdShopView,
972
972
  isChartH5,
973
973
  isH5AndJdShopViewNativeScroll,
974
974
  isH5AndJdShopViewH5Scroll,
975
975
  isH5AndJdShopH5CustomScrollView,
976
976
  isH5AndJingGouMini,
977
977
  isWxMiniH5View,
978
978
  urlCookie,
979
979
  sliceArrToChunkList,
980
980
  dealAddress,
981
981
  objectToUrlEncode,
982
982
  parseQueryUrlString,
983
983
  setLowSmallPicUrl,
984
984
  setTaroStorage,
985
985
  getTaroStorageKeyValue,
986
986
  removeTaroStorageKey,
987
987
  clearTaroStorageKey,
988
988
  getAvifSupport,
989
989
  getWebpSupport,
990
990
  getQualityImage,
991
991
  formatCountForUnit as countStringify,
992
992
  getWxAppCookieStr,
993
993
  getSystemInfos,
994
994
  pxTransformFromData,
995
995
  dealShopContentDataAndReport as dealShopContentData,
996
996
  dateFormat,
997
997
  throttle,
998
998
  lodashThrottle,
999
999
  debounce,
1000
1000
  addHttps,
1001
1001
  commonShowSuccessToast as showSuccessToast,
1002
1002
  commonShowFailToast as showFailToast,
1003
1003
  commonShowNormalToast as showNormalToast,
1004
1004
  showShopLoading,
1005
1005
  hideShopLoading,
1006
1006
  stopNativeScrollEvent,
1007
1007
  getAppChannelType,
1008
1008
  formatTabActiveMenuType,
1009
1009
  filterUrlQueryData,
1010
1010
  sgmCustomReport,
1011
1011
  draCustomReport,
1012
1012
  remoteCustomReport,
1013
1013
  draInterfaceCustomReport,
1014
1014
  draBusinessCustomReport,
1015
1015
  isMemberPage,
1016
1016
  getFloorDataToDataDefines,
1017
1017
  isOpenJdAppUrl,
1018
1018
  jdOpenAppParams,
1019
1019
  createJdOpenAppUrl,
1020
1020
  isEmpty,
1021
1021
  getJdAppReportPageSource,
1022
1022
  isAppClassifyPage,
1023
1023
  isAppHomeForMarketPage,
1024
1024
  isImageOptimizeEnable,
1025
1025
  isPc,
1026
1026
  ipLoc_djd,
1027
1027
  isTjScence,
1028
1028
  isH5AdnJxMini,
1029
1029
  isTjM,
1030
1030
  isTjJxM,
1031
1031
  isTJApp,
1032
1032
  isH5AdnHaoWuJie,
1033
1033
  tjChannel,
1034
1034
  dealJdOpenAppData,
1035
1035
  jdAppVersionCompare,
1036
1036
  dealNativePixelToCssPixel,
1037
1037
  isAppStowShop,
1038
1038
  getSgmCustomCode,
1039
1039
  handleSgmCodeTaroVersion,
1040
1040
  isInGrayscale,
1041
1041
  isIpadDevice,
1042
1042
  getBorderStyle,
1043
1043
  isSupportHybridHttpRequest,
1044
1044
  isLanguageForEn,
1045
1045
  sColor,
1046
1046
  draInterfaceDSMCustomReport,
1047
1047
  isTabletDevice,
1048
1048
  taroToTransformRoutimePXNumber,
1049
1049
  updateContainerWidth,
1050
1050
  isInJdShopView,