@conecli/cone-render 0.10.1-beta.8 → 0.10.1-beta.9

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