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

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 (32) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  4. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  5. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  6. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  7. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  8. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  9. package/dist/interface/jumpEventReport.ts +1 -1
  10. package/dist/interface/service.ts +1 -1
  11. package/dist/jumpEventReport/base.ts +1 -1
  12. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  13. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  14. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  15. package/dist/jumpEventReport/web/report.ts +1 -1
  16. package/dist/jumpEventReport/web.base.ts +1 -1
  17. package/dist/jumpEventReport/web.jd.ts +1 -1
  18. package/dist/modules/ContainerFloorList/index.h5.module.scss +3 -0
  19. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  20. package/dist/open/api/util.ts +1 -1
  21. package/dist/service/http/colorSign.ts +1 -1
  22. package/dist/service/http/const.ts +1 -1
  23. package/dist/service/requestServer.h5.ts +1 -1
  24. package/dist/service/requestServer.ts +1 -1
  25. package/dist/utils/connectNativeJsBridge.ts +1 -1
  26. package/dist/utils/h5Utils.ts +1 -1
  27. package/dist/utils/index.h5.ts +1 -1
  28. package/dist/utils/index.ts +1 -1
  29. package/dist/utils/index.weapp.ts +1 -1
  30. package/dist/utils/sColor.js +1 -0
  31. package/dist/utils/utils.ts +1 -1
  32. package/package.json +1 -1
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  SHOP_MENU_ID_TYPE,
3
2
  SHOP_MENU_ID_QUERY_NAME,
4
3
  SECTION_HOME_TAB_TYPE,
5
4
  SECTION_HOME_TAB_NAME_TYPE,
6
5
  SECTION_HOME_TAB_QUERY_TYPE,
7
6
  CHANNEL_TYPE,
8
7
  JDShopViewBusinessPathType,
9
8
  FloorModuleType,
10
9
  RemoteLoadFloorList,
11
10
  FLOOR_KIND,
12
11
  getBundleUrl,
13
12
  getBundleFileName,
14
13
  formatPackResult,
15
14
  getTaroVersion,
16
15
  SgmCustomCode,
17
16
  NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG,
18
17
  key: string,
19
18
  value: string | object,
20
19
  successBack?: any,
21
20
  failBack?: any,
22
21
  try{
23
22
  if(isH5 && window && !window.localStorage){
24
23
  console.log(`setTaroStorage key:${key} window.localStorage不存在:`);
25
24
  return Promise.resolve(null);
26
25
  }
27
26
  return Taro.setStorage({
28
27
  key: key,
29
28
  data: value,
30
29
  success: successBack,
31
30
  fail: failBack,
32
31
  }).catch((e) => {
33
32
  console.log(`setTaroStorage key:${key} 报错:`, e);
34
33
  return null;
35
34
  });
36
35
  }
37
36
  catch(e){
38
37
  console.log(`setTaroStorage key:${key} 报错:`, e)
39
38
  return Promise.resolve(null)
40
39
  }
41
40
  try {
42
41
  if (isH5 && window && !window.localStorage) {
43
42
  console.log(
44
43
  `getTaroStorageKeyValue key:${key} window.localStorage不存在:`,
45
44
  )
46
45
  return Promise.resolve(null)
47
46
  }
48
47
  return Taro.getStorageSync(key)
49
48
  } catch (e) {
50
49
  console.log(`getTaroStorageKeyValue key:${key} 报错:`, e)
51
50
  return null
52
51
  }
53
52
  try {
54
53
  if (isH5 && window && !window.localStorage) {
55
54
  console.log(`removeTaroStorageKey key:${key} window.localStorage不存在:`)
56
55
  return Promise.resolve(null)
57
56
  }
58
57
  return Taro.removeStorage({
59
58
  key: key,
60
59
  }).catch((e) => {
61
60
  console.log(`removeTaroStorageKey key:${key} 报错:`, e)
62
61
  })
63
62
  } catch (e) {
64
63
  console.log(`removeTaroStorageKey key:${key} 报错:`, e)
65
64
  }
66
65
  try {
67
66
  if (isH5 && window && !window.localStorage) {
68
67
  console.log(`clearTaroStorageKey window.localStorage不存在`)
69
68
  return Promise.resolve(null)
70
69
  }
71
70
  return Taro.clearStorage().catch((e) => {
72
71
  console.log('clearTaroStorageKey报错:', e)
73
72
  })
74
73
  } catch (e) {
75
74
  console.log('clearTaroStorageKey报错:', e)
76
75
  }
77
76
  let hasChecked = false
78
77
  if (isH5) {
79
78
  const avifCache = getTaroStorageKeyValue(KEY_AVIF)
80
79
  if (avifCache === null || avifCache === '' || forceUpdate) {
81
80
  hasChecked = true
82
81
  const img = new Image()
83
82
  img.onload = function () {
84
83
  if (img.height > 0 && img.width > 0) {
85
84
  setTaroStorage(KEY_AVIF, '1')
86
85
  } else {
87
86
  setTaroStorage(KEY_AVIF, '0')
88
87
  }
89
88
  }
90
89
  img.onerror = () => {
91
90
  setTaroStorage(KEY_AVIF, '0')
92
91
  }
93
92
  img.src =
94
93
  'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A='
95
94
  }
96
95
  const webpCache = getTaroStorageKeyValue(KEY_WEBP)
97
96
  if (webpCache === null || webpCache === '' || forceUpdate) {
98
97
  hasChecked = true
99
98
  const img = new Image()
100
99
  img.onload = function () {
101
100
  if (img.height > 0 && img.width > 0) {
102
101
  setTaroStorage(KEY_WEBP, '1')
103
102
  } else {
104
103
  setTaroStorage(KEY_WEBP, '0')
105
104
  }
106
105
  }
107
106
  img.onerror = () => {
108
107
  setTaroStorage(KEY_WEBP, '0')
109
108
  }
110
109
  img.src =
111
110
  'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA='
112
111
  }
113
112
  }
114
113
  return hasChecked
115
114
  const hasChecked = imageFormatSupport(false)
116
115
  if (!hasChecked) {
117
116
  setTimeout(imageFormatSupport, 5000)
118
117
  }
119
118
  const resultList: Array<any> = [],
120
119
  arrLen = arr.length
121
120
  if (arrLen) {
122
121
  if (arrLen > size) {
123
122
  for (let i = 0; i < arrLen; i = i + size) {
124
123
  resultList.push(arr.slice(i, i + size))
125
124
  }
126
125
  } else {
127
126
  resultList.push(arr)
128
127
  }
129
128
  }
130
129
  return resultList
131
130
  let _address = ids
132
131
  const _areaAreaSplit = ids.split('.')
133
132
  const _areaAreaSplit2 = ids.split('_')
134
133
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address
135
134
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address
136
135
  return _address
137
136
  let paramStr = ''
138
137
  obj &&
139
138
  Object.keys(obj).forEach((key, index) => {
140
139
  const getValue = `${obj[key]}`
141
140
  .replace(/undefined/, '')
142
141
  .replace(/null/, '')
143
142
  paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(
144
143
  getValue,
145
144
  )}`
146
145
  })
147
146
  return paramStr
148
147
  const result = {}
149
148
  if (
150
149
  !urlOrQueryStr ||
151
150
  ('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
152
151
  ) {
153
152
  return result
154
153
  }
155
154
  if (urlOrQueryStr.indexOf('?') > -1) {
156
155
  const queryStr = urlOrQueryStr.split('?')
157
156
  const queryItemList =
158
157
  queryStr && queryStr.length > 1 ? queryStr[1].split('&') : []
159
158
  const queryItemListLen = queryItemList.length
160
159
  queryItemListLen > 0 &&
161
160
  queryItemList.forEach((item) => {
162
161
  const thisItemList = item.split('=')
163
162
  result[thisItemList[0]] = thisItemList[1]
164
163
  })
165
164
  } else {
166
165
  const queryItemList =
167
166
  urlOrQueryStr.indexOf('&') > -1
168
167
  ? urlOrQueryStr.split('&')
169
168
  : [urlOrQueryStr]
170
169
  const queryItemListLen = queryItemList.length
171
170
  queryItemListLen > 0 &&
172
171
  queryItemList.forEach((item) => {
173
172
  const thisItemList = item.split('=')
174
173
  result[thisItemList[0]] = thisItemList[1]
175
174
  })
176
175
  }
177
176
  return result
178
177
  url: string,
179
178
  size?: {
180
179
  w: number
181
180
  h: number
182
181
  },
183
182
  quality?: number,
184
183
  if (url && size) {
185
184
  const _w = Math.floor(size.w)
186
185
  const _h = Math.floor(size.h)
187
186
  if (url.match(/gif$/i)) {
188
187
  return url
189
188
  } else {
190
189
  if (_w > 0 && _h > 0) {
191
190
  url = url.replace('jfs/', `s${_w}x${_h}_jfs/`)
192
191
  }
193
192
  url += quality != null ? `!q${quality}.dpg` : '.dpg'
194
193
  }
195
194
  }
196
195
  return url
197
196
  url: string,
198
197
  jfsImgInfo: UtilsInterFace.getJfsImageInfo = {},
199
198
  if (url.match(/\.(jpg|png|dpg)$/i)) {
200
199
  const { width, height, quality } = jfsImgInfo
201
200
  if (typeof width === 'number' || typeof height === 'number') {
202
201
  url = url.replace(
203
202
  '/jfs/',
204
203
  `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`,
205
204
  )
206
205
  }
207
206
  if (
208
207
  typeof quality === 'number' &&
209
208
  quality > 0 &&
210
209
  quality < 100 &&
211
210
  url.match(/\.jpg$/i)
212
211
  ) {
213
212
  url += `!q${quality}.dpg`
214
213
  }
215
214
  }
216
215
  return addHttps(url)
217
216
  if (imgUrl) {
218
217
  if (
219
218
  !imgUrl.match(
220
219
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
221
220
  )
222
221
  ) {
223
222
  if (!imgUrl.includes('360buyimg.com')) {
224
223
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
225
224
  }
226
225
  if (quality != 100)
227
226
  imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
228
227
  }
229
228
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl
230
229
  }
231
230
  return imgUrl
232
231
  const result = value % step
233
232
  return result === 0 ? value : Math.ceil(value / step) * step
234
233
  const MAX = 3.5
235
234
  return Math.min(window?.devicePixelRatio ?? 2, MAX)
236
235
  isSkuImage: boolean
237
236
  size: number
238
237
  imgUrl: string,
239
238
  options: QualityOptions,
240
239
  isIgnoreOptimizeFromServer: boolean = false,
241
240
  if (!imgUrl) {
242
241
  console.error(
243
242
  'The input parameter imageUrl for the getQualityImage() cannot be empty!',
244
243
  )
245
244
  return imgUrl
246
245
  }
247
246
  if (isIgnoreOptimizeFromServer) {
248
247
  imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1')
249
248
  }
250
249
  if (!/^((https?):)?\/\//.test(imgUrl)) {
251
250
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
252
251
  }
253
252
  const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i
254
253
  if (!imgServerRegExp.test(imgUrl)) {
255
254
  return imgUrl
256
255
  }
257
256
  imgUrl = /^\/\//.test(imgUrl) ? `https:${imgUrl}` : imgUrl
258
257
  const { isSkuImage, size } = options || {}
259
258
  const needReduceSize = isSkuImage && size
260
259
  if (needReduceSize) {
261
260
  const devicePixelRatio = getDevicePixelRatio()
262
261
  const useWidth = getValueByStep(size * devicePixelRatio, 40)
263
262
  imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useWidth}_jfs/`)
264
263
  }
265
264
  const needCompress = !global?.info?.pageInfo?.isVipShop
266
265
  const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/)
267
266
  if (needCompress && result) {
268
267
  if (getAvifSupport() === '1') {
269
268
  imgUrl += '.avif'
270
269
  } else if (getWebpSupport() === '1') {
271
270
  imgUrl += '.webp'
272
271
  } else if (/jpe?g/.test(result[1])) {
273
272
  imgUrl += '!q80'
274
273
  }
275
274
  }
276
275
  if (needReduceSize) {
277
276
  imgUrl += '!z2'
278
277
  }
279
278
  return imgUrl
280
279
  if (imgUrl) {
281
280
  if (
282
281
  !imgUrl.match(
283
282
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
284
283
  )
285
284
  ) {
286
285
  if (!imgUrl.includes('360buyimg.com')) {
287
286
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
288
287
  }
289
288
  if (quality != 100)
290
289
  imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
291
290
  }
292
291
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl
293
292
  }
294
293
  return imgUrl
295
294
  return getTaroStorageKeyValue(KEY_AVIF) || '0'
296
295
  return getTaroStorageKeyValue(KEY_WEBP) || '0'
297
296
  count: number,
298
297
  fixedNum = 1,
299
298
  unit = '万',
300
299
  maxNum = 10000,
301
300
  count = Number(count)
302
301
  const getMaxNum = count > 100000000 ? 100000000 : maxNum
303
302
  const getUnit = count > 100000000 ? '亿' : unit
304
303
  if (count >= getMaxNum) {
305
304
  return (count / getMaxNum).toFixed(fixedNum) + getUnit
306
305
  }
307
306
  return count
308
307
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
309
308
  platform: '',
310
309
  model: '',
311
310
  system: '',
312
311
  }
313
312
  const isIOS = !!systemInfo.system.match(/ios/i)
314
313
  const isAndroid = !!systemInfo.system.match(/android/i)
315
314
  if (!systemInfo.statusBarHeight) {
316
315
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20
317
316
  systemInfo.navBarExtendHeight = 0
318
317
  } else {
319
318
  if (isIOS) {
320
319
  systemInfo.navBarExtendHeight = 4
321
320
  } else {
322
321
  systemInfo.navBarExtendHeight = 0
323
322
  }
324
323
  }
325
324
  let rect = Taro.getMenuButtonBoundingClientRect
326
325
  ? Taro.getMenuButtonBoundingClientRect()
327
326
  : null
328
327
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
329
328
  let gap = 0
330
329
  let width = 96
331
330
  if (systemInfo.platform === 'android') {
332
331
  gap = 8
333
332
  width = 96
334
333
  } else if (systemInfo.platform === 'devtools') {
335
334
  if (isIOS) {
336
335
  gap = 5.5
337
336
  } else {
338
337
  gap = 7.5
339
338
  }
340
339
  } else {
341
340
  gap = 4
342
341
  width = 88
343
342
  }
344
343
  rect = {
345
344
  bottom: systemInfo.statusBarHeight + gap + 32,
346
345
  height: 32,
347
346
  left: systemInfo.windowWidth - width - 10,
348
347
  right: systemInfo.windowWidth - 10,
349
348
  top: systemInfo.statusBarHeight + gap,
350
349
  width,
351
350
  }
352
351
  }
353
352
  const gap = rect.top - systemInfo.statusBarHeight
354
353
  systemInfo.navBarTopToStatusBar = gap
355
354
  systemInfo.navBarHeight = 2 * gap + rect.height
356
355
  systemInfo.capsulePosition = rect
357
356
  systemInfo.isIOS = isIOS
358
357
  systemInfo.isAndroid = isAndroid
359
358
  return systemInfo
360
359
  if (str.match(/^\/\//)) {
361
360
  str = 'https:' + str
362
361
  }
363
362
  return str
364
363
  dateTimeOrdate: Date | string | number | null,
365
364
  format = 'yyyy-MM-dd HH:mm:ss',
366
365
  noPadStart = {
367
366
  M: '0',
368
367
  d: '0',
369
368
  H: '0',
370
369
  m: '0',
371
370
  s: '0',
372
371
  },
373
372
  let dateResult = ''
374
373
  const padStarts = Object.assign(
375
374
  {
376
375
  M: '0',
377
376
  d: '0',
378
377
  H: '0',
379
378
  m: '0',
380
379
  s: '0',
381
380
  },
382
381
  noPadStart,
383
382
  )
384
383
  if (dateTimeOrdate) {
385
384
  let changeDateTimeOrdate = dateTimeOrdate
386
385
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
387
386
  if (getChangeDateTimeToNumber) {
388
387
  changeDateTimeOrdate = getChangeDateTimeToNumber
389
388
  } else {
390
389
  changeDateTimeOrdate = `${changeDateTimeOrdate}`
391
390
  .replace(/-/g, '/')
392
391
  .replace(/\./g, '/')
393
392
  }
394
393
  const nowDate =
395
394
  dateTimeOrdate instanceof Date
396
395
  ? dateTimeOrdate
397
396
  : new Date(changeDateTimeOrdate)
398
397
  const dateMap = {
399
398
  y: `${nowDate.getFullYear()}`,
400
399
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
401
400
  d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
402
401
  H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
403
402
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
404
403
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
405
404
  }
406
405
  const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
407
406
  const regYear = new RegExp('y')
408
407
  dateResult = format.replace(regDate, (v) => {
409
408
  let changeValue = v
410
409
  if (regYear.test(changeValue)) {
411
410
  const thisYear = dateMap.y
412
411
  const subValueLen = 4 - changeValue.length
413
412
  changeValue = thisYear.substr(subValueLen)
414
413
  } else {
415
414
  const dateKey = v.substr(0, 1)
416
415
  changeValue = dateMap[dateKey]
417
416
  }
418
417
  return changeValue
419
418
  })
420
419
  }
421
420
  return dateResult
422
421
  let timer: any = null
423
422
  let startTime = Date.now()
424
423
  return function () {
425
424
  const curTime = Date.now()
426
425
  const remaining = delay - (curTime - startTime)
427
426
  const context = this
428
427
  const args = arguments
429
428
  clearTimeout(timer)
430
429
  if (remaining <= 0) {
431
430
  func.apply(context, args)
432
431
  startTime = Date.now()
433
432
  } else {
434
433
  timer = setTimeout(func, remaining)
435
434
  }
436
435
  }
437
436
  let context, args, result
438
437
  let timeout = null
439
438
  let previous = 0
440
439
  if (!options) options = {}
441
440
  const later = function () {
442
441
  previous = options.leading === false ? 0 : Date.now()
443
442
  timeout = null
444
443
  result = func.apply(context, args)
445
444
  if (!timeout) context = args = null
446
445
  }
447
446
  return function () {
448
447
  const now = Date.now()
449
448
  if (!previous && options.leading === false) previous = now
450
449
  const remaining = wait - (now - previous)
451
450
  context = this
452
451
  args = arguments
453
452
  if (remaining <= 0 || remaining > wait) {
454
453
  if (timeout) {
455
454
  clearTimeout(timeout)
456
455
  timeout = null
457
456
  }
458
457
  previous = now
459
458
  result = func.apply(context, args)
460
459
  if (!timeout) context = args = null
461
460
  } else if (!timeout && options.trailing !== false) {
462
461
  timeout = setTimeout(later, remaining)
463
462
  }
464
463
  return result
465
464
  }
466
465
  let timer: any = null
467
466
  return function () {
468
467
  const context: any = this
469
468
  const args = arguments
470
469
  timer && clearTimeout(timer)
471
470
  timer = setTimeout(function () {
472
471
  fn.apply(context, args)
473
472
  }, delay)
474
473
  }
475
474
  if (txt) {
476
475
  txt = txt.trim()
477
476
  const reg = new RegExp(/[\d-]+/)
478
477
  const res = reg.exec(txt)
479
478
  if (res && res.length > 0) {
480
479
  let tel = res[0]
481
480
  if (tel && delSeparator) {
482
481
  tel = tel.replace(/-/g, '')
483
482
  }
484
483
  return tel
485
484
  }
486
485
  }
487
486
  return ''
488
487
  if (rgb) {
489
488
  const reg = /^(rgb|RGB)/
490
489
  const color = rgb
491
490
  if (reg.test(color)) {
492
491
  let strHex = '#'
493
492
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
494
493
  for (let i = 0; i < colorArr.length; i++) {
495
494
  let hex = Number(colorArr[i]).toString(16)
496
495
  if (hex === '0') {
497
496
  hex += hex
498
497
  }
499
498
  strHex += hex
500
499
  }
501
500
  return strHex
502
501
  } else {
503
502
  return String(color)
504
503
  }
505
504
  } else {
506
505
  return ''
507
506
  }
508
507
  if (hex) {
509
508
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
510
509
  let color = hex.toLowerCase()
511
510
  if (reg.test(color)) {
512
511
  if (color.length === 4) {
513
512
  let colorNew = '#'
514
513
  for (let i = 1; i < 4; i += 1) {
515
514
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
516
515
  }
517
516
  color = colorNew
518
517
  }
519
518
  const colorChange: number[] = []
520
519
  for (let i = 1; i < 7; i += 2) {
521
520
  colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
522
521
  }
523
522
  if (returnList) {
524
523
  return colorChange
525
524
  } else {
526
525
  return 'RGB(' + colorChange.join(',') + ')'
527
526
  }
528
527
  } else {
529
528
  return color
530
529
  }
531
530
  } else {
532
531
  return ''
533
532
  }
534
533
  n: number,
535
534
  m: number,
536
535
  filterNum: number | undefined = undefined,
537
536
  const c = m - n + 1
538
537
  const res = Math.floor(Math.random() * c + n)
539
538
  if (filterNum && filterNum == res) {
540
539
  console.log('随机数二次开始', res, filterNum)
541
540
  return getRandom(n, m, filterNum)
542
541
  } else {
543
542
  return res
544
543
  }
545
544
  wqCookieStr: string
546
545
  wqCookie: {
547
546
  pin?: string
548
547
  visitkey?: string
549
548
  [key: string]: any
550
549
  }
551
550
  const {
552
551
  jdpin,
553
552
  pinStatus,
554
553
  visitkey,
555
554
  unionid,
556
555
  skey,
557
556
  __jda,
558
557
  __jdv,
559
558
  __wga,
560
559
  wid,
561
560
  wq_skey,
562
561
  wq_uin,
563
562
  wq_auth_token,
564
563
  wxapp_scene,
565
564
  wq_unionid,
566
565
  wxapp_openid,
567
566
  wxapp_version,
568
567
  wxapp_type,
569
568
  appType,
570
569
  } = cookie
571
570
  const ret: string[] = []
572
571
  const getUserCookieObj = {}
573
572
  const createUseCookieArr = [
574
573
  jdpin,
575
574
  pinStatus,
576
575
  visitkey,
577
576
  unionid,
578
577
  skey,
579
578
  __jda,
580
579
  __jdv,
581
580
  __wga,
582
581
  wid,
583
582
  wq_skey,
584
583
  wq_uin,
585
584
  wq_auth_token,
586
585
  wxapp_scene,
587
586
  wq_unionid,
588
587
  wxapp_openid,
589
588
  wxapp_version,
590
589
  wxapp_type,
591
590
  appType,
592
591
  ]
593
592
  createUseCookieArr.forEach((keyItem) => {
594
593
  if (keyItem && keyItem['name']) {
595
594
  let { name, value } = keyItem
596
595
  name = name === 'jdpin' ? 'pin' : name
597
596
  name === 'pin' && ret.push(`pt_pin=${encodeURIComponent(value)}`)
598
597
  ret.push(`${name}=${encodeURIComponent(value)}`)
599
598
  getUserCookieObj[name] = value
600
599
  }
601
600
  })
602
601
  return {
603
602
  wqCookieStr: ret.join(';'),
604
603
  wqCookie: getUserCookieObj,
605
604
  }
606
605
  num,
607
606
  widthSize = 375,
608
607
  layoutWidth = windowWidth,
609
608
  const getNum = Number(num)
610
609
  return Math.round((getNum / widthSize) * layoutWidth)
611
610
  let checkState = false
612
611
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
613
612
  if (couponFloorModuleType === FloorModuleType.COUPON) {
614
613
  try {
615
614
  const dataDefines = getFloorDataToDataDefines(floorData)
616
615
  const couponDataDefine = dataDefines
617
616
  ? dataDefines.filter((item) => {
618
617
  return item.type === 'coupon'
619
618
  })
620
619
  : [],
621
620
  couponList = couponDataDefine[0]?.nodeText?.data
622
621
  ? couponDataDefine[0]?.nodeText?.data
623
622
  : [],
624
623
  couponLength = couponList.length,
625
624
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
626
625
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
627
626
  : 0
628
627
  if (numShowPerLine === 0 && couponLength > 3) {
629
628
  checkState = true
630
629
  }
631
630
  } catch (e) {
632
631
  checkState = false
633
632
  }
634
633
  return checkState
635
634
  }
636
635
  const {
637
636
  containers = [],
638
637
  floors = [],
639
638
  clearFirstContaierMarginTop = false,
640
639
  } = pageData
641
640
  console.log('dealShopContentData:', pageData, 'isvdev:', isvdev)
642
641
  const getThisTimeKey = Date.now()
643
642
  let shopContentContainerListData = containers?.filter(
644
643
  (item) => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
645
644
  )
646
645
  const shopContentFloorListData = floors?.filter(
647
646
  ({ floorPosition }) =>
648
647
  (!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') ||
649
648
  isvdev,
650
649
  )
651
650
  const unableIsvContainerListData = getUnableIsvContainerListData(
652
651
  shopContentFloorListData,
653
652
  shopContentContainerListData,
654
653
  exceptionReportFn,
655
654
  )
656
655
  shopContentContainerListData.forEach((item, index) => {
657
656
  item.key = `${getThisTimeKey + index}`
658
657
  item.floors = []
659
658
  item.includeUids &&
660
659
  item.includeUids.forEach((floorUid) => {
661
660
  const getFloorData = shopContentFloorListData.find(
662
661
  (floorItem) => floorItem.uid === floorUid,
663
662
  )
664
663
  if (getFloorData) {
665
664
  const changeFloorData = {
666
665
  containerId: item.containerId,
667
666
  containerIndex: index,
668
667
  ...getFloorData,
669
668
  }
670
669
  const getCheckMoreCouponState =
671
670
  checkCouponAndChangeContainerSetData(getFloorData)
672
671
  if (getCheckMoreCouponState) {
673
672
  item.marginLeft && (item.marginLeft = 0)
674
673
  item.marginRight && (item.marginRight = 0)
675
674
  item.borderRadius && (item.borderRadius = 0)
676
675
  }
677
676
  if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
678
677
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(
679
678
  getFloorData,
680
679
  exceptionReportFn,
681
680
  )
682
681
  !getSysFloorToLoadTypeRes &&
683
682
  (getFloorData.floorExtInfo.floorLoadWay = 1)
684
683
  }
685
684
  item.floors.push(changeFloorData)
686
685
  }
687
686
  })
688
687
  if (
689
688
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
690
689
  item?.containerPosition == 'content' &&
691
690
  item?.marginBottom > 0 &&
692
691
  !clearFirstContaierMarginTop
693
692
  ) {
694
693
  item.marginTop = item.marginBottom
695
694
  }
696
695
  })
697
696
  shopContentContainerListData = shopContentContainerListData.filter(
698
697
  (item) =>
699
698
  item.floors.length > 0 &&
700
699
  unableIsvContainerListData.every(
701
700
  (containerItem) => containerItem.containerId != item.containerId,
702
701
  ),
703
702
  )
704
703
  console.log(
705
704
  'dealShopContentData isWxMinAndWxapp:',
706
705
  isWxMinAndWxapp,
707
706
  'weappJumpToH5:',
708
707
  pageData?.homeExtInfo?.weappJumpToH5,
709
708
  )
710
709
  if (isProd && isWxMinAndWxapp) {
711
710
  shopContentContainerListData = shopContentContainerListData.filter(
712
711
  (item) =>
713
712
  item.floors.length > 0 &&
714
713
  !isIsvContainer(
715
714
  item.containerId,
716
715
  shopContentFloorListData,
717
716
  shopContentContainerListData,
718
717
  ),
719
718
  )
720
719
  }
721
720
  shopContentContainerListData = [].concat(shopContentContainerListData)
722
721
  return {
723
722
  shopContentContainerListData,
724
723
  shopContentFloorListData,
725
724
  }
726
725
  const changeOpts = {
727
726
  title: '',
728
727
  icon: 'success',
729
728
  duration: 1500,
730
729
  mask: true,
731
730
  ...options,
732
731
  }
733
732
  if (changeOpts.title.length > 7) {
734
733
  showNormalToast(options)
735
734
  } else {
736
735
  Taro.showToast(changeOpts as any)
737
736
  }
738
737
  const changeOpts = {
739
738
  title: '',
740
739
  icon: 'error',
741
740
  duration: 1500,
742
741
  mask: true,
743
742
  ...options,
744
743
  }
745
744
  if (changeOpts.title.length > 7) {
746
745
  showNormalToast(options)
747
746
  } else {
748
747
  Taro.showToast(changeOpts as any)
749
748
  }
750
749
  Taro.showToast({
751
750
  title: '',
752
751
  icon: 'none',
753
752
  duration: 1500,
754
753
  mask: true,
755
754
  ...options,
756
755
  })
757
756
  return Taro.showLoading({
758
757
  title: text,
759
758
  })
760
759
  return new Promise(() => {
761
760
  Taro.nextTick(() => {
762
761
  setTimeout(() => {
763
762
  Taro.hideLoading(options)
764
763
  }, 300)
765
764
  })
766
765
  })
767
766
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
768
767
  const {
769
768
  tabActive = SECTION_HOME_TAB_NAME_TYPE[
770
769
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
771
770
  ],
772
771
  sceneId,
773
772
  } = query
774
773
  let changeTabActive = tabActive
775
774
  if (sceneId) {
776
775
  if (isH5) {
777
776
  if (sceneId == '1002') {
778
777
  changeTabActive =
779
778
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
780
779
  }
781
780
  else if (sceneId == '1003') {
782
781
  changeTabActive =
783
782
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
784
783
  }
785
784
  } else if (isWxMinAndWxapp) {
786
785
  if (sceneId == '1001' || sceneId == '1002') {
787
786
  changeTabActive =
788
787
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
789
788
  }
790
789
  else if (sceneId == '1003') {
791
790
  changeTabActive =
792
791
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
793
792
  }
794
793
  }
795
794
  }
796
795
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
797
796
  return {
798
797
  menuType: SHOP_MENU_ID_TYPE.HOME,
799
798
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
800
799
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
801
800
  }
802
801
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
803
802
  return {
804
803
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
805
804
  tabActiveType: 0,
806
805
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
807
806
  }
808
807
  } else {
809
808
  return {
810
809
  menuType: SHOP_MENU_ID_TYPE.HOME,
811
810
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
812
811
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
813
812
  }
814
813
  }
815
814
  const deleteKeyList = [
816
815
  '$taroTimestamp',
817
816
  'cookie',
818
817
  'wdref',
819
818
  'navStart',
820
819
  'originOpts',
821
820
  'originParams',
822
821
  'originUrl',
823
822
  'referer',
824
823
  'stamp',
825
824
  'hybrid',
826
825
  'sr',
827
826
  'navh',
828
827
  'stath',
829
828
  ]
830
829
  let changeQueryData: any = { ...queryData }
831
830
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
832
831
  const sceneQuery =
833
832
  qrCodeScene && typeof qrCodeScene === 'string'
834
833
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
835
834
  : {}
836
835
  changeQueryData = { ...changeQueryData, ...sceneQuery }
837
836
  deleteKeyList.forEach((key) => {
838
837
  changeQueryData[key] && delete changeQueryData[key]
839
838
  })
840
839
  changeQueryData['shopid'] &&
841
840
  (changeQueryData['shopId'] = changeQueryData['shopid']) &&
842
841
  delete changeQueryData['shopid']
843
842
  changeQueryData['venderid'] &&
844
843
  (changeQueryData['venderId'] = changeQueryData['venderid']) &&
845
844
  delete changeQueryData['venderid']
846
845
  changeQueryData['vendorId'] &&
847
846
  (changeQueryData['venderId'] = changeQueryData['vendorId']) &&
848
847
  delete changeQueryData['vendorId']
849
848
  changeQueryData['shopId'] &&
850
849
  changeQueryData['shopId'] === 'undefined' &&
851
850
  delete changeQueryData['shopId']
852
851
  changeQueryData['venderId'] &&
853
852
  changeQueryData['venderId'] === 'undefined' &&
854
853
  delete changeQueryData['venderId']
855
854
  return changeQueryData
856
855
  let isUsable = false
857
856
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
858
857
  const modularPackResultObj = formatPackResult(modularPackResult)
859
858
  const bundleUrl = getBundleUrl(modularPackResultObj)
860
859
  const bundleFileName = getBundleFileName(modularPackResultObj)
861
860
  const taroVersion = getTaroVersion(modularPackResultObj)
862
861
  if (bundleUrl && bundleFileName) {
863
862
  isUsable = true
864
863
  }
865
864
  if (!isUsable && typeof exceptionReportFn === 'function') {
866
865
  exceptionReportFn({
867
866
  code: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${
868
867
  floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE
869
868
  ? SgmCustomCode.SYSTEMPDCMODULE_DATA
870
869
  : SgmCustomCode.REMOTEMODULE_DATA
871
870
  }`,
872
871
  msg: {
873
872
  msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
874
873
  floorIdx: floorData?.floorIdx,
875
874
  uid: floorData?.uid,
876
875
  shopId: floorData?.floorExtInfo?.shopId,
877
876
  moduleId: floorData?.moduleId,
878
877
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
879
878
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
880
879
  floorKind: floorData?.floorExtInfo?.floorKind,
881
880
  middleTemplateId: floorData?.middleTemplateId,
882
881
  modularPackResult: {
883
882
  bundleUrl,
884
883
  taroVersion,
885
884
  },
886
885
  },
887
886
  })
888
887
  }
889
888
  return isUsable
890
889
  const objContainer = containerListData.find(
891
890
  (item) => item.containerId === containerId,
892
891
  )
893
892
  return (
894
893
  objContainer?.includeUids?.some((itemUid) => {
895
894
  const objectFloor = floorListData.find(
896
895
  (floorItem) => itemUid === floorItem.uid,
897
896
  )
898
897
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
899
898
  }) ?? false
900
899
  )
901
900
  floorListData,
902
901
  containerListData,
903
902
  exceptionReportFn?,
904
903
  const unableIsvFloorListData = floorListData.filter(
905
904
  (floorItem) =>
906
905
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
907
906
  !isIsvFloorUseable(floorItem, exceptionReportFn),
908
907
  )
909
908
  const unableIsvFloorUidList = unableIsvFloorListData.map(
910
909
  (floorItem) => floorItem.uid,
911
910
  )
912
911
  const unableIsvContainerListData = containerListData.filter(
913
912
  (item) =>
914
913
  item.includeUids &&
915
914
  item.includeUids.every(
916
915
  (itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1,
917
916
  ),
918
917
  )
919
918
  return unableIsvContainerListData
920
919
  return -2
921
920
  return customObj
922
921
  return customObj
923
922
  return customObj
924
923
  return customObj
925
924
  return customObj
926
925
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl)
927
926
  let getParams = false
928
927
  if (isOpenJdAppUrl(openAppUrl)) {
929
928
  try {
930
929
  getParams = openAppUrl.replace(
931
930
  /openApp\.jdMobile:\/\/virtual\?params=/i,
932
931
  '',
933
932
  )
934
933
  getParams = JSON.parse(String(getParams))
935
934
  } catch (e) {
936
935
  console.log(e)
937
936
  }
938
937
  }
939
938
  return getParams
940
939
  const getLastParams = Object.assign({}, openParams)
941
940
  return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`
942
941
  if (val === null || val === '' || typeof val === 'undefined') {
943
942
  return true
944
943
  }
945
944
  return false
946
945
  const {
947
946
  moduleId = 'none',
948
947
  entrance = 'none',
949
948
  sourceType = 'none',
950
949
  sourceValue = 'none',
951
950
  } = params
952
951
  if (isIosDevice) {
953
952
  return `${moduleId}#${entrance}`
954
953
  } else if (isAndroidDevice) {
955
954
  return `${sourceType}#${sourceValue}`
956
955
  }
957
956
  return 'none#none'
958
957
  if (data && typeof data === 'object') {
959
958
  let getOpenAppData = { ...data }
960
959
  try {
961
960
  const { sourceInfo, designerId, templateId, source } = getOpenAppData
962
961
  if (designerId && templateId) {
963
962
  getOpenAppData = Object.assign({}, getOpenAppData, {
964
963
  sourceInfo: {
965
964
  entrance: '设计师预览',
966
965
  },
967
966
  })
968
967
  } else if (sourceInfo) {
969
968
  const { entrance } = sourceInfo
970
969
  getOpenAppData.sourceInfo.entrance =
971
970
  entrance && entrance.length > 0 ? entrance : '其他'
972
971
  } else if (source && !sourceInfo) {
973
972
  if (typeof source === 'object') {
974
973
  const { sourceType, entrance, sourceValue, moduleId } = source
975
974
  getOpenAppData = Object.assign({}, getOpenAppData, {
976
975
  sourceInfo: {
977
976
  entrance: sourceType || entrance || '其他',
978
977
  moduleId: sourceValue || moduleId || '-100',
979
978
  },
980
979
  })
981
980
  } else {
982
981
  getOpenAppData = Object.assign({}, getOpenAppData, {
983
982
  sourceInfo: {
984
983
  entrance: source,
985
984
  },
986
985
  })
987
986
  }
988
987
  } else {
989
988
  getOpenAppData = Object.assign({}, getOpenAppData, {
990
989
  sourceInfo: {
991
990
  entrance: '其他',
992
991
  },
993
992
  })
994
993
  }
995
994
  } catch (e) {
996
995
  console.log(e)
997
996
  }
998
997
  return getOpenAppData
999
998
  }
1000
999
  return data
1001
1000
  return displayObj
1002
1001
  if (typeof input === 'string') {
1003
1002
  try {
1004
1003
  return JSON.parse(input)
1005
1004
  } catch (e) {
1006
1005
  console.error('JSON解析失败', e)
1007
1006
  return {}
1008
1007
  }
1009
1008
  }
1010
1009
  return input || {}
1011
1010
  return false
1012
1011
  const borderStyle: { [key: string]: any } = {}
1013
1012
  if (item?.borderRadius) {
1014
1013
  let borderTopRadius = 0
1015
1014
  let borderBottomRadius = 0
1016
1015
  if (index === 0) {
1017
1016
  borderTopRadius = item.borderRadius
1018
1017
  borderBottomRadius =
1019
1018
  floorDataLen === 1 || item?.marginBottom !== 0 ? item.borderRadius : 0
1020
1019
  } else if (index === floorDataLen - 1) {
1021
1020
  borderTopRadius =
1022
1021
  floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius
1023
1022
  borderBottomRadius = item.borderRadius
1024
1023
  } else {
1025
1024
  borderTopRadius =
1026
1025
  floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius
1027
1026
  borderBottomRadius = item?.marginBottom === 0 ? 0 : item.borderRadius
1028
1027
  }
1029
1028
  borderStyle.borderTopLeftRadius = item?.borderTopLeftRadius
1030
1029
  ? `${item?.borderTopLeftRadius}px`
1031
1030
  : `${borderTopRadius}px`
1032
1031
  borderStyle.borderTopRightRadius = item?.borderTopRightRadius
1033
1032
  ? `${item?.borderTopRightRadius}px`
1034
1033
  : `${borderTopRadius}px`
1035
1034
  borderStyle.borderBottomLeftRadius = `${borderBottomRadius}px`
1036
1035
  borderStyle.borderBottomRightRadius = `${borderBottomRadius}px`
1037
1036
  } else {
1038
1037
  borderStyle.borderTopLeftRadius = borderStyle?.borderTopLeftRadius || '0px'
1039
1038
  borderStyle.borderTopRightRadius =
1040
1039
  borderStyle?.borderTopRightRadius || '0px'
1041
1040
  borderStyle.borderBottomRightRadius =
1042
1041
  borderStyle?.borderBottomRightRadius || '0px'
1043
1042
  borderStyle.borderBottomLeftRadius =
1044
1043
  borderStyle?.borderBottomLeftRadius || '0px'
1045
1044
  }
1046
1045
  return borderStyle
1047
1046
  isJdApp,
1048
1047
  isWxApp,
1049
1048
  isIosDevice,
1050
1049
  isAndroidDevice,
1051
1050
  isJdAndIosDevice,
1052
1051
  isJdAndAndroidDevice,
1053
1052
  isWxMin,
1054
1053
  isWxMinAndWxapp,
1055
1054
  isJdMin,
1056
1055
  isMin,
1057
1056
  isJdMinAndHarmony,
1058
1057
  isH5,
1059
1058
  isH5AndJdShopView,
1060
1059
  isImageOptimizeEnable,
1061
1060
  isChartH5,
1062
1061
  isH5AndJdShopViewNativeScroll,
1063
1062
  isH5AndJdShopViewH5Scroll,
1064
1063
  isH5AndJdShopH5CustomScrollView,
1065
1064
  isWxMiniH5View,
1066
1065
  sliceArrToChunkList,
1067
1066
  dealAddress,
1068
1067
  objectToUrlEncode,
1069
1068
  parseQueryUrlString,
1070
1069
  setLowSmallPicUrl,
1071
1070
  getJfsImage,
1072
1071
  getQualityImage,
1073
1072
  countStringify,
1074
1073
  setTaroStorage,
1075
1074
  getTaroStorageKeyValue,
1076
1075
  removeTaroStorageKey,
1077
1076
  clearTaroStorageKey,
1078
1077
  getSystemInfos,
1079
1078
  addHttps,
1080
1079
  dateFormat,
1081
1080
  throttle,
1082
1081
  lodashThrottle,
1083
1082
  debounce,
1084
1083
  getTelephone,
1085
1084
  rgbToHex,
1086
1085
  hexToRgb,
1087
1086
  getRandom,
1088
1087
  getWxAppCookieStr,
1089
1088
  pxTransformFromData,
1090
1089
  dealShopContentData,
1091
1090
  showSuccessToast,
1092
1091
  showFailToast,
1093
1092
  showNormalToast,
1094
1093
  showShopLoading,
1095
1094
  hideShopLoading,
1096
1095
  getAppChannelType,
1097
1096
  formatTabActiveMenuType,
1098
1097
  filterUrlQueryData,
1099
1098
  getAvifSupport,
1100
1099
  getWebpSupport,
1101
1100
  isMemberPage,
1102
1101
  sgmCustomReport,
1103
1102
  draCustomReport,
1104
1103
  remoteCustomReport,
1105
1104
  draInterfaceCustomReport,
1106
1105
  draBusinessCustomReport,
1107
1106
  isOpenJdAppUrl,
1108
1107
  jdOpenAppParams,
1109
1108
  createJdOpenAppUrl,
1110
1109
  dealJdOpenAppData,
1111
1110
  isEmpty,
1112
1111
  getJdAppReportPageSource,
1113
1112
  isAppClassifyPage,
1114
1113
  getQualityImageNew,
1115
1114
  getQualityImageOld,
1116
1115
  isPc,
1117
1116
  ipLoc_djd,
1118
1117
  jdAppVersionCompare,
1119
1118
  dealNativePixelToCssPixel,
1120
1119
  isAppStowShop,
1121
1120
  isIpadDevice,
1122
1121
  getBorderStyle,
1123
1122
  isLanguageForEn,
1123
+ import Taro from '@tarojs/taro';
1124
1124
  SHOP_MENU_ID_TYPE,
1125
1125
  SHOP_MENU_ID_QUERY_NAME,
1126
1126
  SECTION_HOME_TAB_TYPE,
1127
1127
  SECTION_HOME_TAB_NAME_TYPE,
1128
1128
  SECTION_HOME_TAB_QUERY_TYPE,
1129
1129
  CHANNEL_TYPE,
1130
1130
  JDShopViewBusinessPathType,
1131
1131
  FloorModuleType,
1132
1132
  RemoteLoadFloorList,
1133
1133
  FLOOR_KIND,
1134
1134
  getBundleUrl,
1135
1135
  getBundleFileName,
1136
1136
  formatPackResult,
1137
1137
  getTaroVersion,
1138
1138
  key: string,
1139
1139
  value: string | object,
1140
1140
  successBack?: any,
1141
1141
  failBack?: any,
1142
1142
  try{
1143
1143
  if(isH5 && window && !window.localStorage){
1144
1144
  console.log(`setTaroStorage key:${key} window.localStorage不存在:`);
1145
1145
  return Promise.resolve(null);
1146
1146
  }
1147
1147
  return Taro.setStorage({
1148
1148
  key: key,
1149
1149
  data: value,
1150
1150
  success: successBack,
1151
1151
  fail: failBack,
1152
1152
  }).catch((e) => {
1153
1153
  console.log(`setTaroStorage key:${key} 报错:`, e);
1154
1154
  return null;
1155
1155
  });
1156
1156
  }
1157
1157
  catch(e){
1158
1158
  console.log(`setTaroStorage key:${key} 报错:`, e)
1159
1159
  return Promise.resolve(null)
1160
1160
  }
1161
1161
  try {
1162
1162
  if (isH5 && window && !window.localStorage) {
1163
1163
  console.log(`getTaroStorageKeyValue key:${key} window.localStorage不存在:`);
1164
1164
  return Promise.resolve(null);
1165
1165
  }
1166
1166
  return Taro.getStorageSync(key);
1167
1167
  } catch (e) {
1168
1168
  console.log(`getTaroStorageKeyValue key:${key} 报错:`, e);
1169
1169
  return null;
1170
1170
  }
1171
1171
  try {
1172
1172
  if (isH5 && window && !window.localStorage) {
1173
1173
  console.log(`removeTaroStorageKey key:${key} window.localStorage不存在:`);
1174
1174
  return Promise.resolve(null);
1175
1175
  }
1176
1176
  return Taro.removeStorage({
1177
1177
  key: key,
1178
1178
  }).catch((e) => {
1179
1179
  console.log(`removeTaroStorageKey key:${key} 报错:`, e);
1180
1180
  });
1181
1181
  } catch (e) {
1182
1182
  console.log(`removeTaroStorageKey key:${key} 报错:`, e);
1183
1183
  }
1184
1184
  try {
1185
1185
  if (isH5 && window && !window.localStorage) {
1186
1186
  console.log(`clearTaroStorageKey window.localStorage不存在`);
1187
1187
  return Promise.resolve(null);
1188
1188
  }
1189
1189
  return Taro.clearStorage().catch((e) => {
1190
1190
  console.log('clearTaroStorageKey报错:', e);
1191
1191
  });
1192
1192
  } catch (e) {
1193
1193
  console.log('clearTaroStorageKey报错:', e);
1194
1194
  }
1195
1195
  let hasChecked = false;
1196
1196
  if (isH5) {
1197
1197
  const avifCache = getTaroStorageKeyValue(KEY_AVIF);
1198
1198
  if (avifCache === null || avifCache === '' || forceUpdate) {
1199
1199
  hasChecked = true;
1200
1200
  const img = new Image();
1201
1201
  img.onload = function () {
1202
1202
  if (img.height > 0 && img.width > 0) {
1203
1203
  setTaroStorage(KEY_AVIF, '1');
1204
1204
  } else {
1205
1205
  setTaroStorage(KEY_AVIF, '0');
1206
1206
  }
1207
1207
  };
1208
1208
  img.onerror = () => {
1209
1209
  setTaroStorage(KEY_AVIF, '0');
1210
1210
  };
1211
1211
  img.src =
1212
1212
  'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
1213
1213
  }
1214
1214
  const webpCache = getTaroStorageKeyValue(KEY_WEBP);
1215
1215
  if (webpCache === null || webpCache === '' || forceUpdate) {
1216
1216
  hasChecked = true;
1217
1217
  const img = new Image();
1218
1218
  img.onload = function () {
1219
1219
  if (img.height > 0 && img.width > 0) {
1220
1220
  setTaroStorage(KEY_WEBP, '1');
1221
1221
  } else {
1222
1222
  setTaroStorage(KEY_WEBP, '0');
1223
1223
  }
1224
1224
  };
1225
1225
  img.onerror = () => {
1226
1226
  setTaroStorage(KEY_WEBP, '0');
1227
1227
  };
1228
1228
  img.src =
1229
1229
  'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA=';
1230
1230
  }
1231
1231
  }
1232
1232
  return hasChecked;
1233
1233
  const hasChecked = imageFormatSupport(false);
1234
1234
  if (!hasChecked) {
1235
1235
  setTimeout(imageFormatSupport, 5000);
1236
1236
  }
1237
1237
  const resultList: Array<any> = [],
1238
1238
  arrLen = arr.length;
1239
1239
  if (arrLen) {
1240
1240
  if (arrLen > size) {
1241
1241
  for (let i = 0; i < arrLen; i = i + size) {
1242
1242
  resultList.push(arr.slice(i, i + size));
1243
1243
  }
1244
1244
  } else {
1245
1245
  resultList.push(arr);
1246
1246
  }
1247
1247
  }
1248
1248
  return resultList;
1249
1249
  let _address = ids;
1250
1250
  const _areaAreaSplit = ids.split('.');
1251
1251
  const _areaAreaSplit2 = ids.split('_');
1252
1252
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
1253
1253
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
1254
1254
  return _address;
1255
1255
  let paramStr = '';
1256
1256
  obj &&
1257
1257
  Object.keys(obj).forEach((key, index) => {
1258
1258
  const getValue = `${obj[key]}`.replace(/undefined/, '').replace(/null/, '');
1259
1259
  paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`;
1260
1260
  });
1261
1261
  return paramStr;
1262
1262
  const result = {};
1263
1263
  if (
1264
1264
  !urlOrQueryStr ||
1265
1265
  ('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
1266
1266
  ) {
1267
1267
  return result;
1268
1268
  }
1269
1269
  if (urlOrQueryStr.indexOf('?') > -1) {
1270
1270
  const queryStr = urlOrQueryStr.split('?');
1271
1271
  const queryItemList = queryStr && queryStr.length > 1 ? queryStr[1].split('&') : [];
1272
1272
  const queryItemListLen = queryItemList.length;
1273
1273
  queryItemListLen > 0 &&
1274
1274
  queryItemList.forEach((item) => {
1275
1275
  const thisItemList = item.split('=');
1276
1276
  result[thisItemList[0]] = thisItemList[1];
1277
1277
  });
1278
1278
  } else {
1279
1279
  const queryItemList =
1280
1280
  urlOrQueryStr.indexOf('&') > -1 ? urlOrQueryStr.split('&') : [urlOrQueryStr];
1281
1281
  const queryItemListLen = queryItemList.length;
1282
1282
  queryItemListLen > 0 &&
1283
1283
  queryItemList.forEach((item) => {
1284
1284
  const thisItemList = item.split('=');
1285
1285
  result[thisItemList[0]] = thisItemList[1];
1286
1286
  });
1287
1287
  }
1288
1288
  return result;
1289
1289
  url: string,
1290
1290
  size?: {
1291
1291
  w: number;
1292
1292
  h: number;
1293
1293
  },
1294
1294
  quality?: number,
1295
1295
  if (url && size) {
1296
1296
  const _w = Math.floor(size.w);
1297
1297
  const _h = Math.floor(size.h);
1298
1298
  if (url.match(/gif$/i)) {
1299
1299
  return url;
1300
1300
  } else {
1301
1301
  if (_w > 0 && _h > 0) {
1302
1302
  url = url.replace('jfs/', `s${_w}x${_h}_jfs/`);
1303
1303
  }
1304
1304
  url += quality != null ? `!q${quality}.dpg` : '.dpg';
1305
1305
  }
1306
1306
  }
1307
1307
  return url;
1308
1308
  if (url.match(/\.(jpg|png|dpg)$/i)) {
1309
1309
  const { width, height, quality } = jfsImgInfo;
1310
1310
  if (typeof width === 'number' || typeof height === 'number') {
1311
1311
  url = url.replace('/jfs/', `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`);
1312
1312
  }
1313
1313
  if (typeof quality === 'number' && quality > 0 && quality < 100 && url.match(/\.jpg$/i)) {
1314
1314
  url += `!q${quality}.dpg`;
1315
1315
  }
1316
1316
  }
1317
1317
  return addHttps(url);
1318
1318
  if (imgUrl) {
1319
1319
  if (
1320
1320
  !imgUrl.match(
1321
1321
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
1322
1322
  )
1323
1323
  ) {
1324
1324
  if (!imgUrl.includes('360buyimg.com')) {
1325
1325
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
1326
1326
  }
1327
1327
  if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
1328
1328
  }
1329
1329
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
1330
1330
  }
1331
1331
  return imgUrl;
1332
1332
  const result = value % step;
1333
1333
  return result === 0 ? value : Math.ceil(value / step) * step;
1334
1334
  const MAX = 3.5;
1335
1335
  return Math.min(window?.devicePixelRatio ?? 2, MAX);
1336
1336
  isSkuImage: boolean;
1337
1337
  size: number;
1338
1338
  imgUrl: string,
1339
1339
  options: QualityOptions,
1340
1340
  isIgnoreOptimizeFromServer: boolean = false,
1341
1341
  if (!imgUrl) {
1342
1342
  console.error('The input parameter imageUrl for the getQualityImage() cannot be empty!');
1343
1343
  return imgUrl;
1344
1344
  }
1345
1345
  if (isIgnoreOptimizeFromServer) {
1346
1346
  imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1');
1347
1347
  }
1348
1348
  if (!/^((https?):)?\/\//.test(imgUrl)) {
1349
1349
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
1350
1350
  }
1351
1351
  const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i;
1352
1352
  if (!imgServerRegExp.test(imgUrl)) {
1353
1353
  return imgUrl;
1354
1354
  }
1355
1355
  imgUrl = /^\/\//.test(imgUrl) ? `https:${imgUrl}` : imgUrl;
1356
1356
  const { isSkuImage, size } = options || {};
1357
1357
  const needReduceSize = isSkuImage && size;
1358
1358
  if (needReduceSize) {
1359
1359
  const devicePixelRatio = getDevicePixelRatio();
1360
1360
  const useWidth = getValueByStep(size * devicePixelRatio, 40);
1361
1361
  imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useWidth}_jfs/`);
1362
1362
  }
1363
1363
  const needCompress = !global?.info?.pageInfo?.isVipShop;
1364
1364
  const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/);
1365
1365
  if (needCompress && result) {
1366
1366
  if (getAvifSupport() === '1') {
1367
1367
  imgUrl += '.avif';
1368
1368
  } else if (getWebpSupport() === '1') {
1369
1369
  imgUrl += '.webp';
1370
1370
  } else if (/jpe?g/.test(result[1])) {
1371
1371
  imgUrl += '!q80';
1372
1372
  }
1373
1373
  }
1374
1374
  if (needReduceSize) {
1375
1375
  imgUrl += '!z2';
1376
1376
  }
1377
1377
  return imgUrl;
1378
1378
  if (imgUrl) {
1379
1379
  if (
1380
1380
  !imgUrl.match(
1381
1381
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
1382
1382
  )
1383
1383
  ) {
1384
1384
  if (!imgUrl.includes('360buyimg.com')) {
1385
1385
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
1386
1386
  }
1387
1387
  if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
1388
1388
  }
1389
1389
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
1390
1390
  }
1391
1391
  return imgUrl;
1392
1392
  return getTaroStorageKeyValue(KEY_AVIF) || '0';
1393
1393
  return getTaroStorageKeyValue(KEY_WEBP) || '0';
1394
1394
  count: number,
1395
1395
  fixedNum = 1,
1396
1396
  unit = '万',
1397
1397
  maxNum = 10000,
1398
1398
  count = Number(count);
1399
1399
  const getMaxNum = count > 100000000 ? 100000000 : maxNum;
1400
1400
  const getUnit = count > 100000000 ? '亿' : unit;
1401
1401
  if (count >= getMaxNum) {
1402
1402
  return (count / getMaxNum).toFixed(fixedNum) + getUnit;
1403
1403
  }
1404
1404
  return count;
1405
1405
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
1406
1406
  platform: '',
1407
1407
  model: '',
1408
1408
  system: '',
1409
1409
  };
1410
1410
  const isIOS = !!systemInfo.system.match(/ios/i);
1411
1411
  const isAndroid = !!systemInfo.system.match(/android/i);
1412
1412
  if (!systemInfo.statusBarHeight) {
1413
1413
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20;
1414
1414
  systemInfo.navBarExtendHeight = 0;
1415
1415
  } else {
1416
1416
  if (isIOS) {
1417
1417
  systemInfo.navBarExtendHeight = 4;
1418
1418
  } else {
1419
1419
  systemInfo.navBarExtendHeight = 0;
1420
1420
  }
1421
1421
  }
1422
1422
  let rect = Taro.getMenuButtonBoundingClientRect ? Taro.getMenuButtonBoundingClientRect() : null;
1423
1423
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
1424
1424
  let gap = 0;
1425
1425
  let width = 96;
1426
1426
  if (systemInfo.platform === 'android') {
1427
1427
  gap = 8;
1428
1428
  width = 96;
1429
1429
  } else if (systemInfo.platform === 'devtools') {
1430
1430
  if (isIOS) {
1431
1431
  gap = 5.5;
1432
1432
  } else {
1433
1433
  gap = 7.5;
1434
1434
  }
1435
1435
  } else {
1436
1436
  gap = 4;
1437
1437
  width = 88;
1438
1438
  }
1439
1439
  rect = {
1440
1440
  bottom: systemInfo.statusBarHeight + gap + 32,
1441
1441
  height: 32,
1442
1442
  left: systemInfo.windowWidth - width - 10,
1443
1443
  right: systemInfo.windowWidth - 10,
1444
1444
  top: systemInfo.statusBarHeight + gap,
1445
1445
  width,
1446
1446
  };
1447
1447
  }
1448
1448
  const gap = rect.top - systemInfo.statusBarHeight;
1449
1449
  systemInfo.navBarTopToStatusBar = gap;
1450
1450
  systemInfo.navBarHeight = 2 * gap + rect.height;
1451
1451
  systemInfo.capsulePosition = rect;
1452
1452
  systemInfo.isIOS = isIOS;
1453
1453
  systemInfo.isAndroid = isAndroid;
1454
1454
  return systemInfo;
1455
1455
  if (str.match(/^\/\//)) {
1456
1456
  str = 'https:' + str;
1457
1457
  }
1458
1458
  return str;
1459
1459
  dateTimeOrdate: Date | string | number | null,
1460
1460
  format = 'yyyy-MM-dd HH:mm:ss',
1461
1461
  noPadStart = {
1462
1462
  M: '0',
1463
1463
  d: '0',
1464
1464
  H: '0',
1465
1465
  m: '0',
1466
1466
  s: '0',
1467
1467
  },
1468
1468
  let dateResult = '';
1469
1469
  const padStarts = Object.assign(
1470
1470
  {
1471
1471
  M: '0',
1472
1472
  d: '0',
1473
1473
  H: '0',
1474
1474
  m: '0',
1475
1475
  s: '0',
1476
1476
  },
1477
1477
  noPadStart,
1478
1478
  );
1479
1479
  if (dateTimeOrdate) {
1480
1480
  let changeDateTimeOrdate = dateTimeOrdate;
1481
1481
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
1482
1482
  if (getChangeDateTimeToNumber) {
1483
1483
  changeDateTimeOrdate = getChangeDateTimeToNumber;
1484
1484
  } else {
1485
1485
  changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/').replace(/\./g, '/');
1486
1486
  }
1487
1487
  const nowDate =
1488
1488
  dateTimeOrdate instanceof Date ? dateTimeOrdate : new Date(changeDateTimeOrdate);
1489
1489
  const dateMap = {
1490
1490
  y: `${nowDate.getFullYear()}`,
1491
1491
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
1492
1492
  d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
1493
1493
  H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
1494
1494
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
1495
1495
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
1496
1496
  };
1497
1497
  const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g');
1498
1498
  const regYear = new RegExp('y');
1499
1499
  dateResult = format.replace(regDate, (v) => {
1500
1500
  let changeValue = v;
1501
1501
  if (regYear.test(changeValue)) {
1502
1502
  const thisYear = dateMap.y;
1503
1503
  const subValueLen = 4 - changeValue.length;
1504
1504
  changeValue = thisYear.substr(subValueLen);
1505
1505
  } else {
1506
1506
  const dateKey = v.substr(0, 1);
1507
1507
  changeValue = dateMap[dateKey];
1508
1508
  }
1509
1509
  return changeValue;
1510
1510
  });
1511
1511
  }
1512
1512
  return dateResult;
1513
1513
  let timer: any = null;
1514
1514
  let startTime = Date.now();
1515
1515
  return function () {
1516
1516
  const curTime = Date.now();
1517
1517
  const remaining = delay - (curTime - startTime);
1518
1518
  const context = this;
1519
1519
  const args = arguments;
1520
1520
  clearTimeout(timer);
1521
1521
  if (remaining <= 0) {
1522
1522
  func.apply(context, args);
1523
1523
  startTime = Date.now();
1524
1524
  } else {
1525
1525
  timer = setTimeout(func, remaining);
1526
1526
  }
1527
1527
  };
1528
1528
  let context, args, result;
1529
1529
  let timeout = null;
1530
1530
  let previous = 0;
1531
1531
  if (!options) options = {};
1532
1532
  const later = function () {
1533
1533
  previous = options.leading === false ? 0 : Date.now();
1534
1534
  timeout = null;
1535
1535
  result = func.apply(context, args);
1536
1536
  if (!timeout) context = args = null;
1537
1537
  };
1538
1538
  return function () {
1539
1539
  const now = Date.now();
1540
1540
  if (!previous && options.leading === false) previous = now;
1541
1541
  const remaining = wait - (now - previous);
1542
1542
  context = this;
1543
1543
  args = arguments;
1544
1544
  if (remaining <= 0 || remaining > wait) {
1545
1545
  if (timeout) {
1546
1546
  clearTimeout(timeout);
1547
1547
  timeout = null;
1548
1548
  }
1549
1549
  previous = now;
1550
1550
  result = func.apply(context, args);
1551
1551
  if (!timeout) context = args = null;
1552
1552
  } else if (!timeout && options.trailing !== false) {
1553
1553
  timeout = setTimeout(later, remaining);
1554
1554
  }
1555
1555
  return result;
1556
1556
  };
1557
1557
  let timer: any = null;
1558
1558
  return function () {
1559
1559
  const context: any = this;
1560
1560
  const args = arguments;
1561
1561
  timer && clearTimeout(timer);
1562
1562
  timer = setTimeout(function () {
1563
1563
  fn.apply(context, args);
1564
1564
  }, delay);
1565
1565
  };
1566
1566
  if (txt) {
1567
1567
  txt = txt.trim();
1568
1568
  const reg = new RegExp(/[\d-]+/);
1569
1569
  const res = reg.exec(txt);
1570
1570
  if (res && res.length > 0) {
1571
1571
  let tel = res[0];
1572
1572
  if (tel && delSeparator) {
1573
1573
  tel = tel.replace(/-/g, '');
1574
1574
  }
1575
1575
  return tel;
1576
1576
  }
1577
1577
  }
1578
1578
  return '';
1579
1579
  if (rgb) {
1580
1580
  const reg = /^(rgb|RGB)/;
1581
1581
  const color = rgb;
1582
1582
  if (reg.test(color)) {
1583
1583
  let strHex = '#';
1584
1584
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
1585
1585
  for (let i = 0; i < colorArr.length; i++) {
1586
1586
  let hex = Number(colorArr[i]).toString(16);
1587
1587
  if (hex === '0') {
1588
1588
  hex += hex;
1589
1589
  }
1590
1590
  strHex += hex;
1591
1591
  }
1592
1592
  return strHex;
1593
1593
  } else {
1594
1594
  return String(color);
1595
1595
  }
1596
1596
  } else {
1597
1597
  return '';
1598
1598
  }
1599
1599
  if (hex) {
1600
1600
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
1601
1601
  let color = hex.toLowerCase();
1602
1602
  if (reg.test(color)) {
1603
1603
  if (color.length === 4) {
1604
1604
  let colorNew = '#';
1605
1605
  for (let i = 1; i < 4; i += 1) {
1606
1606
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
1607
1607
  }
1608
1608
  color = colorNew;
1609
1609
  }
1610
1610
  const colorChange: number[] = [];
1611
1611
  for (let i = 1; i < 7; i += 2) {
1612
1612
  colorChange.push(parseInt('0x' + color.slice(i, i + 2)));
1613
1613
  }
1614
1614
  if (returnList) {
1615
1615
  return colorChange;
1616
1616
  } else {
1617
1617
  return 'RGB(' + colorChange.join(',') + ')';
1618
1618
  }
1619
1619
  } else {
1620
1620
  return color;
1621
1621
  }
1622
1622
  } else {
1623
1623
  return '';
1624
1624
  }
1625
1625
  const c = m - n + 1;
1626
1626
  const res = Math.floor(Math.random() * c + n);
1627
1627
  if (filterNum && filterNum == res) {
1628
1628
  console.log('随机数二次开始', res, filterNum);
1629
1629
  return getRandom(n, m, filterNum);
1630
1630
  } else {
1631
1631
  return res;
1632
1632
  }
1633
1633
  wqCookieStr: string;
1634
1634
  wqCookie: {
1635
1635
  pin?: string;
1636
1636
  visitkey?: string;
1637
1637
  [key: string]: any;
1638
1638
  };
1639
1639
  const {
1640
1640
  jdpin,
1641
1641
  pinStatus,
1642
1642
  visitkey,
1643
1643
  unionid,
1644
1644
  skey,
1645
1645
  __jda,
1646
1646
  __jdv,
1647
1647
  __wga,
1648
1648
  wid,
1649
1649
  wq_skey,
1650
1650
  wq_uin,
1651
1651
  wq_auth_token,
1652
1652
  wxapp_scene,
1653
1653
  wq_unionid,
1654
1654
  wxapp_openid,
1655
1655
  wxapp_version,
1656
1656
  wxapp_type,
1657
1657
  appType,
1658
1658
  } = cookie;
1659
1659
  const ret: string[] = [];
1660
1660
  const getUserCookieObj = {};
1661
1661
  const createUseCookieArr = [
1662
1662
  jdpin,
1663
1663
  pinStatus,
1664
1664
  visitkey,
1665
1665
  unionid,
1666
1666
  skey,
1667
1667
  __jda,
1668
1668
  __jdv,
1669
1669
  __wga,
1670
1670
  wid,
1671
1671
  wq_skey,
1672
1672
  wq_uin,
1673
1673
  wq_auth_token,
1674
1674
  wxapp_scene,
1675
1675
  wq_unionid,
1676
1676
  wxapp_openid,
1677
1677
  wxapp_version,
1678
1678
  wxapp_type,
1679
1679
  appType,
1680
1680
  ];
1681
1681
  createUseCookieArr.forEach((keyItem) => {
1682
1682
  if (keyItem && keyItem['name']) {
1683
1683
  let { name, value } = keyItem;
1684
1684
  name = name === 'jdpin' ? 'pin' : name;
1685
1685
  name === 'pin' && ret.push(`pt_pin=${encodeURIComponent(value)}`);
1686
1686
  ret.push(`${name}=${encodeURIComponent(value)}`);
1687
1687
  getUserCookieObj[name] = value;
1688
1688
  }
1689
1689
  });
1690
1690
  return {
1691
1691
  wqCookieStr: ret.join(';'),
1692
1692
  wqCookie: getUserCookieObj,
1693
1693
  };
1694
1694
  const getNum = Number(num);
1695
1695
  return Math.round((getNum / widthSize) * layoutWidth);
1696
1696
  let checkState = false;
1697
1697
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag;
1698
1698
  if (couponFloorModuleType === FloorModuleType.COUPON) {
1699
1699
  try {
1700
1700
  const dataDefines = getFloorDataToDataDefines(floorData);
1701
1701
  const couponDataDefine = dataDefines
1702
1702
  ? dataDefines.filter((item) => {
1703
1703
  return item.type === 'coupon';
1704
1704
  })
1705
1705
  : [],
1706
1706
  couponList = couponDataDefine[0]?.nodeText?.data ? couponDataDefine[0]?.nodeText?.data : [],
1707
1707
  couponLength = couponList.length,
1708
1708
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
1709
1709
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
1710
1710
  : 0;
1711
1711
  if (numShowPerLine === 0 && couponLength > 3) {
1712
1712
  checkState = true;
1713
1713
  }
1714
1714
  } catch (e) {
1715
1715
  checkState = false;
1716
1716
  }
1717
1717
  return checkState;
1718
1718
  }
1719
1719
  const {
1720
1720
  containers = [],
1721
1721
  floors = [],
1722
1722
  clearFirstContaierMarginTop = false,
1723
1723
  } = pageData;
1724
1724
  console.log('dealShopContentData:', pageData, 'isvdev:', isvdev);
1725
1725
  const getThisTimeKey = Date.now();
1726
1726
  let shopContentContainerListData = containers?.filter(
1727
1727
  (item) => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
1728
1728
  );
1729
1729
  const shopContentFloorListData = floors?.filter(
1730
1730
  ({ floorPosition }) =>
1731
1731
  (!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') || isvdev,
1732
1732
  );
1733
1733
  const unableIsvContainerListData = getUnableIsvContainerListData(
1734
1734
  shopContentFloorListData,
1735
1735
  shopContentContainerListData,
1736
1736
  exceptionReportFn,
1737
1737
  );
1738
1738
  shopContentContainerListData.forEach((item, index) => {
1739
1739
  item.key = `${getThisTimeKey + index}`;
1740
1740
  item.floors = [];
1741
1741
  item.includeUids &&
1742
1742
  item.includeUids.forEach((floorUid) => {
1743
1743
  const getFloorData = shopContentFloorListData.find(
1744
1744
  (floorItem) => floorItem.uid === floorUid,
1745
1745
  );
1746
1746
  if (getFloorData) {
1747
1747
  const changeFloorData = {
1748
1748
  containerId: item.containerId,
1749
1749
  containerIndex: index,
1750
1750
  ...getFloorData,
1751
1751
  };
1752
1752
  const getCheckMoreCouponState = checkCouponAndChangeContainerSetData(getFloorData);
1753
1753
  if (getCheckMoreCouponState) {
1754
1754
  item.marginLeft && (item.marginLeft = 0);
1755
1755
  item.marginRight && (item.marginRight = 0);
1756
1756
  item.borderRadius && (item.borderRadius = 0);
1757
1757
  }
1758
1758
  if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
1759
1759
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn);
1760
1760
  !getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1);
1761
1761
  }
1762
1762
  item.floors.push(changeFloorData);
1763
1763
  }
1764
1764
  });
1765
1765
  if (
1766
1766
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
1767
1767
  item?.containerPosition == 'content' &&
1768
1768
  item?.marginBottom > 0 &&
1769
1769
  !clearFirstContaierMarginTop
1770
1770
  ) {
1771
1771
  item.marginTop = item.marginBottom;
1772
1772
  }
1773
1773
  });
1774
1774
  shopContentContainerListData = shopContentContainerListData.filter(
1775
1775
  (item) =>
1776
1776
  item.floors.length > 0 &&
1777
1777
  unableIsvContainerListData.every(
1778
1778
  (containerItem) => containerItem.containerId != item.containerId,
1779
1779
  ),
1780
1780
  );
1781
1781
  console.log(
1782
1782
  'dealShopContentData isWxMinAndWxapp:',
1783
1783
  isWxMinAndWxapp,
1784
1784
  'weappJumpToH5:',
1785
1785
  pageData?.homeExtInfo?.weappJumpToH5,
1786
1786
  );
1787
1787
  if (isProd && isWxMinAndWxapp) {
1788
1788
  shopContentContainerListData = shopContentContainerListData.filter(
1789
1789
  (item) =>
1790
1790
  item.floors.length > 0 &&
1791
1791
  !isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData),
1792
1792
  );
1793
1793
  }
1794
1794
  shopContentContainerListData = [].concat(shopContentContainerListData);
1795
1795
  return {
1796
1796
  shopContentContainerListData,
1797
1797
  shopContentFloorListData,
1798
1798
  };
1799
1799
  const changeOpts = {
1800
1800
  title: '',
1801
1801
  icon: 'success',
1802
1802
  duration: 1500,
1803
1803
  mask: true,
1804
1804
  ...options,
1805
1805
  };
1806
1806
  if (changeOpts.title.length > 7) {
1807
1807
  showNormalToast(options);
1808
1808
  } else {
1809
1809
  Taro.showToast(changeOpts as any);
1810
1810
  }
1811
1811
  const changeOpts = {
1812
1812
  title: '',
1813
1813
  icon: 'error',
1814
1814
  duration: 1500,
1815
1815
  mask: true,
1816
1816
  ...options,
1817
1817
  };
1818
1818
  if (changeOpts.title.length > 7) {
1819
1819
  showNormalToast(options);
1820
1820
  } else {
1821
1821
  Taro.showToast(changeOpts as any);
1822
1822
  }
1823
1823
  Taro.showToast({
1824
1824
  title: '',
1825
1825
  icon: 'none',
1826
1826
  duration: 1500,
1827
1827
  mask: true,
1828
1828
  ...options,
1829
1829
  });
1830
1830
  return Taro.showLoading({
1831
1831
  title: text,
1832
1832
  });
1833
1833
  return new Promise(() => {
1834
1834
  Taro.nextTick(() => {
1835
1835
  setTimeout(() => {
1836
1836
  Taro.hideLoading(options);
1837
1837
  }, 300);
1838
1838
  });
1839
1839
  });
1840
1840
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
1841
1841
  const {
1842
1842
  tabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
1843
1843
  sceneId,
1844
1844
  } = query;
1845
1845
  let changeTabActive = tabActive;
1846
1846
  if (sceneId) {
1847
1847
  if (isH5) {
1848
1848
  if (sceneId == '1002') {
1849
1849
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1850
1850
  }
1851
1851
  else if (sceneId == '1003') {
1852
1852
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
1853
1853
  }
1854
1854
  } else if (isWxMinAndWxapp) {
1855
1855
  if (sceneId == '1001' || sceneId == '1002') {
1856
1856
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1857
1857
  }
1858
1858
  else if (sceneId == '1003') {
1859
1859
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
1860
1860
  }
1861
1861
  }
1862
1862
  }
1863
1863
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
1864
1864
  return {
1865
1865
  menuType: SHOP_MENU_ID_TYPE.HOME,
1866
1866
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
1867
1867
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
1868
1868
  };
1869
1869
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
1870
1870
  return {
1871
1871
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
1872
1872
  tabActiveType: 0,
1873
1873
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
1874
1874
  };
1875
1875
  } else {
1876
1876
  return {
1877
1877
  menuType: SHOP_MENU_ID_TYPE.HOME,
1878
1878
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
1879
1879
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
1880
1880
  };
1881
1881
  }
1882
1882
  const deleteKeyList = [
1883
1883
  '$taroTimestamp',
1884
1884
  'cookie',
1885
1885
  'wdref',
1886
1886
  'navStart',
1887
1887
  'originOpts',
1888
1888
  'originParams',
1889
1889
  'originUrl',
1890
1890
  'referer',
1891
1891
  'stamp',
1892
1892
  'hybrid',
1893
1893
  'sr',
1894
1894
  'navh',
1895
1895
  'stath',
1896
1896
  ];
1897
1897
  let changeQueryData: any = { ...queryData };
1898
1898
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
1899
1899
  const sceneQuery =
1900
1900
  qrCodeScene && typeof qrCodeScene === 'string'
1901
1901
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
1902
1902
  : {};
1903
1903
  changeQueryData = { ...changeQueryData, ...sceneQuery };
1904
1904
  deleteKeyList.forEach((key) => {
1905
1905
  changeQueryData[key] && delete changeQueryData[key];
1906
1906
  });
1907
1907
  changeQueryData['shopid'] &&
1908
1908
  (changeQueryData['shopId'] = changeQueryData['shopid']) &&
1909
1909
  delete changeQueryData['shopid'];
1910
1910
  changeQueryData['venderid'] &&
1911
1911
  (changeQueryData['venderId'] = changeQueryData['venderid']) &&
1912
1912
  delete changeQueryData['venderid'];
1913
1913
  changeQueryData['vendorId'] &&
1914
1914
  (changeQueryData['venderId'] = changeQueryData['vendorId']) &&
1915
1915
  delete changeQueryData['vendorId'];
1916
1916
  changeQueryData['shopId'] &&
1917
1917
  changeQueryData['shopId'] === 'undefined' &&
1918
1918
  delete changeQueryData['shopId'];
1919
1919
  changeQueryData['venderId'] &&
1920
1920
  changeQueryData['venderId'] === 'undefined' &&
1921
1921
  delete changeQueryData['venderId'];
1922
1922
  return changeQueryData;
1923
1923
  let isUsable = false;
1924
1924
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
1925
1925
  const modularPackResultObj = formatPackResult(modularPackResult);
1926
1926
  const bundleUrl = getBundleUrl(modularPackResultObj);
1927
1927
  const bundleFileName = getBundleFileName(modularPackResultObj);
1928
1928
  const taroVersion = getTaroVersion(modularPackResultObj);
1929
1929
  if (bundleUrl && bundleFileName) {
1930
1930
  isUsable = true;
1931
1931
  }
1932
1932
  if (!isUsable && typeof exceptionReportFn === 'function') {
1933
1933
  exceptionReportFn({
1934
1934
  code: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${
1935
1935
  floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE
1936
1936
  ? SgmCustomCode.SYSTEMPDCMODULE_DATA
1937
1937
  : SgmCustomCode.REMOTEMODULE_DATA
1938
1938
  }`,
1939
1939
  msg: {
1940
1940
  msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
1941
1941
  floorIdx: floorData?.floorIdx,
1942
1942
  uid: floorData?.uid,
1943
1943
  shopId: floorData?.floorExtInfo?.shopId,
1944
1944
  moduleId: floorData?.moduleId,
1945
1945
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
1946
1946
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
1947
1947
  floorKind: floorData?.floorExtInfo?.floorKind,
1948
1948
  middleTemplateId: floorData?.middleTemplateId,
1949
1949
  modularPackResult: {
1950
1950
  bundleUrl,
1951
1951
  taroVersion,
1952
1952
  },
1953
1953
  },
1954
1954
  });
1955
1955
  }
1956
1956
  return isUsable;
1957
1957
  const objContainer = containerListData.find((item) => item.containerId === containerId);
1958
1958
  return (
1959
1959
  objContainer?.includeUids?.some((itemUid) => {
1960
1960
  const objectFloor = floorListData.find((floorItem) => itemUid === floorItem.uid);
1961
1961
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag);
1962
1962
  }) ?? false
1963
1963
  );
1964
1964
  const unableIsvFloorListData = floorListData.filter(
1965
1965
  (floorItem) =>
1966
1966
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
1967
1967
  !isIsvFloorUseable(floorItem, exceptionReportFn),
1968
1968
  );
1969
1969
  const unableIsvFloorUidList = unableIsvFloorListData.map((floorItem) => floorItem.uid);
1970
1970
  const unableIsvContainerListData = containerListData.filter(
1971
1971
  (item) =>
1972
1972
  item.includeUids &&
1973
1973
  item.includeUids.every((itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1),
1974
1974
  );
1975
1975
  return unableIsvContainerListData;
1976
1976
  return -2;
1977
1977
  return customObj;
1978
1978
  return customObj;
1979
1979
  return customObj;
1980
1980
  return customObj;
1981
1981
  return customObj;
1982
1982
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl);
1983
1983
  let getParams = false;
1984
1984
  if (isOpenJdAppUrl(openAppUrl)) {
1985
1985
  try {
1986
1986
  getParams = openAppUrl.replace(/openApp\.jdMobile:\/\/virtual\?params=/i, '');
1987
1987
  getParams = JSON.parse(String(getParams));
1988
1988
  } catch (e) {
1989
1989
  console.log(e);
1990
1990
  }
1991
1991
  }
1992
1992
  return getParams;
1993
1993
  const getLastParams = Object.assign({}, openParams);
1994
1994
  return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`;
1995
1995
  if (val === null || val === '' || typeof val === 'undefined') {
1996
1996
  return true;
1997
1997
  }
1998
1998
  return false;
1999
1999
  const {
2000
2000
  moduleId = 'none',
2001
2001
  entrance = 'none',
2002
2002
  sourceType = 'none',
2003
2003
  sourceValue = 'none',
2004
2004
  } = params;
2005
2005
  if (isIosDevice) {
2006
2006
  return `${moduleId}#${entrance}`;
2007
2007
  } else if (isAndroidDevice) {
2008
2008
  return `${sourceType}#${sourceValue}`;
2009
2009
  }
2010
2010
  return 'none#none';
2011
2011
  if (data && typeof data === 'object') {
2012
2012
  let getOpenAppData = { ...data };
2013
2013
  try {
2014
2014
  const { sourceInfo, designerId, templateId, source } = getOpenAppData;
2015
2015
  if (designerId && templateId) {
2016
2016
  getOpenAppData = Object.assign({}, getOpenAppData, {
2017
2017
  sourceInfo: {
2018
2018
  entrance: '设计师预览',
2019
2019
  },
2020
2020
  });
2021
2021
  } else if (sourceInfo) {
2022
2022
  const { entrance } = sourceInfo;
2023
2023
  getOpenAppData.sourceInfo.entrance = entrance && entrance.length > 0 ? entrance : '其他';
2024
2024
  } else if (source && !sourceInfo) {
2025
2025
  if (typeof source === 'object') {
2026
2026
  const { sourceType, entrance, sourceValue, moduleId } = source;
2027
2027
  getOpenAppData = Object.assign({}, getOpenAppData, {
2028
2028
  sourceInfo: {
2029
2029
  entrance: sourceType || entrance || '其他',
2030
2030
  moduleId: sourceValue || moduleId || '-100',
2031
2031
  },
2032
2032
  });
2033
2033
  if (sourceType === 'shop_from_product_detail' && sourceValue) {
2034
2034
  getOpenAppData.sourceSku = sourceValue;
2035
2035
  }
2036
2036
  } else {
2037
2037
  getOpenAppData = Object.assign({}, getOpenAppData, {
2038
2038
  sourceInfo: {
2039
2039
  entrance: source,
2040
2040
  },
2041
2041
  });
2042
2042
  }
2043
2043
  } else {
2044
2044
  getOpenAppData = Object.assign({}, getOpenAppData, {
2045
2045
  sourceInfo: {
2046
2046
  entrance: '其他',
2047
2047
  },
2048
2048
  });
2049
2049
  }
2050
2050
  } catch (e) {
2051
2051
  console.log(e);
2052
2052
  }
2053
2053
  return getOpenAppData;
2054
2054
  }
2055
2055
  return data;
2056
2056
  return displayObj;
2057
2057
  if (typeof input === 'string') {
2058
2058
  try {
2059
2059
  return JSON.parse(input);
2060
2060
  } catch (e) {
2061
2061
  console.error('JSON解析失败', e);
2062
2062
  return {};
2063
2063
  }
2064
2064
  }
2065
2065
  return input || {};
2066
2066
  return false;
2067
2067
  const borderStyle: { [key: string]: any } = {};
2068
2068
  if (item?.borderRadius) {
2069
2069
  let borderTopRadius = 0;
2070
2070
  let borderBottomRadius = 0;
2071
2071
  if (index === 0) {
2072
2072
  borderTopRadius = item.borderRadius;
2073
2073
  borderBottomRadius = floorDataLen === 1 || item?.marginBottom !== 0 ? item.borderRadius : 0;
2074
2074
  } else if (index === floorDataLen - 1) {
2075
2075
  borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
2076
2076
  borderBottomRadius = item.borderRadius;
2077
2077
  } else {
2078
2078
  borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
2079
2079
  borderBottomRadius = item?.marginBottom === 0 ? 0 : item.borderRadius;
2080
2080
  }
2081
2081
  borderStyle.borderTopLeftRadius = item?.borderTopLeftRadius
2082
2082
  ? `${item?.borderTopLeftRadius}px`
2083
2083
  : `${borderTopRadius}px`;
2084
2084
  borderStyle.borderTopRightRadius = item?.borderTopRightRadius
2085
2085
  ? `${item?.borderTopRightRadius}px`
2086
2086
  : `${borderTopRadius}px`;
2087
2087
  borderStyle.borderBottomLeftRadius = `${borderBottomRadius}px`;
2088
2088
  borderStyle.borderBottomRightRadius = `${borderBottomRadius}px`;
2089
2089
  } else {
2090
2090
  borderStyle.borderTopLeftRadius = borderStyle?.borderTopLeftRadius || '0px';
2091
2091
  borderStyle.borderTopRightRadius = borderStyle?.borderTopRightRadius || '0px';
2092
2092
  borderStyle.borderBottomRightRadius = borderStyle?.borderBottomRightRadius || '0px';
2093
2093
  borderStyle.borderBottomLeftRadius = borderStyle?.borderBottomLeftRadius || '0px';
2094
2094
  }
2095
2095
  return borderStyle;
2096
2096
  return customObj;
2097
2097
  isJdApp,
2098
2098
  isWxApp,
2099
2099
  isIosDevice,
2100
2100
  isAndroidDevice,
2101
2101
  isJdAndIosDevice,
2102
2102
  isJdAndAndroidDevice,
2103
2103
  isWxMin,
2104
2104
  isWxMinAndWxapp,
2105
2105
  isJdMin,
2106
2106
  isMin,
2107
2107
  isJdMinAndHarmony,
2108
2108
  isH5,
2109
2109
  isH5AndJdShopView,
2110
2110
  isImageOptimizeEnable,
2111
2111
  isChartH5,
2112
2112
  isH5AndJdShopViewNativeScroll,
2113
2113
  isH5AndJdShopViewH5Scroll,
2114
2114
  isH5AndJdShopH5CustomScrollView,
2115
2115
  isWxMiniH5View,
2116
2116
  sliceArrToChunkList,
2117
2117
  dealAddress,
2118
2118
  objectToUrlEncode,
2119
2119
  parseQueryUrlString,
2120
2120
  setLowSmallPicUrl,
2121
2121
  getJfsImage,
2122
2122
  getQualityImage,
2123
2123
  countStringify,
2124
2124
  setTaroStorage,
2125
2125
  getTaroStorageKeyValue,
2126
2126
  removeTaroStorageKey,
2127
2127
  clearTaroStorageKey,
2128
2128
  getSystemInfos,
2129
2129
  addHttps,
2130
2130
  dateFormat,
2131
2131
  throttle,
2132
2132
  lodashThrottle,
2133
2133
  debounce,
2134
2134
  getTelephone,
2135
2135
  rgbToHex,
2136
2136
  hexToRgb,
2137
2137
  getRandom,
2138
2138
  getWxAppCookieStr,
2139
2139
  pxTransformFromData,
2140
2140
  dealShopContentData,
2141
2141
  showSuccessToast,
2142
2142
  showFailToast,
2143
2143
  showNormalToast,
2144
2144
  showShopLoading,
2145
2145
  hideShopLoading,
2146
2146
  getAppChannelType,
2147
2147
  formatTabActiveMenuType,
2148
2148
  filterUrlQueryData,
2149
2149
  getAvifSupport,
2150
2150
  getWebpSupport,
2151
2151
  isMemberPage,
2152
2152
  sgmCustomReport,
2153
2153
  draCustomReport,
2154
2154
  remoteCustomReport,
2155
2155
  draInterfaceCustomReport,
2156
2156
  draBusinessCustomReport,
2157
2157
  isOpenJdAppUrl,
2158
2158
  jdOpenAppParams,
2159
2159
  createJdOpenAppUrl,
2160
2160
  dealJdOpenAppData,
2161
2161
  isEmpty,
2162
2162
  getJdAppReportPageSource,
2163
2163
  isAppClassifyPage,
2164
2164
  getQualityImageNew,
2165
2165
  getQualityImageOld,
2166
2166
  isPc,
2167
2167
  ipLoc_djd,
2168
2168
  jdAppVersionCompare,
2169
2169
  dealNativePixelToCssPixel,
2170
2170
  isAppStowShop,
2171
2171
  isIpadDevice,
2172
2172
  getBorderStyle,
2173
2173
  isLanguageForEn,
2174
2174
  sColor,
2175
2175
  draInterfaceDSMCustomReport,