@conecli/cone-render 0.10.1-beta.5 → 0.10.1-beta.7

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