@conecli/cone-render 0.10.1-shop3.10 → 0.10.1-shop3.101

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