@conecli/cone-render 0.10.1-isv2.4 → 0.10.1-isv3.1

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