@conecli/cone-render 0.10.1-shop3.1 → 0.10.1-shop3.11

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 (69) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/common/index.h5.ts +1 -1
  4. package/dist/common/index.jd.ts +1 -1
  5. package/dist/common/index.ts +1 -1
  6. package/dist/common/index.weapp.ts +1 -1
  7. package/dist/common/token/token.jd.ts +1 -1
  8. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  9. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  10. package/dist/components/base/CountDown/index.module.scss +49 -44
  11. package/dist/components/base/CountDown/index.tsx +1 -1
  12. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  13. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  14. package/dist/components/base/Dialog/index.module.scss +11 -0
  15. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  16. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  17. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  18. package/dist/components/base/InViewRender/index.tsx +1 -1
  19. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  20. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  21. package/dist/components/base/Price/Double/index.module.scss +8 -0
  22. package/dist/components/base/Price/Double/index.tsx +1 -1
  23. package/dist/components/floorItem.weapp.tsx +1 -1
  24. package/dist/interface/common.ts +1 -1
  25. package/dist/interface/jumpEventReport.ts +1 -1
  26. package/dist/interface/service.ts +1 -1
  27. package/dist/jumpEventReport/base.ts +1 -1
  28. package/dist/jumpEventReport/const.ts +1 -1
  29. package/dist/jumpEventReport/index.jd.ts +1 -1
  30. package/dist/jumpEventReport/index.weapp.ts +1 -1
  31. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  32. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  33. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  34. package/dist/jumpEventReport/web/report.ts +1 -1
  35. package/dist/jumpEventReport/web.base.ts +1 -1
  36. package/dist/jumpEventReport/web.jd.ts +1 -1
  37. package/dist/jumpEventReport/web.jdb.ts +1 -1
  38. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  39. package/dist/jumpEventReport/web.jxwxapp.ts +1 -1
  40. package/dist/jumpEventReport/web.pc.ts +1 -1
  41. package/dist/jumpEventReport/web.tjapp.ts +1 -1
  42. package/dist/jumpEventReport/web.tjm.ts +1 -1
  43. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  44. package/dist/libs/taroAppReport.js +2 -2
  45. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -53
  46. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  47. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  48. package/dist/open/api/shopMember.ts +1 -1
  49. package/dist/open/api/util.ts +1 -1
  50. package/dist/sass/app.h5.scss +261 -224
  51. package/dist/sass/base.scss +142 -141
  52. package/dist/service/fetchGateway.ts +1 -1
  53. package/dist/service/fetchGateway.weapp.ts +1 -0
  54. package/dist/service/http/colorSign.ts +1 -1
  55. package/dist/service/http/const.ts +1 -1
  56. package/dist/service/http/h5Http.ts +1 -1
  57. package/dist/service/requestServer.h5.ts +1 -1
  58. package/dist/service/requestServer.ts +1 -1
  59. package/dist/service/requestServer.weapp.ts +1 -0
  60. package/dist/utils/connectNativeJsBridge.ts +1 -1
  61. package/dist/utils/h5Utils.ts +1 -1
  62. package/dist/utils/index.h5.ts +1 -1
  63. package/dist/utils/index.ts +1 -1
  64. package/dist/utils/index.weapp.ts +1 -1
  65. package/dist/utils/jumpExtMapUtil.js +1 -0
  66. package/dist/utils/sColor.js +1 -0
  67. package/dist/utils/utils.ts +1 -1
  68. package/package.json +1 -1
  69. package/dist/utils/memberFormatUtils.js +0 -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,
1122
+ import Taro from '@tarojs/taro';
1123
1123
  SHOP_MENU_ID_TYPE,
1124
1124
  SHOP_MENU_ID_QUERY_NAME,
1125
1125
  SECTION_HOME_TAB_TYPE,
1126
1126
  SECTION_HOME_TAB_NAME_TYPE,
1127
1127
  SECTION_HOME_TAB_QUERY_TYPE,
1128
1128
  CHANNEL_TYPE,
1129
1129
  JDShopViewBusinessPathType,
1130
1130
  FloorModuleType,
1131
1131
  RemoteLoadFloorList,
1132
1132
  FLOOR_KIND,
1133
1133
  getBundleUrl,
1134
1134
  getBundleFileName,
1135
1135
  formatPackResult,
1136
1136
  getTaroVersion,
1137
1137
  /ipad/i.test(system) || (/android/i.test(system) && !/mobi|mini|fennec/i.test(system));
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
  } catch (e) {
1157
1157
  console.log(`setTaroStorage key:${key} 报错:`, e);
1158
1158
  return Promise.resolve(null);
1159
1159
  }
1160
1160
  try {
1161
1161
  if (isH5 && window && !window.localStorage) {
1162
1162
  console.log(`getTaroStorageKeyValue key:${key} window.localStorage不存在:`);
1163
1163
  return Promise.resolve(null);
1164
1164
  }
1165
1165
  return Taro.getStorageSync(key);
1166
1166
  } catch (e) {
1167
1167
  console.log(`getTaroStorageKeyValue key:${key} 报错:`, e);
1168
1168
  return null;
1169
1169
  }
1170
1170
  try {
1171
1171
  if (isH5 && window && !window.localStorage) {
1172
1172
  console.log(`removeTaroStorageKey key:${key} window.localStorage不存在:`);
1173
1173
  return Promise.resolve(null);
1174
1174
  }
1175
1175
  return Taro.removeStorage({
1176
1176
  key: key,
1177
1177
  }).catch((e) => {
1178
1178
  console.log(`removeTaroStorageKey key:${key} 报错:`, e);
1179
1179
  });
1180
1180
  } catch (e) {
1181
1181
  console.log(`removeTaroStorageKey key:${key} 报错:`, e);
1182
1182
  }
1183
1183
  try {
1184
1184
  if (isH5 && window && !window.localStorage) {
1185
1185
  console.log(`clearTaroStorageKey window.localStorage不存在`);
1186
1186
  return Promise.resolve(null);
1187
1187
  }
1188
1188
  return Taro.clearStorage().catch((e) => {
1189
1189
  console.log('clearTaroStorageKey报错:', e);
1190
1190
  });
1191
1191
  } catch (e) {
1192
1192
  console.log('clearTaroStorageKey报错:', e);
1193
1193
  }
1194
1194
  let hasChecked = false;
1195
1195
  if (isH5) {
1196
1196
  const avifCache = getTaroStorageKeyValue(KEY_AVIF);
1197
1197
  if (avifCache === null || avifCache === '' || forceUpdate) {
1198
1198
  hasChecked = true;
1199
1199
  const img = new Image();
1200
1200
  img.onload = function () {
1201
1201
  if (img.height > 0 && img.width > 0) {
1202
1202
  setTaroStorage(KEY_AVIF, '1');
1203
1203
  } else {
1204
1204
  setTaroStorage(KEY_AVIF, '0');
1205
1205
  }
1206
1206
  };
1207
1207
  img.onerror = () => {
1208
1208
  setTaroStorage(KEY_AVIF, '0');
1209
1209
  };
1210
1210
  img.src =
1211
1211
  'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
1212
1212
  }
1213
1213
  const webpCache = getTaroStorageKeyValue(KEY_WEBP);
1214
1214
  if (webpCache === null || webpCache === '' || forceUpdate) {
1215
1215
  hasChecked = true;
1216
1216
  const img = new Image();
1217
1217
  img.onload = function () {
1218
1218
  if (img.height > 0 && img.width > 0) {
1219
1219
  setTaroStorage(KEY_WEBP, '1');
1220
1220
  } else {
1221
1221
  setTaroStorage(KEY_WEBP, '0');
1222
1222
  }
1223
1223
  };
1224
1224
  img.onerror = () => {
1225
1225
  setTaroStorage(KEY_WEBP, '0');
1226
1226
  };
1227
1227
  img.src =
1228
1228
  'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA=';
1229
1229
  }
1230
1230
  }
1231
1231
  return hasChecked;
1232
1232
  const hasChecked = imageFormatSupport(false);
1233
1233
  if (!hasChecked) {
1234
1234
  setTimeout(imageFormatSupport, 5000);
1235
1235
  }
1236
1236
  const resultList: Array<any> = [],
1237
1237
  arrLen = arr.length;
1238
1238
  if (arrLen) {
1239
1239
  if (arrLen > size) {
1240
1240
  for (let i = 0; i < arrLen; i = i + size) {
1241
1241
  resultList.push(arr.slice(i, i + size));
1242
1242
  }
1243
1243
  } else {
1244
1244
  resultList.push(arr);
1245
1245
  }
1246
1246
  }
1247
1247
  return resultList;
1248
1248
  let _address = ids;
1249
1249
  const _areaAreaSplit = ids.split('.');
1250
1250
  const _areaAreaSplit2 = ids.split('_');
1251
1251
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
1252
1252
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
1253
1253
  return _address;
1254
1254
  let paramStr = '';
1255
1255
  obj &&
1256
1256
  Object.keys(obj).forEach((key, index) => {
1257
1257
  const getValue = `${obj[key]}`.replace(/undefined/, '').replace(/null/, '');
1258
1258
  paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`;
1259
1259
  });
1260
1260
  return paramStr;
1261
1261
  const result = {};
1262
1262
  if (
1263
1263
  !urlOrQueryStr ||
1264
1264
  ('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
1265
1265
  ) {
1266
1266
  return result;
1267
1267
  }
1268
1268
  if (urlOrQueryStr.indexOf('?') > -1) {
1269
1269
  const queryStr = urlOrQueryStr.split('?');
1270
1270
  const queryItemList = queryStr && queryStr.length > 1 ? queryStr[1].split('&') : [];
1271
1271
  const queryItemListLen = queryItemList.length;
1272
1272
  queryItemListLen > 0 &&
1273
1273
  queryItemList.forEach((item) => {
1274
1274
  const thisItemList = item.split('=');
1275
1275
  result[thisItemList[0]] = thisItemList[1];
1276
1276
  });
1277
1277
  } else {
1278
1278
  const queryItemList =
1279
1279
  urlOrQueryStr.indexOf('&') > -1 ? urlOrQueryStr.split('&') : [urlOrQueryStr];
1280
1280
  const queryItemListLen = queryItemList.length;
1281
1281
  queryItemListLen > 0 &&
1282
1282
  queryItemList.forEach((item) => {
1283
1283
  const thisItemList = item.split('=');
1284
1284
  result[thisItemList[0]] = thisItemList[1];
1285
1285
  });
1286
1286
  }
1287
1287
  return result;
1288
1288
  url: string,
1289
1289
  size?: {
1290
1290
  w: number;
1291
1291
  h: number;
1292
1292
  },
1293
1293
  quality?: number,
1294
1294
  if (url && size) {
1295
1295
  const _w = Math.floor(size.w);
1296
1296
  const _h = Math.floor(size.h);
1297
1297
  if (url.match(/gif$/i)) {
1298
1298
  return url;
1299
1299
  } else {
1300
1300
  if (_w > 0 && _h > 0) {
1301
1301
  url = url.replace('jfs/', `s${_w}x${_h}_jfs/`);
1302
1302
  }
1303
1303
  url += quality != null ? `!q${quality}.dpg` : '.dpg';
1304
1304
  }
1305
1305
  }
1306
1306
  return url;
1307
1307
  if (url.match(/\.(jpg|png|dpg)$/i)) {
1308
1308
  const { width, height, quality } = jfsImgInfo;
1309
1309
  if (typeof width === 'number' || typeof height === 'number') {
1310
1310
  url = url.replace('/jfs/', `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`);
1311
1311
  }
1312
1312
  if (typeof quality === 'number' && quality > 0 && quality < 100 && url.match(/\.jpg$/i)) {
1313
1313
  url += `!q${quality}.dpg`;
1314
1314
  }
1315
1315
  }
1316
1316
  return addHttps(url);
1317
1317
  if (imgUrl) {
1318
1318
  if (
1319
1319
  !imgUrl.match(
1320
1320
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
1321
1321
  )
1322
1322
  ) {
1323
1323
  if (!imgUrl.includes('360buyimg.com')) {
1324
1324
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
1325
1325
  }
1326
1326
  if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
1327
1327
  }
1328
1328
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
1329
1329
  }
1330
1330
  return imgUrl;
1331
1331
  const result = value % step;
1332
1332
  return result === 0 ? value : Math.ceil(value / step) * step;
1333
1333
  const MAX = 3.5;
1334
1334
  return Math.min(window?.devicePixelRatio ?? 2, MAX);
1335
1335
  isSkuImage: boolean;
1336
1336
  size: number;
1337
1337
  imgUrl: string,
1338
1338
  options: QualityOptions,
1339
1339
  isIgnoreOptimizeFromServer: boolean = false,
1340
1340
  if (!imgUrl) {
1341
1341
  console.error('The input parameter imageUrl for the getQualityImage() cannot be empty!');
1342
1342
  return imgUrl;
1343
1343
  }
1344
1344
  if (isIgnoreOptimizeFromServer) {
1345
1345
  imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1');
1346
1346
  }
1347
1347
  if (!/^((https?):)?\/\//.test(imgUrl)) {
1348
1348
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
1349
1349
  }
1350
1350
  const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i;
1351
1351
  if (!imgServerRegExp.test(imgUrl)) {
1352
1352
  return imgUrl;
1353
1353
  }
1354
1354
  imgUrl = /^\/\//.test(imgUrl) ? `https:${imgUrl}` : imgUrl;
1355
1355
  const { isSkuImage, size } = options || {};
1356
1356
  const needReduceSize = isSkuImage && size;
1357
1357
  if (needReduceSize) {
1358
1358
  const devicePixelRatio = getDevicePixelRatio();
1359
1359
  const useWidth = getValueByStep(size * devicePixelRatio, 40);
1360
1360
  imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useWidth}_jfs/`);
1361
1361
  }
1362
1362
  const needCompress = !global?.info?.pageInfo?.isVipShop;
1363
1363
  const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/);
1364
1364
  if (needCompress && result) {
1365
1365
  if (getAvifSupport() === '1') {
1366
1366
  imgUrl += '.avif';
1367
1367
  } else if (getWebpSupport() === '1') {
1368
1368
  imgUrl += '.webp';
1369
1369
  } else if (/jpe?g/.test(result[1])) {
1370
1370
  imgUrl += '!q80';
1371
1371
  }
1372
1372
  }
1373
1373
  if (needReduceSize) {
1374
1374
  imgUrl += '!z2';
1375
1375
  }
1376
1376
  return imgUrl;
1377
1377
  if (imgUrl) {
1378
1378
  if (
1379
1379
  !imgUrl.match(
1380
1380
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
1381
1381
  )
1382
1382
  ) {
1383
1383
  if (!imgUrl.includes('360buyimg.com')) {
1384
1384
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
1385
1385
  }
1386
1386
  if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
1387
1387
  }
1388
1388
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
1389
1389
  }
1390
1390
  return imgUrl;
1391
1391
  return getTaroStorageKeyValue(KEY_AVIF) || '0';
1392
1392
  return getTaroStorageKeyValue(KEY_WEBP) || '0';
1393
1393
  count: number,
1394
1394
  fixedNum = 1,
1395
1395
  unit = '万',
1396
1396
  maxNum = 10000,
1397
1397
  count = Number(count);
1398
1398
  const getMaxNum = count > 100000000 ? 100000000 : maxNum;
1399
1399
  const getUnit = count > 100000000 ? '亿' : unit;
1400
1400
  if (count >= getMaxNum) {
1401
1401
  return (count / getMaxNum).toFixed(fixedNum) + getUnit;
1402
1402
  }
1403
1403
  return count;
1404
1404
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
1405
1405
  platform: '',
1406
1406
  model: '',
1407
1407
  system: '',
1408
1408
  };
1409
1409
  const isIOS = !!systemInfo.system.match(/ios/i);
1410
1410
  const isAndroid = !!systemInfo.system.match(/android/i);
1411
1411
  if (!systemInfo.statusBarHeight) {
1412
1412
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20;
1413
1413
  systemInfo.navBarExtendHeight = 0;
1414
1414
  } else {
1415
1415
  if (isIOS) {
1416
1416
  systemInfo.navBarExtendHeight = 4;
1417
1417
  } else {
1418
1418
  systemInfo.navBarExtendHeight = 0;
1419
1419
  }
1420
1420
  }
1421
1421
  let rect = Taro.getMenuButtonBoundingClientRect ? Taro.getMenuButtonBoundingClientRect() : null;
1422
1422
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
1423
1423
  let gap = 0;
1424
1424
  let width = 96;
1425
1425
  if (systemInfo.platform === 'android') {
1426
1426
  gap = 8;
1427
1427
  width = 96;
1428
1428
  } else if (systemInfo.platform === 'devtools') {
1429
1429
  if (isIOS) {
1430
1430
  gap = 5.5;
1431
1431
  } else {
1432
1432
  gap = 7.5;
1433
1433
  }
1434
1434
  } else {
1435
1435
  gap = 4;
1436
1436
  width = 88;
1437
1437
  }
1438
1438
  rect = {
1439
1439
  bottom: systemInfo.statusBarHeight + gap + 32,
1440
1440
  height: 32,
1441
1441
  left: systemInfo.windowWidth - width - 10,
1442
1442
  right: systemInfo.windowWidth - 10,
1443
1443
  top: systemInfo.statusBarHeight + gap,
1444
1444
  width,
1445
1445
  };
1446
1446
  }
1447
1447
  const gap = rect.top - systemInfo.statusBarHeight;
1448
1448
  systemInfo.navBarTopToStatusBar = gap;
1449
1449
  systemInfo.navBarHeight = 2 * gap + rect.height;
1450
1450
  systemInfo.capsulePosition = rect;
1451
1451
  systemInfo.isIOS = isIOS;
1452
1452
  systemInfo.isAndroid = isAndroid;
1453
1453
  return systemInfo;
1454
1454
  if (str.match(/^\/\//)) {
1455
1455
  str = 'https:' + str;
1456
1456
  }
1457
1457
  return str;
1458
1458
  dateTimeOrdate: Date | string | number | null,
1459
1459
  format = 'yyyy-MM-dd HH:mm:ss',
1460
1460
  noPadStart = {
1461
1461
  M: '0',
1462
1462
  d: '0',
1463
1463
  H: '0',
1464
1464
  m: '0',
1465
1465
  s: '0',
1466
1466
  },
1467
1467
  let dateResult = '';
1468
1468
  const padStarts = Object.assign(
1469
1469
  {
1470
1470
  M: '0',
1471
1471
  d: '0',
1472
1472
  H: '0',
1473
1473
  m: '0',
1474
1474
  s: '0',
1475
1475
  },
1476
1476
  noPadStart,
1477
1477
  );
1478
1478
  if (dateTimeOrdate) {
1479
1479
  let changeDateTimeOrdate = dateTimeOrdate;
1480
1480
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
1481
1481
  if (getChangeDateTimeToNumber) {
1482
1482
  changeDateTimeOrdate = getChangeDateTimeToNumber;
1483
1483
  } else {
1484
1484
  changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/').replace(/\./g, '/');
1485
1485
  }
1486
1486
  const nowDate =
1487
1487
  dateTimeOrdate instanceof Date ? dateTimeOrdate : new Date(changeDateTimeOrdate);
1488
1488
  const dateMap = {
1489
1489
  y: `${nowDate.getFullYear()}`,
1490
1490
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
1491
1491
  d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
1492
1492
  H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
1493
1493
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
1494
1494
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
1495
1495
  };
1496
1496
  const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g');
1497
1497
  const regYear = new RegExp('y');
1498
1498
  dateResult = format.replace(regDate, (v) => {
1499
1499
  let changeValue = v;
1500
1500
  if (regYear.test(changeValue)) {
1501
1501
  const thisYear = dateMap.y;
1502
1502
  const subValueLen = 4 - changeValue.length;
1503
1503
  changeValue = thisYear.substr(subValueLen);
1504
1504
  } else {
1505
1505
  const dateKey = v.substr(0, 1);
1506
1506
  changeValue = dateMap[dateKey];
1507
1507
  }
1508
1508
  return changeValue;
1509
1509
  });
1510
1510
  }
1511
1511
  return dateResult;
1512
1512
  let timer: any = null;
1513
1513
  let startTime = Date.now();
1514
1514
  return function () {
1515
1515
  const curTime = Date.now();
1516
1516
  const remaining = delay - (curTime - startTime);
1517
1517
  const context = this;
1518
1518
  const args = arguments;
1519
1519
  clearTimeout(timer);
1520
1520
  if (remaining <= 0) {
1521
1521
  func.apply(context, args);
1522
1522
  startTime = Date.now();
1523
1523
  } else {
1524
1524
  timer = setTimeout(func, remaining);
1525
1525
  }
1526
1526
  };
1527
1527
  let context, args, result;
1528
1528
  let timeout = null;
1529
1529
  let previous = 0;
1530
1530
  if (!options) options = {};
1531
1531
  const later = function () {
1532
1532
  previous = options.leading === false ? 0 : Date.now();
1533
1533
  timeout = null;
1534
1534
  result = func.apply(context, args);
1535
1535
  if (!timeout) context = args = null;
1536
1536
  };
1537
1537
  return function () {
1538
1538
  const now = Date.now();
1539
1539
  if (!previous && options.leading === false) previous = now;
1540
1540
  const remaining = wait - (now - previous);
1541
1541
  context = this;
1542
1542
  args = arguments;
1543
1543
  if (remaining <= 0 || remaining > wait) {
1544
1544
  if (timeout) {
1545
1545
  clearTimeout(timeout);
1546
1546
  timeout = null;
1547
1547
  }
1548
1548
  previous = now;
1549
1549
  result = func.apply(context, args);
1550
1550
  if (!timeout) context = args = null;
1551
1551
  } else if (!timeout && options.trailing !== false) {
1552
1552
  timeout = setTimeout(later, remaining);
1553
1553
  }
1554
1554
  return result;
1555
1555
  };
1556
1556
  let timer: any = null;
1557
1557
  return function () {
1558
1558
  const context: any = this;
1559
1559
  const args = arguments;
1560
1560
  timer && clearTimeout(timer);
1561
1561
  timer = setTimeout(function () {
1562
1562
  fn.apply(context, args);
1563
1563
  }, delay);
1564
1564
  };
1565
1565
  if (txt) {
1566
1566
  txt = txt.trim();
1567
1567
  const reg = new RegExp(/[\d-]+/);
1568
1568
  const res = reg.exec(txt);
1569
1569
  if (res && res.length > 0) {
1570
1570
  let tel = res[0];
1571
1571
  if (tel && delSeparator) {
1572
1572
  tel = tel.replace(/-/g, '');
1573
1573
  }
1574
1574
  return tel;
1575
1575
  }
1576
1576
  }
1577
1577
  return '';
1578
1578
  if (rgb) {
1579
1579
  const reg = /^(rgb|RGB)/;
1580
1580
  const color = rgb;
1581
1581
  if (reg.test(color)) {
1582
1582
  let strHex = '#';
1583
1583
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
1584
1584
  for (let i = 0; i < colorArr.length; i++) {
1585
1585
  let hex = Number(colorArr[i]).toString(16);
1586
1586
  if (hex === '0') {
1587
1587
  hex += hex;
1588
1588
  }
1589
1589
  strHex += hex;
1590
1590
  }
1591
1591
  return strHex;
1592
1592
  } else {
1593
1593
  return String(color);
1594
1594
  }
1595
1595
  } else {
1596
1596
  return '';
1597
1597
  }
1598
1598
  if (hex) {
1599
1599
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
1600
1600
  let color = hex.toLowerCase();
1601
1601
  if (reg.test(color)) {
1602
1602
  if (color.length === 4) {
1603
1603
  let colorNew = '#';
1604
1604
  for (let i = 1; i < 4; i += 1) {
1605
1605
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
1606
1606
  }
1607
1607
  color = colorNew;
1608
1608
  }
1609
1609
  const colorChange: number[] = [];
1610
1610
  for (let i = 1; i < 7; i += 2) {
1611
1611
  colorChange.push(parseInt('0x' + color.slice(i, i + 2)));
1612
1612
  }
1613
1613
  if (returnList) {
1614
1614
  return colorChange;
1615
1615
  } else {
1616
1616
  return 'RGB(' + colorChange.join(',') + ')';
1617
1617
  }
1618
1618
  } else {
1619
1619
  return color;
1620
1620
  }
1621
1621
  } else {
1622
1622
  return '';
1623
1623
  }
1624
1624
  const c = m - n + 1;
1625
1625
  const res = Math.floor(Math.random() * c + n);
1626
1626
  if (filterNum && filterNum == res) {
1627
1627
  console.log('随机数二次开始', res, filterNum);
1628
1628
  return getRandom(n, m, filterNum);
1629
1629
  } else {
1630
1630
  return res;
1631
1631
  }
1632
1632
  wqCookieStr: string;
1633
1633
  wqCookie: {
1634
1634
  pin?: string;
1635
1635
  visitkey?: string;
1636
1636
  [key: string]: any;
1637
1637
  };
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
 
1682
1682
  createUseCookieArr.forEach((keyItem) => {
1683
1683
  if (keyItem && keyItem['name']) {
1684
1684
  let { name, value } = keyItem;
1685
1685
  name = name === 'jdpin' ? 'pin' : name;
1686
1686
  name === 'pin' && ret.push(`pt_pin=${encodeURIComponent(value)}`);
1687
1687
  ret.push(`${name}=${encodeURIComponent(value)}`);
1688
1688
  getUserCookieObj[name] = value;
1689
1689
  }
1690
1690
  });
1691
1691
  return {
1692
1692
  wqCookieStr: ret.join(';'),
1693
1693
  wqCookie: getUserCookieObj,
1694
1694
  };
1695
1695
  const getLayoutWidth = layoutWidth || global.info?.sysInfo?.windowWidth || windowWidth;
1696
1696
  const getNum = Number(num);
1697
1697
  return Math.round((getNum / widthSize) * getLayoutWidth);
1698
1698
  let checkState = false;
1699
1699
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag;
1700
1700
  if (couponFloorModuleType === FloorModuleType.COUPON) {
1701
1701
  try {
1702
1702
  const dataDefines = getFloorDataToDataDefines(floorData);
1703
1703
  const couponDataDefine = dataDefines
1704
1704
  ? dataDefines.filter((item) => {
1705
1705
  return item.type === 'coupon';
1706
1706
  })
1707
1707
  : [],
1708
1708
  couponList = couponDataDefine[0]?.nodeText?.data ? couponDataDefine[0]?.nodeText?.data : [],
1709
1709
  couponLength = couponList.length,
1710
1710
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
1711
1711
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
1712
1712
  : 0;
1713
1713
  if (numShowPerLine === 0 && couponLength > 3) {
1714
1714
  checkState = true;
1715
1715
  }
1716
1716
  } catch (e) {
1717
1717
  checkState = false;
1718
1718
  }
1719
1719
  return checkState;
1720
1720
  }
1721
1721
  const {
1722
1722
  containers = [],
1723
1723
  floors = [],
1724
1724
  clearFirstContaierMarginTop = false,
1725
1725
  } = pageData;
1726
1726
  console.log('dealShopContentData:', pageData, 'isvdev:', isvdev);
1727
1727
  const getThisTimeKey = Date.now();
1728
1728
  let shopContentContainerListData = containers?.filter(
1729
1729
  (item) => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
1730
1730
  );
1731
1731
  const shopContentFloorListData = floors?.filter(
1732
1732
  ({ floorPosition }) =>
1733
1733
  (!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') || isvdev,
1734
1734
  );
1735
1735
  const unableIsvContainerListData = getUnableIsvContainerListData(
1736
1736
  shopContentFloorListData,
1737
1737
  shopContentContainerListData,
1738
1738
  exceptionReportFn,
1739
1739
  );
1740
1740
  shopContentContainerListData.forEach((item, index) => {
1741
1741
  item.key = `${getThisTimeKey + index}`;
1742
1742
  item.floors = [];
1743
1743
  item.includeUids &&
1744
1744
  item.includeUids.forEach((floorUid) => {
1745
1745
  const getFloorData = shopContentFloorListData.find(
1746
1746
  (floorItem) => floorItem.uid === floorUid,
1747
1747
  );
1748
1748
  if (getFloorData) {
1749
1749
  const changeFloorData = {
1750
1750
  containerId: item.containerId,
1751
1751
  containerIndex: index,
1752
1752
  ...getFloorData,
1753
1753
  };
1754
1754
  const getCheckMoreCouponState = checkCouponAndChangeContainerSetData(getFloorData);
1755
1755
  if (getCheckMoreCouponState) {
1756
1756
  item.marginLeft && (item.marginLeft = 0);
1757
1757
  item.marginRight && (item.marginRight = 0);
1758
1758
  item.borderRadius && (item.borderRadius = 0);
1759
1759
  }
1760
1760
  if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
1761
1761
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn);
1762
1762
  !getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1);
1763
1763
  }
1764
1764
  item.floors.push(changeFloorData);
1765
1765
  }
1766
1766
  });
1767
1767
  if (
1768
1768
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
1769
1769
  item?.containerPosition == 'content' &&
1770
1770
  item?.marginBottom > 0 &&
1771
1771
  !clearFirstContaierMarginTop
1772
1772
  ) {
1773
1773
  item.marginTop = item.marginBottom;
1774
1774
  }
1775
1775
  });
1776
1776
  shopContentContainerListData = shopContentContainerListData.filter(
1777
1777
  (item) =>
1778
1778
  item.floors.length > 0 &&
1779
1779
  unableIsvContainerListData.every(
1780
1780
  (containerItem) => containerItem.containerId != item.containerId,
1781
1781
  ),
1782
1782
  );
1783
1783
  console.log(
1784
1784
  'dealShopContentData isWxMinAndWxapp:',
1785
1785
  isWxMinAndWxapp,
1786
1786
  'weappJumpToH5:',
1787
1787
  pageData?.homeExtInfo?.weappJumpToH5,
1788
1788
  );
1789
1789
  if (isProd && isWxMinAndWxapp) {
1790
1790
  shopContentContainerListData = shopContentContainerListData.filter(
1791
1791
  (item) =>
1792
1792
  item.floors.length > 0 &&
1793
1793
  !isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData),
1794
1794
  );
1795
1795
  }
1796
1796
  shopContentContainerListData = [].concat(shopContentContainerListData);
1797
1797
  return {
1798
1798
  shopContentContainerListData,
1799
1799
  shopContentFloorListData,
1800
1800
  };
1801
1801
  const changeOpts = {
1802
1802
  title: '',
1803
1803
  icon: 'success',
1804
1804
  duration: 1500,
1805
1805
  mask: true,
1806
1806
  ...options,
1807
1807
  };
1808
1808
  if (changeOpts.title.length > 7) {
1809
1809
  showNormalToast(options);
1810
1810
  } else {
1811
1811
  Taro.showToast(changeOpts as any);
1812
1812
  }
1813
1813
  const changeOpts = {
1814
1814
  title: '',
1815
1815
  icon: 'error',
1816
1816
  duration: 1500,
1817
1817
  mask: true,
1818
1818
  ...options,
1819
1819
  };
1820
1820
  if (changeOpts.title.length > 7) {
1821
1821
  showNormalToast(options);
1822
1822
  } else {
1823
1823
  Taro.showToast(changeOpts as any);
1824
1824
  }
1825
1825
  Taro.showToast({
1826
1826
  title: '',
1827
1827
  icon: 'none',
1828
1828
  duration: 1500,
1829
1829
  mask: true,
1830
1830
  ...options,
1831
1831
  });
1832
1832
  return Taro.showLoading({
1833
1833
  title: text,
1834
1834
  });
1835
1835
  return new Promise(() => {
1836
1836
  Taro.nextTick(() => {
1837
1837
  setTimeout(() => {
1838
1838
  Taro.hideLoading(options);
1839
1839
  }, 300);
1840
1840
  });
1841
1841
  });
1842
1842
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
1843
1843
  const {
1844
1844
  tabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
1845
1845
  sceneId,
1846
1846
  } = query;
1847
1847
  let changeTabActive = tabActive;
1848
1848
  if (sceneId) {
1849
1849
  if (isH5) {
1850
1850
  if (sceneId == '1002') {
1851
1851
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1852
1852
  }
1853
1853
  else if (sceneId == '1003') {
1854
1854
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
1855
1855
  }
1856
1856
  } else if (isWxMinAndWxapp) {
1857
1857
  if (sceneId == '1001' || sceneId == '1002') {
1858
1858
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1859
1859
  }
1860
1860
  else if (sceneId == '1003') {
1861
1861
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
1862
1862
  }
1863
1863
  }
1864
1864
  }
1865
1865
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
1866
1866
  return {
1867
1867
  menuType: SHOP_MENU_ID_TYPE.HOME,
1868
1868
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
1869
1869
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
1870
1870
  };
1871
1871
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
1872
1872
  return {
1873
1873
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
1874
1874
  tabActiveType: 0,
1875
1875
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
1876
1876
  };
1877
1877
  } else {
1878
1878
  return {
1879
1879
  menuType: SHOP_MENU_ID_TYPE.HOME,
1880
1880
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
1881
1881
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
1882
1882
  };
1883
1883
  }
1884
1884
  const deleteKeyList = [
1885
1885
  '$taroTimestamp',
1886
1886
  'cookie',
1887
1887
  'wdref',
1888
1888
  'navStart',
1889
1889
  'originOpts',
1890
1890
  'originParams',
1891
1891
  'originUrl',
1892
1892
  'referer',
1893
1893
  'stamp',
1894
1894
  'hybrid',
1895
1895
  'sr',
1896
1896
  'navh',
1897
1897
  'stath',
1898
1898
  ];
1899
1899
  let changeQueryData: any = { ...queryData };
1900
1900
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
1901
1901
  const sceneQuery =
1902
1902
  qrCodeScene && typeof qrCodeScene === 'string'
1903
1903
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
1904
1904
  : {};
1905
1905
  changeQueryData = { ...changeQueryData, ...sceneQuery };
1906
1906
  deleteKeyList.forEach((key) => {
1907
1907
  changeQueryData[key] && delete changeQueryData[key];
1908
1908
  });
1909
1909
  changeQueryData['shopid'] &&
1910
1910
  (changeQueryData['shopId'] = changeQueryData['shopid']) &&
1911
1911
  delete changeQueryData['shopid'];
1912
1912
  changeQueryData['venderid'] &&
1913
1913
  (changeQueryData['venderId'] = changeQueryData['venderid']) &&
1914
1914
  delete changeQueryData['venderid'];
1915
1915
  changeQueryData['vendorId'] &&
1916
1916
  (changeQueryData['venderId'] = changeQueryData['vendorId']) &&
1917
1917
  delete changeQueryData['vendorId'];
1918
1918
  changeQueryData['shopId'] &&
1919
1919
  changeQueryData['shopId'] === 'undefined' &&
1920
1920
  delete changeQueryData['shopId'];
1921
1921
  changeQueryData['venderId'] &&
1922
1922
  changeQueryData['venderId'] === 'undefined' &&
1923
1923
  delete changeQueryData['venderId'];
1924
1924
  return changeQueryData;
1925
1925
  let isUsable = false;
1926
1926
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
1927
1927
  const modularPackResultObj = formatPackResult(modularPackResult);
1928
1928
  const bundleUrl = getBundleUrl(modularPackResultObj);
1929
1929
  const bundleFileName = getBundleFileName(modularPackResultObj);
1930
1930
  const taroVersion = getTaroVersion(modularPackResultObj);
1931
1931
  if (bundleUrl && bundleFileName) {
1932
1932
  isUsable = true;
1933
1933
  }
1934
1934
  if (!isUsable && typeof exceptionReportFn === 'function') {
1935
1935
  exceptionReportFn({
1936
1936
  code: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${
1937
1937
  floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE
1938
1938
  ? SgmCustomCode.SYSTEMPDCMODULE_DATA
1939
1939
  : SgmCustomCode.REMOTEMODULE_DATA
1940
1940
  }`,
1941
1941
  msg: {
1942
1942
  msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
1943
1943
  floorIdx: floorData?.floorIdx,
1944
1944
  uid: floorData?.uid,
1945
1945
  shopId: floorData?.floorExtInfo?.shopId,
1946
1946
  moduleId: floorData?.moduleId,
1947
1947
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
1948
1948
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
1949
1949
  floorKind: floorData?.floorExtInfo?.floorKind,
1950
1950
  middleTemplateId: floorData?.middleTemplateId,
1951
1951
  modularPackResult: {
1952
1952
  bundleUrl,
1953
1953
  taroVersion,
1954
1954
  },
1955
1955
  },
1956
1956
  });
1957
1957
  }
1958
1958
  return isUsable;
1959
1959
  const objContainer = containerListData.find((item) => item.containerId === containerId);
1960
1960
  return (
1961
1961
  objContainer?.includeUids?.some((itemUid) => {
1962
1962
  const objectFloor = floorListData.find((floorItem) => itemUid === floorItem.uid);
1963
1963
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag);
1964
1964
  }) ?? false
1965
1965
  );
1966
1966
  const unableIsvFloorListData = floorListData.filter(
1967
1967
  (floorItem) =>
1968
1968
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
1969
1969
  !isIsvFloorUseable(floorItem, exceptionReportFn),
1970
1970
  );
1971
1971
  const unableIsvFloorUidList = unableIsvFloorListData.map((floorItem) => floorItem.uid);
1972
1972
  const unableIsvContainerListData = containerListData.filter(
1973
1973
  (item) =>
1974
1974
  item.includeUids &&
1975
1975
  item.includeUids.every((itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1),
1976
1976
  );
1977
1977
  return unableIsvContainerListData;
1978
1978
  console.log('暂无对应渠道比较', compareVersion, nowVersion);
1979
1979
  return -2;
1980
1980
  return customObj;
1981
1981
  return customObj;
1982
1982
  return customObj;
1983
1983
  return customObj;
1984
1984
  return customObj;
1985
1985
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl);
1986
1986
  let getParams = false;
1987
1987
  if (isOpenJdAppUrl(openAppUrl)) {
1988
1988
  try {
1989
1989
  getParams = openAppUrl.replace(/openApp\.jdMobile:\/\/virtual\?params=/i, '');
1990
1990
  getParams = JSON.parse(String(getParams));
1991
1991
  } catch (e) {
1992
1992
  console.log(e);
1993
1993
  }
1994
1994
  }
1995
1995
  return getParams;
1996
1996
  const getLastParams = Object.assign({}, openParams);
1997
1997
  return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`;
1998
1998
  if (val === null || val === '' || typeof val === 'undefined') {
1999
1999
  return true;
2000
2000
  }
2001
2001
  return false;
2002
2002
  const {
2003
2003
  moduleId = 'none',
2004
2004
  entrance = 'none',
2005
2005
  sourceType = 'none',
2006
2006
  sourceValue = 'none',
2007
2007
  } = params;
2008
2008
  if (isIosDevice) {
2009
2009
  return `${moduleId}#${entrance}`;
2010
2010
  } else if (isAndroidDevice) {
2011
2011
  return `${sourceType}#${sourceValue}`;
2012
2012
  }
2013
2013
  return 'none#none';
2014
2014
  if (data && typeof data === 'object') {
2015
2015
  let getOpenAppData = { ...data };
2016
2016
  try {
2017
2017
  const { sourceInfo, designerId, templateId, source } = getOpenAppData;
2018
2018
  if (designerId && templateId) {
2019
2019
  getOpenAppData = Object.assign({}, getOpenAppData, {
2020
2020
  sourceInfo: {
2021
2021
  entrance: '设计师预览',
2022
2022
  },
2023
2023
  });
2024
2024
  } else if (sourceInfo) {
2025
2025
  const { entrance } = sourceInfo;
2026
2026
  getOpenAppData.sourceInfo.entrance = entrance && entrance.length > 0 ? entrance : '其他';
2027
2027
  } else if (source && !sourceInfo) {
2028
2028
  if (typeof source === 'object') {
2029
2029
  const { sourceType, entrance, sourceValue, moduleId } = source;
2030
2030
  getOpenAppData = Object.assign({}, getOpenAppData, {
2031
2031
  sourceInfo: {
2032
2032
  entrance: sourceType || entrance || '其他',
2033
2033
  moduleId: sourceValue || moduleId || '-100',
2034
2034
  },
2035
2035
  });
2036
2036
  if (sourceType === 'shop_from_product_detail' && sourceValue) {
2037
2037
  getOpenAppData.sourceSku = sourceValue;
2038
2038
  }
2039
2039
  } else {
2040
2040
  getOpenAppData = Object.assign({}, getOpenAppData, {
2041
2041
  sourceInfo: {
2042
2042
  entrance: source,
2043
2043
  },
2044
2044
  });
2045
2045
  }
2046
2046
  } else {
2047
2047
  getOpenAppData = Object.assign({}, getOpenAppData, {
2048
2048
  sourceInfo: {
2049
2049
  entrance: '其他',
2050
2050
  },
2051
2051
  });
2052
2052
  }
2053
2053
  } catch (e) {
2054
2054
  console.log(e);
2055
2055
  }
2056
2056
  return getOpenAppData;
2057
2057
  }
2058
2058
  return data;
2059
2059
  return displayObj;
2060
2060
  if (typeof input === 'string') {
2061
2061
  try {
2062
2062
  return JSON.parse(input);
2063
2063
  } catch (e) {
2064
2064
  console.error('JSON解析失败', e);
2065
2065
  return {};
2066
2066
  }
2067
2067
  }
2068
2068
  return input || {};
2069
2069
  return false;
2070
2070
  const borderStyle: { [key: string]: any } = {};
2071
2071
  if (item?.borderRadius) {
2072
2072
  let borderTopRadius = 0;
2073
2073
  let borderBottomRadius = 0;
2074
2074
  if (index === 0) {
2075
2075
  borderTopRadius = item.borderRadius;
2076
2076
  borderBottomRadius = floorDataLen === 1 || item?.marginBottom !== 0 ? item.borderRadius : 0;
2077
2077
  } else if (index === floorDataLen - 1) {
2078
2078
  borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
2079
2079
  borderBottomRadius = item.borderRadius;
2080
2080
  } else {
2081
2081
  borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
2082
2082
  borderBottomRadius = item?.marginBottom === 0 ? 0 : item.borderRadius;
2083
2083
  }
2084
2084
  borderStyle.borderTopLeftRadius = item?.borderTopLeftRadius
2085
2085
  ? `${item?.borderTopLeftRadius}px`
2086
2086
  : `${borderTopRadius}px`;
2087
2087
  borderStyle.borderTopRightRadius = item?.borderTopRightRadius
2088
2088
  ? `${item?.borderTopRightRadius}px`
2089
2089
  : `${borderTopRadius}px`;
2090
2090
  borderStyle.borderBottomLeftRadius = `${borderBottomRadius}px`;
2091
2091
  borderStyle.borderBottomRightRadius = `${borderBottomRadius}px`;
2092
2092
  } else {
2093
2093
  borderStyle.borderTopLeftRadius = borderStyle?.borderTopLeftRadius || '0px';
2094
2094
  borderStyle.borderTopRightRadius = borderStyle?.borderTopRightRadius || '0px';
2095
2095
  borderStyle.borderBottomRightRadius = borderStyle?.borderBottomRightRadius || '0px';
2096
2096
  borderStyle.borderBottomLeftRadius = borderStyle?.borderBottomLeftRadius || '0px';
2097
2097
  }
2098
2098
  return borderStyle;
2099
2099
  return customObj;
2100
2100
  isJdApp,
2101
2101
  isWxApp,
2102
2102
  isIosDevice,
2103
2103
  isAndroidDevice,
2104
2104
  isJdAndIosDevice,
2105
2105
  isJdAndAndroidDevice,
2106
2106
  isWxMin,
2107
2107
  isWxMinAndWxapp,
2108
2108
  isJdMin,
2109
2109
  isMin,
2110
2110
  isJdMinAndHarmony,
2111
2111
  isH5,
2112
2112
  isH5AndJdShopView,
2113
2113
  isImageOptimizeEnable,
2114
2114
  isChartH5,
2115
2115
  isH5AndJdShopViewNativeScroll,
2116
2116
  isH5AndJdShopViewH5Scroll,
2117
2117
  isH5AndJdShopH5CustomScrollView,
2118
2118
  isWxMiniH5View,
2119
2119
  sliceArrToChunkList,
2120
2120
  dealAddress,
2121
2121
  objectToUrlEncode,
2122
2122
  parseQueryUrlString,
2123
2123
  setLowSmallPicUrl,
2124
2124
  getJfsImage,
2125
2125
  getQualityImage,
2126
2126
  countStringify,
2127
2127
  setTaroStorage,
2128
2128
  getTaroStorageKeyValue,
2129
2129
  removeTaroStorageKey,
2130
2130
  clearTaroStorageKey,
2131
2131
  getSystemInfos,
2132
2132
  addHttps,
2133
2133
  dateFormat,
2134
2134
  throttle,
2135
2135
  lodashThrottle,
2136
2136
  debounce,
2137
2137
  getTelephone,
2138
2138
  rgbToHex,
2139
2139
  hexToRgb,
2140
2140
  getRandom,
2141
2141
  getWxAppCookieStr,
2142
2142
  pxTransformFromData,
2143
2143
  dealShopContentData,
2144
2144
  showSuccessToast,
2145
2145
  showFailToast,
2146
2146
  showNormalToast,
2147
2147
  showShopLoading,
2148
2148
  hideShopLoading,
2149
2149
  getAppChannelType,
2150
2150
  formatTabActiveMenuType,
2151
2151
  filterUrlQueryData,
2152
2152
  getAvifSupport,
2153
2153
  getWebpSupport,
2154
2154
  isMemberPage,
2155
2155
  sgmCustomReport,
2156
2156
  draCustomReport,
2157
2157
  remoteCustomReport,
2158
2158
  draInterfaceCustomReport,
2159
2159
  draBusinessCustomReport,
2160
2160
  isOpenJdAppUrl,
2161
2161
  jdOpenAppParams,
2162
2162
  createJdOpenAppUrl,
2163
2163
  dealJdOpenAppData,
2164
2164
  isEmpty,
2165
2165
  getJdAppReportPageSource,
2166
2166
  isAppClassifyPage,
2167
2167
  getQualityImageNew,
2168
2168
  getQualityImageOld,
2169
2169
  isPc,
2170
2170
  ipLoc_djd,
2171
2171
  jdAppVersionCompare,
2172
2172
  dealNativePixelToCssPixel,
2173
2173
  isAppStowShop,
2174
2174
  isIpadDevice,
2175
2175
  getBorderStyle,
2176
2176
  isLanguageForEn,
2177
2177
  sColor,
2178
2178
  draInterfaceDSMCustomReport,
2179
2179
  isTabletDevice,