@conecli/cone-render 0.10.1-shop3.3 → 0.10.1-shop3.30

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 (82) hide show
  1. package/README.md +1 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/common/const.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/jssdk.ts +1 -1
  9. package/dist/common/token/index.h5.ts +1 -1
  10. package/dist/common/token/token.jd.ts +1 -1
  11. package/dist/common/wxappApi.ts +1 -1
  12. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  13. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  14. package/dist/components/base/CountDown/index.tsx +1 -1
  15. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  16. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  17. package/dist/components/base/Dialog/index.module.scss +11 -0
  18. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  19. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  20. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  21. package/dist/components/base/InViewRender/index.tsx +1 -1
  22. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  23. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  24. package/dist/components/base/NetworkDataError/const.ts +1 -1
  25. package/dist/components/base/NetworkDataError/index.module.scss +117 -71
  26. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  27. package/dist/components/base/Price/Base/index.module.scss +12 -0
  28. package/dist/components/base/Price/Base/index.tsx +1 -1
  29. package/dist/components/base/Price/Double/index.module.scss +6 -0
  30. package/dist/components/base/Price/Double/index.tsx +1 -1
  31. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  32. package/dist/components/floorItem.weapp.tsx +1 -1
  33. package/dist/interface/common.ts +1 -1
  34. package/dist/interface/component.ts +1 -1
  35. package/dist/interface/jumpEventReport.ts +1 -1
  36. package/dist/interface/service.ts +1 -1
  37. package/dist/jumpEventReport/base.ts +1 -1
  38. package/dist/jumpEventReport/const.ts +1 -1
  39. package/dist/jumpEventReport/index.h5.ts +1 -1
  40. package/dist/jumpEventReport/index.jd.ts +1 -1
  41. package/dist/jumpEventReport/index.weapp.ts +1 -1
  42. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  43. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  44. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  45. package/dist/jumpEventReport/web/report.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.pc.ts +1 -1
  49. package/dist/jumpEventReport/web.tjm.ts +1 -1
  50. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  51. package/dist/language/en_US.json +176 -0
  52. package/dist/language/zh_CN.json +176 -0
  53. package/dist/language/zh_HK.json +176 -0
  54. package/dist/libs/taroAppReport.js +2 -2
  55. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -53
  56. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  57. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  58. package/dist/open/api/environment.ts +1 -1
  59. package/dist/open/api/shopMember.ts +1 -1
  60. package/dist/open/api/util.ts +1 -1
  61. package/dist/sass/app.h5.scss +273 -224
  62. package/dist/service/fetchGateway.ts +1 -1
  63. package/dist/service/fetchGateway.weapp.ts +1 -0
  64. package/dist/service/http/colorSign.ts +1 -1
  65. package/dist/service/http/const.ts +1 -1
  66. package/dist/service/http/h5Http.ts +1 -1
  67. package/dist/service/requestServer.h5.ts +1 -1
  68. package/dist/service/requestServer.ts +1 -1
  69. package/dist/service/requestServer.weapp.ts +1 -0
  70. package/dist/utils/connectNativeJsBridge.ts +1 -1
  71. package/dist/utils/h5Utils.ts +1 -1
  72. package/dist/utils/index.h5.ts +1 -1
  73. package/dist/utils/index.ts +1 -1
  74. package/dist/utils/index.weapp.ts +1 -1
  75. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  76. package/dist/utils/jumpExtMapUtil.ts +1 -0
  77. package/dist/utils/log.ts +1 -0
  78. package/dist/utils/sColor.js +1 -0
  79. package/dist/utils/utils.ts +1 -1
  80. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  81. package/dist/wxapp/common/user_info.js +1 -1
  82. 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 && !isJdAndHarmonyDevice) {
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
  isNewHarmonyShop,
474
474
  isH5AndJingGouMini,
475
475
  urlCookie,
476
476
  sgmCustomReport,
477
477
  draCustomReport,
478
478
  remoteCustomReport,
479
479
  draInterfaceCustomReport,
480
480
  draBusinessCustomReport,
481
481
  draBusinessCustomLogReport,
482
482
  isMemberPage,
483
483
  isH5AndJdShopViewH5Scroll,
484
484
  isH5AndJdShopH5CustomScrollView,
485
485
  isAppClassifyPage,
486
486
  isAppHomeForMarketPage,
487
487
  isPc,
488
488
  ipLoc_djd,
489
489
  jdAppVersionCompare,
490
490
  isTjScence,
491
491
  isH5AdnJxMini,
492
492
  isTjM,
493
493
  isTjJxM,
494
494
  isTJApp,
495
495
  isH5AdnHaoWuJie,
496
496
  tjChannel,
497
497
  dealNativePixelToCssPixel,
498
498
  isAppStowShop,
499
499
  isJdAndroidX5Core,
500
500
  parseQueryUrlObj,
501
501
  isIpadDevice,
502
502
  isTabletDevice,
503
503
  checkPadScreenOrientationIsLandscape,
504
504
  isSupportHybridHttpRequest,
505
505
  isLanguageForEn,
506
506
  sColor,
507
507
  draInterfaceDSMCustomReport,
508
508
  isInJdShopView,
509
509
  isDongWebView,
510
510
  isLanguageForHk,
511
511
  languageNowType,
512
512
  addHttps,
513
513
  clearTaroStorageKey,
514
514
  countStringify as h5CountStringify,
515
515
  dateFormat,
516
516
  dealAddress,
517
517
  dealShopContentData as originDealShopContentData,
518
518
  debounce,
519
519
  filterUrlQueryData,
520
520
  formatTabActiveMenuType,
521
521
  getAvifSupport,
522
522
  getWebpSupport,
523
523
  getTaroStorageKeyValue,
524
524
  getWxAppCookieStr,
525
525
  isH5,
526
526
  isMin,
527
527
  isJdMin,
528
528
  isWxMin,
529
529
  isWxMinAndWxapp,
530
530
  isJdMinAndHarmony,
531
531
  lodashThrottle,
532
532
  objectToUrlEncode,
533
533
  parseQueryUrlString,
534
534
  removeTaroStorageKey,
535
535
  setLowSmallPicUrl,
536
536
  setTaroStorage,
537
537
  showFailToast,
538
538
  showNormalToast,
539
539
  showSuccessToast,
540
540
  sliceArrToChunkList,
541
541
  throttle,
542
542
  getQualityImageNew,
543
543
  getQualityImageOld,
544
544
  isOpenJdAppUrl,
545
545
  jdOpenAppParams,
546
546
  createJdOpenAppUrl,
547
547
  isEmpty,
548
548
  getJdAppReportPageSource,
549
549
  dealJdOpenAppData,
550
550
  getBorderStyle,
551
551
  isInHarmonyBlacklistByModuleFlag,
552
552
  const getNum = Number(num);
553
553
  let _changeLayoutWidth = layoutWidth;
554
554
  if (!_changeLayoutWidth) {
555
555
  _changeLayoutWidth =
556
556
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
557
557
  ? _ShopSystemInfo.windowWidth
558
558
  : Taro.getSystemInfoSync()?.windowWidth;
559
559
  }
560
560
  return _ShopSystemInfo?.isJdTabletDevice && !layoutWidth
561
561
  ? Math.floor(getNum * 1.2 * (_changeLayoutWidth / 720))
562
562
  : Math.round((getNum / widthSize) * _changeLayoutWidth);
563
563
  const getRootFontSize = (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
564
564
  let getRealRootFontSize = getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
565
565
  if (_ShopSystemInfo?.isJdTabletDevice) {
566
566
  getRealRootFontSize = Math.floor(
567
567
  24 * ((systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth) / 720),
568
568
  );
569
569
  }
570
570
  return Math.ceil(
571
571
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) * getRealRootFontSize,
572
572
  );
573
573
  console.log(
574
574
  '获取系统宽度systemInfo?.windowWidth',
575
575
  systemInfo?.windowWidth,
576
576
  'taroToTransformRoutimePXNumber(changeWidth)',
577
577
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
578
578
  );
579
579
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
580
580
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
581
581
  : systemInfo?.windowWidth ?? 0;
582
582
  const systemInfo = _ShopSystemInfo || Taro.getSystemInfoSync();
583
583
  console.log(
584
584
  '获取系统宽度systemInfo?.windowWidth',
585
585
  systemInfo?.windowWidth,
586
586
  'taroToTransformRoutimePXNumber(changeWidth)',
587
587
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
588
588
  );
589
589
  const containerWidth =
590
590
  isClassify && systemInfo?.windowWidth
591
591
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
592
592
  : systemInfo?.windowWidth ?? 0;
593
593
  if (global?.info?.sysInfo) {
594
594
  global.info.sysInfo['containerWidth'] = containerWidth;
595
595
  }
596
596
  return (
597
597
  isJdApp &&
598
598
  (parseQueryUrlObj['device'] === 'tablet' || Math.min(rootEleWidth, window.screen.height) >= 720)
599
599
  );
600
600
  const systemInfo = Taro.getSystemInfoSync();
601
601
  if (params && params?.pageWidth && params?.pageHeight) {
602
602
  systemInfo.windowWidth = params?.pageWidth;
603
603
  systemInfo.windowHeight = params?.pageHeight;
604
604
  console.warn('松果app内获取重置系统信息宽度值', params, ',systemInfo信息集合为', systemInfo);
605
605
  } else {
606
606
  if (isPc) {
607
607
  systemInfo.windowWidth = 375;
608
608
  } else {
609
609
  const getWinWidth = window.innerWidth;
610
610
  const getWinHeight = window.innerHeight;
611
611
  const getScreenWidth = window.screen.width;
612
612
  const getScreenHeight = window.screen.height;
613
613
  const getRootEleInitWidth = params?.rootEleInitWidth || 0;
614
614
  const isReplaceSystemWidth = params?.replaceSystemWidth || false;
615
615
  systemInfo.isJdTabletDevice = checkIsJdTabletDevice(getRootEleInitWidth);
616
616
  systemInfo.isJdTabletLandscape =
617
617
  systemInfo.isJdTabletDevice &&
618
618
  checkPadScreenOrientationIsLandscape(getRootEleInitWidth, getScreenWidth, getScreenHeight);
619
619
  if (!systemInfo.isJdTabletDevice && isReplaceSystemWidth) {
620
620
  if (systemInfo?.windowWidth <= 0) {
621
621
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
622
622
  systemInfo.windowHeight = getScreenHeight;
623
623
  console.warn(
624
624
  '====初始化获取当前设备不是pad,但是触发屏幕宽高最小值600,系统获取宽度为0,进行重置系统宽度为根元素宽度与屏幕宽度最小值====',
625
625
  systemInfo.windowWidth,
626
626
  'getRootEleInitWidth',
627
627
  getRootEleInitWidth,
628
628
  'getScreenWidth',
629
629
  getScreenWidth,
630
630
  'getScreenHeight',
631
631
  getScreenHeight,
632
632
  );
633
633
  draBusinessCustomReport({
634
634
  type: 'jdapp_pad_width_error_info',
635
635
  errMsg: `松果app内获取当前设备不是pad,触发屏幕宽高最小值600,系统信息宽度为0,进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
636
636
  originReqDataStr: JSON.stringify({
637
637
  isJdApp,
638
638
  isAndroidDevice,
639
639
  getScreenWidth,
640
640
  getScreenHeight,
641
641
  getWinWidth,
642
642
  getWinHeight,
643
643
  getRootEleInitWidth,
644
644
  }),
645
645
  });
646
646
  }
647
647
  } else {
648
648
  if (isJdApp && isAndroidDevice && !systemInfo.isJdTabletDevice && systemInfo) {
649
649
  const isLandscape = getScreenWidth >= getScreenHeight;
650
650
  const { windowWidth, windowHeight, screenWidth, screenHeight } = systemInfo;
651
651
  if (windowWidth <= 0) {
652
652
  systemInfo.initWindowWidth = windowWidth;
653
653
  if (isLandscape) {
654
654
  systemInfo.windowWidth = getScreenHeight;
655
655
  systemInfo.windowHeight = getScreenWidth;
656
656
  systemInfo.screenWidth = getScreenHeight;
657
657
  systemInfo.screenHeight = getScreenWidth;
658
658
  } else {
659
659
  systemInfo.windowWidth = getScreenWidth;
660
660
  systemInfo.windowHeight = getScreenHeight;
661
661
  systemInfo.screenWidth = getScreenWidth;
662
662
  systemInfo.screenHeight = getScreenHeight;
663
663
  }
664
664
  console.warn(
665
665
  `松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight},根元素宽度值${getRootEleInitWidth}`,
666
666
  );
667
667
  draBusinessCustomReport({
668
668
  type: 'android_jdapp_width_error_info',
669
669
  errMsg: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
670
670
  originReqDataStr: JSON.stringify({
671
671
  isJdApp,
672
672
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
673
673
  getScreenWidth,
674
674
  getScreenHeight,
675
675
  getWinWidth,
676
676
  getWinHeight,
677
677
  getRootEleInitWidth,
678
678
  }),
679
679
  });
680
680
  sgmCustomReport({
681
681
  type: 2,
682
682
  code: 'android_jdapp_width_error_info',
683
683
  msg: {
684
684
  title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
685
685
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
686
686
  taroSysInfo: systemInfo,
687
687
  },
688
688
  });
689
689
  } else {
690
690
  let _getChangeWinWidthState = false;
691
691
  if (getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth) {
692
692
  if (isLandscape) {
693
693
  systemInfo.windowWidth = getScreenHeight;
694
694
  systemInfo.windowHeight = getScreenWidth;
695
695
  systemInfo.screenWidth = getScreenHeight;
696
696
  systemInfo.screenHeight = getScreenWidth;
697
697
  } else {
698
698
  systemInfo.windowWidth = getScreenWidth;
699
699
  systemInfo.windowHeight = getScreenHeight;
700
700
  systemInfo.screenWidth = getScreenWidth;
701
701
  systemInfo.screenHeight = getScreenHeight;
702
702
  }
703
703
  _getChangeWinWidthState = true;
704
704
  }
705
705
  _getChangeWinWidthState &&
706
706
  console.warn(
707
707
  `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`,
708
708
  );
709
709
  if (_getChangeWinWidthState) {
710
710
  draBusinessCustomReport({
711
711
  type: 'android_jdapp_width_error_info_2',
712
712
  title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
713
713
  originReqDataStr: JSON.stringify({
714
714
  isJdApp,
715
715
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
716
716
  getScreenWidth,
717
717
  getScreenHeight,
718
718
  getWinWidth,
719
719
  getWinHeight,
720
720
  getRootEleInitWidth,
721
721
  }),
722
722
  });
723
723
  sgmCustomReport({
724
724
  type: 2,
725
725
  code: 'android_jdapp_width_error_info_2',
726
726
  msg: {
727
727
  title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
728
728
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
729
729
  taroSysInfo: systemInfo,
730
730
  },
731
731
  });
732
732
  }
733
733
  }
734
734
  }
735
735
  }
736
736
 
737
737
  if (systemInfo.isJdTabletDevice) {
738
738
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
739
739
  systemInfo.windowHeight = Math.max(getScreenWidth, getScreenHeight);
740
740
  if (systemInfo.isJdTabletLandscape) {
741
741
  const getRenderCenterState = window?.PAGE_DATA?.businessData?.fitPadCenterRenderLowVersion
742
742
  ? jdAppVersionCompare(window.PAGE_DATA.businessData.fitPadCenterRenderLowVersion) < 0
743
743
  : false;
744
744
  if (getRenderCenterState && window?.PAGE_DATA) {
745
745
  window.PAGE_DATA.isFitJdPadRenderCenter = true;
746
746
  }
747
747
  if (window?.PAGE_DATA?.isFitJdPadRenderCenter) {
748
748
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
749
749
  systemInfo.windowHeight = Math.max(
750
750
  getRootEleInitWidth,
751
751
  getScreenWidth,
752
752
  getScreenHeight,
753
753
  );
754
754
  } else {
755
755
  systemInfo.windowWidth = Math.max(getRootEleInitWidth, getScreenWidth, getScreenHeight);
756
756
  systemInfo.windowHeight = Math.min(
757
757
  getRootEleInitWidth,
758
758
  getScreenWidth,
759
759
  getScreenHeight,
760
760
  );
761
761
  }
762
762
  }
763
763
  console.warn(
764
764
  '====初始化获取当前设备是否是平板设备,是否横屏====',
765
765
  systemInfo.isJdTabletDevice,
766
766
  systemInfo.isJdTabletLandscape,
767
767
  '屏幕信息',
768
768
  window.screen,
769
769
  'getScreenWidth',
770
770
  getScreenWidth,
771
771
  'getScreenHeight',
772
772
  getScreenHeight,
773
773
  'getRootEleInitWidth',
774
774
  getRootEleInitWidth,
775
775
  '当前是否要求居中展示,居中展示那么宽高值要对调',
776
776
  window?.PAGE_DATA?.isFitJdPadRenderCenter,
777
777
  '当前pad最终展示的窗口宽度',
778
778
  systemInfo.windowWidth,
779
779
  );
780
780
  }
781
781
  }
782
782
  }
783
783
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo);
784
784
  console.warn('====获取系统信息=====', systemInfo);
785
785
  return systemInfo;
786
786
  let result: boolean | null = null;
787
787
  return function () {
788
788
  if (result === null) {
789
789
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
790
790
  if (!isJdApp) {
791
791
  console.warn('🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~');
792
792
  isIgnoreOptimizeFromServer = true;
793
793
  result = true;
794
794
  return true;
795
795
  }
796
796
  const enableAvifOptimize = appVersionCheckPass;
797
797
  if (enableAvifOptimize) {
798
798
  const configData = global?.getDynamicConfig('avifSwitch');
799
799
  const {
800
800
  globalOn = true,
801
801
  ignoreOptimizeFromServer = false,
802
802
  page = {},
803
803
  grayscale = {},
804
804
  whiteList = [],
805
805
  blackList = [],
806
806
  } = configData || {};
807
807
  const { shopId = '0', venderId = '0' } = parseQueryUrlObj;
808
808
  let imageEnableResult = true;
809
809
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
810
810
  if (
811
811
  blackList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
812
812
  ) {
813
813
  imageEnableResult = false;
814
814
  } else if (
815
815
  whiteList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
816
816
  ) {
817
817
  isIgnoreOptimizeFromServer = true;
818
818
  imageEnableResult = true;
819
819
  } else if (grayscale[buildType] && isInGrayscale(grayscale[buildType])) {
820
820
  isIgnoreOptimizeFromServer = true;
821
821
  imageEnableResult = true;
822
822
  } else {
823
823
  imageEnableResult = globalOn === true || page[buildType] === true;
824
824
  if (globalOn === true) {
825
825
  isIgnoreOptimizeFromServer = true;
826
826
  } else if (page[buildType] === true) {
827
827
  } else {
828
828
  }
829
829
  }
830
830
  result = imageEnableResult;
831
831
  return imageEnableResult;
832
832
  } else {
833
833
  result = false;
834
834
  return false;
835
835
  }
836
836
  } else {
837
837
  return result;
838
838
  }
839
839
  };
840
840
  if (typeof options === 'object' && isImageOptimizeEnable()) {
841
841
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
842
842
  } else {
843
843
  return getQualityImageOld(imgUrl, options);
844
844
  }
845
845
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
846
846
  windowWidth: window.innerWidth,
847
847
  containerWidth: getContainerWidth(buildType, {
848
848
  windowWidth: window.innerWidth,
849
849
  }),
850
850
  screenWidth: window.innerWidth,
851
851
  platform: '',
852
852
  model: '',
853
853
  system: '',
854
854
  };
855
855
  return getSystemInfo;
856
856
  const params = Object.assign(
857
857
  {},
858
858
  {
859
859
  title: '',
860
860
  duration: 1500,
861
861
  },
862
862
  options,
863
863
  );
864
864
  params.duration = params.duration / 1000;
865
865
  if (isJdApp && !isJdAndHarmonyDevice && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
866
866
  const showSuccessType = isIosDevice ? ToastIosType.SUCCESS : ToastAndroidType.SUCCESS;
867
867
  const duration = isAndroidDevice ? 0 : params.duration;
868
868
  nativePageShowToast(options.title, showSuccessType, duration);
869
869
  console.log('执行原生toast success');
870
870
  } else {
871
871
  showSuccessToast(options);
872
872
  }
873
873
  const params = Object.assign(
874
874
  {},
875
875
  {
876
876
  title: '',
877
877
  duration: 1500,
878
878
  },
879
879
  options,
880
880
  );
881
881
  params.duration = params.duration / 1000;
882
882
  if (isJdApp && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
883
883
  const showSuccessType = isIosDevice ? ToastIosType.FAIL : ToastAndroidType.FAIL;
884
884
  const duration = isAndroidDevice ? 0 : params.duration;
885
885
  nativePageShowToast(options.title, showSuccessType, duration);
886
886
  console.log('执行原生toast fail');
887
887
  } else {
888
888
  console.log('执行H5 toast fail');
889
889
  showFailToast(options);
890
890
  }
891
891
  const params = Object.assign(
892
892
  {},
893
893
  {
894
894
  title: '',
895
895
  duration: 1500,
896
896
  },
897
897
  options,
898
898
  );
899
899
  params.duration = params.duration / 1000;
900
900
  if (isJdApp && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
901
901
  const showSuccessType = isIosDevice ? ToastIosType.NORMAL : ToastAndroidType.NORMAL;
902
902
  const duration = isAndroidDevice ? 0 : params.duration;
903
903
  nativePageShowToast(options.title, showSuccessType, duration);
904
904
  } else {
905
905
  showNormalToast(options);
906
906
  }
907
907
  if (isLanguageForEn) {
908
908
  count = Number(count);
909
909
  if (count >= 1000000000) {
910
910
  return (count / 1000000000).toFixed(fixedNum) + 'B';
911
911
  } else if (count >= 1000000) {
912
912
  return (count / 1000000).toFixed(fixedNum) + 'M';
913
913
  } else if (count >= 1000) {
914
914
  return (count / 1000).toFixed(fixedNum) + 'K';
915
915
  } else {
916
916
  return count;
917
917
  }
918
918
  } else {
919
919
  return h5CountStringify(count, fixedNum, unit, maxNum);
920
920
  }
921
921
  const createLoadingEle = document.createElement('div');
922
922
  createLoadingEle.id = 'J_shopLoading';
923
923
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
924
924
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
925
925
  <span class='d-shop-loading-icon'></span>
926
926
  <p class='d-shop-text'>${text}</p>
927
927
  </div>`;
928
928
  const getEle = document.body ? document.body : document.getElementsByTagName('body')[0];
929
929
  getEle.appendChild(createLoadingEle);
930
930
  const getEle = document.getElementById('J_shopLoading');
931
931
  getEle && getEle.remove();
932
932
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(params);
933
933
  if (!systemInfo.system && window) {
934
934
  systemInfo.system = window.navigator.userAgent;
935
935
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
936
936
  }
937
937
  const isIOS = !!systemInfo?.system.match(/ios/i);
938
938
  const isAndroid = !!systemInfo?.system.match(/android/i);
939
939
  systemInfo.navBarHeight = 0;
940
940
  systemInfo.statusBarHeight = 0;
941
941
  systemInfo.capsulePosition = null;
942
942
  systemInfo.isIOS = isIOS;
943
943
  systemInfo.isAndroid = isAndroid;
944
944
  _ShopSystemInfo = systemInfo;
945
945
  return systemInfo;
946
946
  const result = originDealShopContentData(pageData, sgmCustomReport, isvdev);
947
947
  if (isJdAndHarmonyDevice && isNewHarmonyShop) {
948
948
  result.shopContentContainerListData = result.shopContentContainerListData.filter(
949
949
  (item) =>
950
950
  item.floors.length > 0 &&
951
951
  !isInHarmonyBlacklistByModuleFlag(item.containerId, result.shopContentContainerListData),
952
952
  );
953
953
  }
954
954
  return result;
955
955
  const numScale = Number(scale);
956
956
  if (isNaN(numScale)) {
957
957
  console.warn(
958
958
  `The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`,
959
959
  );
960
960
  return false;
961
961
  }
962
962
  const { venderId } = global.info.queryInfo || {};
963
963
  const id = venderId;
964
964
  if (!id && numScale !== 1) {
965
965
  return false;
966
966
  }
967
967
  const useScale = Math.max(0, Math.min(1, numScale));
968
968
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
969
969
  if (reportKey) {
970
970
  sgmCustomReport({
971
971
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
972
972
  msg: '灰度调用',
973
973
  });
974
974
  console.log(
975
975
  `基于KEY[${reportKey}]的灰度调用1次~`,
976
976
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
977
977
  );
978
978
  if (isMatch) {
979
979
  sgmCustomReport({
980
980
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
981
981
  msg: '灰度命中',
982
982
  });
983
983
  console.log(
984
984
  `基于KEY[${reportKey}]的命中1次灰度!`,
985
985
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
986
986
  );
987
987
  }
988
988
  }
989
989
  return isMatch;
990
990
  isJdApp,
991
991
  isWxApp,
992
992
  isIosDevice,
993
993
  isAndroidDevice,
994
994
  isHarmonyDevice,
995
995
  isJdAndIosDevice,
996
996
  isJdAndAndroidDevice,
997
997
  isJdAndHarmonyDevice,
998
998
  isNewHarmonyShop,
999
999
  isJdAndroidX5Core,
1000
1000
  isMin,
1001
1001
  isWxMin,
1002
1002
  isWxMinAndWxapp,
1003
1003
  isJdMinAndHarmony,
1004
1004
  isJdMin,
1005
1005
  isH5,
1006
1006
  isH5AndJdShopView,
1007
1007
  isChartH5,
1008
1008
  isH5AndJdShopViewNativeScroll,
1009
1009
  isH5AndJdShopViewH5Scroll,
1010
1010
  isH5AndJdShopH5CustomScrollView,
1011
1011
  isH5AndJingGouMini,
1012
1012
  isWxMiniH5View,
1013
1013
  urlCookie,
1014
1014
  sliceArrToChunkList,
1015
1015
  dealAddress,
1016
1016
  objectToUrlEncode,
1017
1017
  parseQueryUrlString,
1018
1018
  setLowSmallPicUrl,
1019
1019
  setTaroStorage,
1020
1020
  getTaroStorageKeyValue,
1021
1021
  removeTaroStorageKey,
1022
1022
  clearTaroStorageKey,
1023
1023
  getAvifSupport,
1024
1024
  getWebpSupport,
1025
1025
  getQualityImage,
1026
1026
  formatCountForUnit as countStringify,
1027
1027
  getWxAppCookieStr,
1028
1028
  getSystemInfos,
1029
1029
  pxTransformFromData,
1030
1030
  dealShopContentDataAndReport as dealShopContentData,
1031
1031
  dateFormat,
1032
1032
  throttle,
1033
1033
  lodashThrottle,
1034
1034
  debounce,
1035
1035
  addHttps,
1036
1036
  commonShowSuccessToast as showSuccessToast,
1037
1037
  commonShowFailToast as showFailToast,
1038
1038
  commonShowNormalToast as showNormalToast,
1039
1039
  showShopLoading,
1040
1040
  hideShopLoading,
1041
1041
  stopNativeScrollEvent,
1042
1042
  getAppChannelType,
1043
1043
  formatTabActiveMenuType,
1044
1044
  filterUrlQueryData,
1045
1045
  sgmCustomReport,
1046
1046
  draCustomReport,
1047
1047
  remoteCustomReport,
1048
1048
  draInterfaceCustomReport,
1049
1049
  draBusinessCustomReport,
1050
1050
  draBusinessCustomLogReport,
1051
1051
  isMemberPage,
1052
1052
  getFloorDataToDataDefines,
1053
1053
  isOpenJdAppUrl,
1054
1054
  jdOpenAppParams,
1055
1055
  createJdOpenAppUrl,
1056
1056
  isEmpty,
1057
1057
  getJdAppReportPageSource,
1058
1058
  isAppClassifyPage,
1059
1059
  isAppHomeForMarketPage,
1060
1060
  isImageOptimizeEnable,
1061
1061
  isPc,
1062
1062
  ipLoc_djd,
1063
1063
  isTjScence,
1064
1064
  isH5AdnJxMini,
1065
1065
  isTjM,
1066
1066
  isTjJxM,
1067
1067
  isTJApp,
1068
1068
  isH5AdnHaoWuJie,
1069
1069
  tjChannel,
1070
1070
  dealJdOpenAppData,
1071
1071
  jdAppVersionCompare,
1072
1072
  dealNativePixelToCssPixel,
1073
1073
  isAppStowShop,
1074
1074
  getSgmCustomCode,
1075
1075
  handleSgmCodeTaroVersion,
1076
1076
  isInGrayscale,
1077
1077
  isIpadDevice,
1078
1078
  getBorderStyle,
1079
1079
  isSupportHybridHttpRequest,
1080
1080
  isLanguageForEn,
1081
1081
  sColor,
1082
1082
  draInterfaceDSMCustomReport,
1083
1083
  isTabletDevice,
1084
1084
  taroToTransformRoutimePXNumber,
1085
1085
  updateContainerWidth,
1086
1086
  isInJdShopView,
1087
1087
  isDongWebView,
1088
1088
  isLanguageForHk,
1089
1089
  languageNowType,