@conecli/cone-render 0.10.1-shop-beta.24 → 0.10.1-shop-beta.26

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