@conecli/cone-render 0.9.1-shop2.27 → 0.9.1-shop2.29

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