@conecli/cone-render 0.10.1-shop3.5 → 0.10.1-shop3.6

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