@conecli/cone-render 0.10.1-shop-beta.5 → 0.10.1-shop3.0

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