@conecli/cone-render 0.9.1-isv2.0 → 0.9.1-isv2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/const.ts +1 -1
  3. package/dist/common/environmentType.ts +1 -0
  4. package/dist/common/index.h5.ts +1 -1
  5. package/dist/common/index.jd.ts +1 -1
  6. package/dist/common/index.ts +1 -1
  7. package/dist/common/index.weapp.ts +1 -1
  8. package/dist/common/jdplayerSdk.ts +1 -0
  9. package/dist/common/jssdk.ts +1 -0
  10. package/dist/common/pageType.ts +1 -0
  11. package/dist/common/sgmCustomCode.ts +1 -0
  12. package/dist/common/token/index.h5.ts +1 -1
  13. package/dist/common/token/token.jd.ts +1 -1
  14. package/dist/common/token/token.ts +1 -1
  15. package/dist/common/wxappApi.jd.ts +1 -0
  16. package/dist/components/ErrorBoundary.tsx +1 -1
  17. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  18. package/dist/components/base/CountDown/index.tsx +1 -1
  19. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  20. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  21. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  22. package/dist/components/base/CustomVideo/index.tsx +1 -1
  23. package/dist/components/base/Dialog/index.module.scss +5 -0
  24. package/dist/components/base/Dialog/index.tsx +1 -1
  25. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  26. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  28. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  29. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  30. package/dist/components/base/InViewRender/index.tsx +1 -1
  31. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  32. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  33. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  34. package/dist/components/base/LazyLoadImage/index.h5.module.scss +20 -20
  35. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  36. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  37. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  38. package/dist/components/base/NetworkDataError/const.ts +1 -1
  39. package/dist/components/base/NetworkDataError/index.module.scss +4 -0
  40. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  41. package/dist/components/base/Price/Double/index.tsx +1 -1
  42. package/dist/components/base/Price/index.tsx +1 -1
  43. package/dist/components/decorate/DecorateFloorModule/index.module.scss +21 -2
  44. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  45. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  46. package/dist/components/floorItem.jd.tsx +1 -1
  47. package/dist/components/floorItem.tsx +1 -1
  48. package/dist/components/floorItem.weapp.tsx +1 -1
  49. package/dist/components/isv/Floor/index.tsx +1 -1
  50. package/dist/components/remoteFloorItem.tsx +1 -1
  51. package/dist/interface/common.ts +1 -1
  52. package/dist/interface/component.ts +1 -1
  53. package/dist/interface/jumpEventReport.ts +1 -1
  54. package/dist/interface/service.ts +1 -1
  55. package/dist/interface/utils.ts +1 -1
  56. package/dist/jumpEventReport/base.ts +1 -1
  57. package/dist/jumpEventReport/const.ts +1 -1
  58. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  59. package/dist/jumpEventReport/index.h5.ts +1 -1
  60. package/dist/jumpEventReport/index.jd.ts +1 -1
  61. package/dist/jumpEventReport/index.weapp.ts +1 -1
  62. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  63. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  64. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  65. package/dist/jumpEventReport/web/report.ts +1 -1
  66. package/dist/jumpEventReport/web.base.ts +1 -1
  67. package/dist/jumpEventReport/web.jd.ts +1 -1
  68. package/dist/jumpEventReport/web.jdb.ts +1 -1
  69. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  70. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  71. package/dist/jumpEventReport/web.pc.ts +1 -0
  72. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  73. package/dist/jumpEventReport/web.tjm.ts +1 -0
  74. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  75. package/dist/modules/ContainerFloorList/index.h5.module.scss +17 -1
  76. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  77. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  78. package/dist/open/api/environment.ts +1 -1
  79. package/dist/open/api/index.ts +1 -1
  80. package/dist/open/api/jump copy.ts +1 -1
  81. package/dist/open/api/request.ts +1 -1
  82. package/dist/open/api/shopMember.ts +1 -1
  83. package/dist/open/api/track.ts +1 -1
  84. package/dist/open/api/util.ts +1 -1
  85. package/dist/open/components/index.ts +1 -1
  86. package/dist/sass/app.h5.scss +44 -3
  87. package/dist/sass/base.scss +12 -0
  88. package/dist/service/fetchGateway.ts +1 -1
  89. package/dist/service/http/const.ts +1 -1
  90. package/dist/service/requestServer.ts +1 -1
  91. package/dist/utils/connectNativeJsBridge.ts +1 -1
  92. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  93. package/dist/utils/draExceptionAndProfile.ts +1 -1
  94. package/dist/utils/h5Utils.ts +1 -1
  95. package/dist/utils/index.h5.ts +1 -1
  96. package/dist/utils/index.ts +1 -1
  97. package/dist/utils/index.weapp.ts +1 -1
  98. package/dist/utils/jm-common.js +1 -1
  99. package/dist/utils/sgmCodeUtils.ts +1 -0
  100. package/dist/utils/utils.ts +1 -1
  101. package/package.json +1 -1
  102. package/dist/customHooks/useDocumentVisibilitychange.ts +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
  getBundleUrl,
12
11
  getBundleFileName,
13
12
  formatPackResult,
14
13
  const resultList: Array<any> = [],
15
14
  arrLen = arr.length
16
15
  if (arrLen) {
17
16
  if (arrLen > size) {
18
17
  for (let i = 0; i < arrLen; i = i + size) {
19
18
  resultList.push(arr.slice(i, i + size))
20
19
  }
21
20
  } else {
22
21
  resultList.push(arr)
23
22
  }
24
23
  }
25
24
  return resultList
26
25
  let _address = ids
27
26
  const _areaAreaSplit = ids.split('.')
28
27
  const _areaAreaSplit2 = ids.split('_')
29
28
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address
30
29
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address
31
30
  return _address
32
31
  const getValue = `${obj[key]}`.replace(/undefined/,'').replace(/null/,'')
33
32
  paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`
34
33
  const result = {}
35
34
  if (
36
35
  !urlOrQueryStr ||
37
36
  ('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
38
37
  ) {
39
38
  return result
40
39
  }
41
40
  if (urlOrQueryStr.indexOf('?') > -1) {
42
41
  const queryStr = urlOrQueryStr.split('?')
43
42
  const queryItemList =
44
43
  queryStr && queryStr.length > 1 ? queryStr[1].split('&') : []
45
44
  const queryItemListLen = queryItemList.length
46
45
  queryItemListLen > 0 &&
47
46
  queryItemList.forEach((item) => {
48
47
  const thisItemList = item.split('=')
49
48
  result[thisItemList[0]] = thisItemList[1]
50
49
  })
51
50
  } else {
52
51
  const queryItemList =
53
52
  urlOrQueryStr.indexOf('&') > -1
54
53
  ? urlOrQueryStr.split('&')
55
54
  : [urlOrQueryStr]
56
55
  const queryItemListLen = queryItemList.length
57
56
  queryItemListLen > 0 &&
58
57
  queryItemList.forEach((item) => {
59
58
  const thisItemList = item.split('=')
60
59
  result[thisItemList[0]] = thisItemList[1]
61
60
  })
62
61
  }
63
62
  return result
64
63
  url: string,
65
64
  size?: {
66
65
  w: number
67
66
  h: number
68
67
  },
69
68
  quality?: number,
70
69
  if (url && size) {
71
70
  const _w = Math.floor(size.w)
72
71
  const _h = Math.floor(size.h)
73
72
  if (url.match(/gif$/i)) {
74
73
  return url
75
74
  } else {
76
75
  if (_w > 0 && _h > 0) {
77
76
  url = url.replace('jfs/', `s${_w}x${_h}_jfs/`)
78
77
  }
79
78
  url += quality != null ? `!q${quality}.dpg` : '.dpg'
80
79
  }
81
80
  }
82
81
  return url
83
82
  url: string,
84
83
  jfsImgInfo: UtilsInterFace.getJfsImageInfo = {},
85
84
  if (url.match(/\.(jpg|png|dpg)$/i)) {
86
85
  const { width, height, quality } = jfsImgInfo
87
86
  if (typeof width === 'number' || typeof height === 'number') {
88
87
  url = url.replace(
89
88
  '/jfs/',
90
89
  `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`,
91
90
  )
92
91
  }
93
92
  if (
94
93
  typeof quality === 'number' &&
95
94
  quality > 0 &&
96
95
  quality < 100 &&
97
96
  url.match(/\.jpg$/i)
98
97
  ) {
99
98
  url += `!q${quality}.dpg`
100
99
  }
101
100
  }
102
101
  return addHttps(url)
103
102
  if(!imgUrl.includes('360buyimg.com')){
104
103
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
105
104
  }
106
105
  if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
107
106
  count: number,
108
107
  fixedNum = 2,
109
108
  unit = '万',
110
109
  maxNum = 10000,
111
110
  count = Number(count)
112
111
  if (count > maxNum) {
113
112
  return (count / maxNum).toFixed(fixedNum) + unit
114
113
  }
115
114
  return count
116
115
  key: string,
117
116
  value: string | object,
118
117
  successBack?: any,
119
118
  failBack?: any,
120
119
  return Taro.setStorage({
121
120
  key: key,
122
121
  data: value,
123
122
  success: successBack,
124
123
  fail: failBack,
125
124
  })
126
125
  return Taro.getStorageSync(key)
127
126
  return Taro.removeStorage({
128
127
  key: key,
129
128
  })
130
129
  return Taro.clearStorage()
131
130
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
132
131
  platform: '',
133
132
  model: '',
134
133
  system: '',
135
134
  }
136
135
  const isIOS = !!systemInfo.system.match(/ios/i)
137
136
  const isAndroid = !!systemInfo.system.match(/android/i)
138
137
  if (!systemInfo.statusBarHeight) {
139
138
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20
140
139
  systemInfo.navBarExtendHeight = 0
141
140
  } else {
142
141
  if (isIOS) {
143
142
  systemInfo.navBarExtendHeight = 4
144
143
  } else {
145
144
  systemInfo.navBarExtendHeight = 0
146
145
  }
147
146
  }
148
147
  let rect = Taro.getMenuButtonBoundingClientRect
149
148
  ? Taro.getMenuButtonBoundingClientRect()
150
149
  : null
151
150
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
152
151
  let gap = 0
153
152
  let width = 96
154
153
  if (systemInfo.platform === 'android') {
155
154
  gap = 8
156
155
  width = 96
157
156
  } else if (systemInfo.platform === 'devtools') {
158
157
  if (isIOS) {
159
158
  gap = 5.5
160
159
  } else {
161
160
  gap = 7.5
162
161
  }
163
162
  } else {
164
163
  gap = 4
165
164
  width = 88
166
165
  }
167
166
  rect = {
168
167
  bottom: systemInfo.statusBarHeight + gap + 32,
169
168
  height: 32,
170
169
  left: systemInfo.windowWidth - width - 10,
171
170
  right: systemInfo.windowWidth - 10,
172
171
  top: systemInfo.statusBarHeight + gap,
173
172
  width,
174
173
  }
175
174
  }
176
175
  const gap = rect.top - systemInfo.statusBarHeight
177
176
  systemInfo.navBarTopToStatusBar = gap
178
177
  systemInfo.navBarHeight = 2 * gap + rect.height
179
178
  systemInfo.capsulePosition = rect
180
179
  systemInfo.isIOS = isIOS
181
180
  systemInfo.isAndroid = isAndroid
182
181
  return systemInfo
183
182
  if (str.match(/^\/\//)) {
184
183
  str = 'https:' + str
185
184
  }
186
185
  return str
187
186
  dateTimeOrdate: Date | string | number | null,
188
187
  format = 'yyyy-MM-dd HH:mm:ss',
189
188
  noPadStart = {
190
189
  M: '0',
191
190
  d: '0',
192
191
  H: '0',
193
192
  m: '0',
194
193
  s: '0',
195
194
  },
196
195
  let dateResult = ''
197
196
  const padStarts = Object.assign(
198
197
  {
199
198
  M: '0',
200
199
  d: '0',
201
200
  H: '0',
202
201
  m: '0',
203
202
  s: '0',
204
203
  },
205
204
  noPadStart,
206
205
  )
207
206
  if (dateTimeOrdate) {
208
207
  let changeDateTimeOrdate = dateTimeOrdate
209
208
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
210
209
  if (getChangeDateTimeToNumber) {
211
210
  changeDateTimeOrdate = getChangeDateTimeToNumber
212
211
  } else {
213
212
  changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/')
214
213
  }
215
214
  const nowDate =
216
215
  dateTimeOrdate instanceof Date
217
216
  ? dateTimeOrdate
218
217
  : new Date(changeDateTimeOrdate)
219
218
  const dateMap = {
220
219
  y: `${nowDate.getFullYear()}`,
221
220
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
222
221
  d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
223
222
  H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
224
223
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
225
224
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
226
225
  }
227
226
  const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
228
227
  const regYear = new RegExp('y')
229
228
  dateResult = format.replace(regDate, (v) => {
230
229
  let changeValue = v
231
230
  if (regYear.test(changeValue)) {
232
231
  const thisYear = dateMap.y
233
232
  const subValueLen = 4 - changeValue.length
234
233
  changeValue = thisYear.substr(subValueLen)
235
234
  } else {
236
235
  const dateKey = v.substr(0, 1)
237
236
  changeValue = dateMap[dateKey]
238
237
  }
239
238
  return changeValue
240
239
  })
241
240
  }
242
241
  return dateResult
243
242
  let timer: any = null
244
243
  let startTime = Date.now()
245
244
  return function () {
246
245
  const curTime = Date.now()
247
246
  const remaining = delay - (curTime - startTime)
248
247
  const context = this
249
248
  const args = arguments
250
249
  clearTimeout(timer)
251
250
  if (remaining <= 0) {
252
251
  func.apply(context, args)
253
252
  startTime = Date.now()
254
253
  } else {
255
254
  timer = setTimeout(func, remaining)
256
255
  }
257
256
  }
258
257
  let context, args, result
259
258
  let timeout = null
260
259
  let previous = 0
261
260
  if (!options) options = {}
262
261
  const later = function () {
263
262
  previous = options.leading === false ? 0 : Date.now()
264
263
  timeout = null
265
264
  result = func.apply(context, args)
266
265
  if (!timeout) context = args = null
267
266
  }
268
267
  return function () {
269
268
  const now = Date.now()
270
269
  if (!previous && options.leading === false) previous = now
271
270
  const remaining = wait - (now - previous)
272
271
  context = this
273
272
  args = arguments
274
273
  if (remaining <= 0 || remaining > wait) {
275
274
  if (timeout) {
276
275
  clearTimeout(timeout)
277
276
  timeout = null
278
277
  }
279
278
  previous = now
280
279
  result = func.apply(context, args)
281
280
  if (!timeout) context = args = null
282
281
  } else if (!timeout && options.trailing !== false) {
283
282
  timeout = setTimeout(later, remaining)
284
283
  }
285
284
  return result
286
285
  }
287
286
  let timer: any = null
288
287
  return function () {
289
288
  const context: any = this
290
289
  const args = arguments
291
290
  timer && clearTimeout(timer)
292
291
  timer = setTimeout(function () {
293
292
  fn.apply(context, args)
294
293
  }, delay)
295
294
  }
296
295
  if (txt) {
297
296
  txt = txt.trim()
298
297
  const reg = new RegExp(/[\d-]+/)
299
298
  const res = reg.exec(txt)
300
299
  if (res && res.length > 0) {
301
300
  let tel = res[0]
302
301
  if (tel && delSeparator) {
303
302
  tel = tel.replace(/-/g, '')
304
303
  }
305
304
  return tel
306
305
  }
307
306
  }
308
307
  return ''
309
308
  if (rgb) {
310
309
  const reg = /^(rgb|RGB)/
311
310
  const color = rgb
312
311
  if (reg.test(color)) {
313
312
  let strHex = '#'
314
313
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
315
314
  for (let i = 0; i < colorArr.length; i++) {
316
315
  let hex = Number(colorArr[i]).toString(16)
317
316
  if (hex === '0') {
318
317
  hex += hex
319
318
  }
320
319
  strHex += hex
321
320
  }
322
321
  return strHex
323
322
  } else {
324
323
  return String(color)
325
324
  }
326
325
  } else {
327
326
  return ''
328
327
  }
329
328
  if (hex) {
330
329
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
331
330
  let color = hex.toLowerCase()
332
331
  if (reg.test(color)) {
333
332
  if (color.length === 4) {
334
333
  let colorNew = '#'
335
334
  for (let i = 1; i < 4; i += 1) {
336
335
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
337
336
  }
338
337
  color = colorNew
339
338
  }
340
339
  const colorChange: number[] = []
341
340
  for (let i = 1; i < 7; i += 2) {
342
341
  colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
343
342
  }
344
343
  if (returnList) {
345
344
  return colorChange
346
345
  } else {
347
346
  return 'RGB(' + colorChange.join(',') + ')'
348
347
  }
349
348
  } else {
350
349
  return color
351
350
  }
352
351
  } else {
353
352
  return ''
354
353
  }
355
354
  n: number,
356
355
  m: number,
357
356
  filterNum: number | undefined = undefined,
358
357
  const c = m - n + 1
359
358
  const res = Math.floor(Math.random() * c + n)
360
359
  if (filterNum && filterNum == res) {
361
360
  console.log('随机数二次开始', res, filterNum)
362
361
  return getRandom(n, m, filterNum)
363
362
  } else {
364
363
  return res
365
364
  }
366
365
  wqCookieStr: string
367
366
  wqCookie: {
368
367
  pin?: string
369
368
  visitkey?: string
370
369
  [key: string]: any
371
370
  }
372
371
  const {
373
372
  jdpin,
374
373
  pinStatus,
375
374
  visitkey,
376
375
  unionid,
377
376
  skey,
378
377
  __jda,
379
378
  __jdv,
380
379
  __wga,
381
380
  wxapp_type,
382
381
  appType
383
382
  } = cookie
384
383
  const ret: string[] = []
385
384
  const getUserCookieObj = {}
386
385
  const createUseCookieArr = [
387
386
  jdpin,
388
387
  pinStatus,
389
388
  visitkey,
390
389
  unionid,
391
390
  skey,
392
391
  __jda,
393
392
  __jdv,
394
393
  __wga,
395
394
  wid,
396
395
  wq_skey,
397
396
  wq_uin,
398
397
  wq_auth_token,
399
398
  wxapp_scene,
400
399
  wq_unionid,
401
400
  wxapp_openid,
402
401
  wxapp_version,
403
402
  wxapp_type,
404
403
  appType
405
404
  name = name === 'jdpin' ? 'pin' : name;
406
405
  name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
407
406
  ret.push(`${name}=${encodeURIComponent(value)}`)
408
407
  getUserCookieObj[name] = value
409
408
  }
410
409
  })
411
410
  return {
412
411
  wqCookieStr: ret.join(';'),
413
412
  wqCookie: getUserCookieObj,
414
413
  }
415
414
  num,
416
415
  widthSize = 375,
417
416
  layoutWidth = windowWidth,
418
417
  const getNum = Number(num)
419
418
  return Math.round((getNum / widthSize) * layoutWidth)
420
419
  let checkState = false
421
420
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
422
421
  if (couponFloorModuleType === FloorModuleType.COUPON) {
423
422
  try {
424
423
  const dataDefines = getFloorDataToDataDefines(floorData)
425
424
  const couponDataDefine = dataDefines
426
425
  ? dataDefines.filter((item) => {
427
426
  return item.type === 'coupon'
428
427
  })
429
428
  : [],
430
429
  couponList = couponDataDefine[0]?.nodeText?.data
431
430
  ? couponDataDefine[0]?.nodeText?.data
432
431
  : [],
433
432
  couponLength = couponList.length,
434
433
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
435
434
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
436
435
  : 0
437
436
  if (numShowPerLine === 0 && couponLength > 3) {
438
437
  checkState = true
439
438
  }
440
439
  } catch (e) {
441
440
  checkState = false
442
441
  }
443
442
  return checkState
444
443
  }
445
444
  const {
446
445
  containers = [],
447
446
  floors = [],
448
447
  clearFirstContaierMarginTop = false,
449
448
  } = pageData
450
449
  console.log('dealShopContentData:', pageData, 'isvdev:', isvdev)
451
450
  const getThisTimeKey = Date.now()
452
451
  let shopContentContainerListData = containers?.filter(
453
452
  (item) => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
454
453
  )
455
454
  const shopContentFloorListData = floors?.filter(
456
455
  ({ floorPosition }) =>
457
456
  (!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') ||
458
457
  isvdev,
459
458
  )
460
459
  const unableIsvContainerListData = getUnableIsvContainerListData(
461
460
  shopContentFloorListData,
462
461
  shopContentContainerListData,
463
462
  exceptionReportFn,
464
463
  )
465
464
  shopContentContainerListData.forEach((item, index) => {
466
465
  item.key = `${getThisTimeKey + index}`
467
466
  item.floors = []
468
467
  item.includeUids &&
469
468
  item.includeUids.forEach((floorUid) => {
470
469
  const getFloorData = shopContentFloorListData.find(
471
470
  (floorItem) => floorItem.uid === floorUid,
472
471
  )
473
472
  if (getFloorData) {
474
473
  const changeFloorData = {
475
474
  containerId: item.containerId,
476
475
  containerIndex: index,
477
476
  ...getFloorData,
478
477
  }
479
478
  const getCheckMoreCouponState =
480
479
  checkCouponAndChangeContainerSetData(getFloorData)
481
480
  if (getCheckMoreCouponState) {
482
481
  item.marginLeft && (item.marginLeft = 0)
483
482
  item.marginRight && (item.marginRight = 0)
484
483
  item.borderRadius && (item.borderRadius = 0)
485
484
  }
486
485
  item.floors.push(changeFloorData)
487
486
  }
488
487
  })
489
488
  if (
490
489
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
491
490
  item?.containerPosition == 'content' &&
492
491
  item?.marginBottom > 0 &&
493
492
  !clearFirstContaierMarginTop
494
493
  ) {
495
494
  item.marginTop = item.marginBottom
496
495
  }
497
496
  })
498
497
  if(isProd && isWxMinAndWxapp){
499
498
  shopContentContainerListData = shopContentContainerListData.filter(
500
499
  (item) =>
501
500
  item.floors.length > 0 &&
502
501
  !isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData)
503
502
  )
504
503
  }
505
504
  shopContentContainerListData = [].concat(shopContentContainerListData)
506
505
  return {
507
506
  shopContentContainerListData,
508
507
  shopContentFloorListData,
509
508
  }
510
509
  const changeOpts = {
511
510
  title: '',
512
511
  icon: 'success',
513
512
  duration: 1500,
514
513
  mask: true,
515
514
  ...options,
516
515
  }
517
516
  if (changeOpts.title.length > 7) {
518
517
  showNormalToast(options)
519
518
  } else {
520
519
  Taro.showToast(changeOpts as any)
521
520
  }
522
521
  const changeOpts = {
523
522
  title: '',
524
523
  icon: 'error',
525
524
  duration: 1500,
526
525
  mask: true,
527
526
  ...options,
528
527
  }
529
528
  if (changeOpts.title.length > 7) {
530
529
  showNormalToast(options)
531
530
  } else {
532
531
  Taro.showToast(changeOpts as any)
533
532
  }
534
533
  Taro.showToast({
535
534
  title: '',
536
535
  icon: 'none',
537
536
  duration: 1500,
538
537
  mask: true,
539
538
  ...options,
540
539
  })
541
540
  return Taro.showLoading({
542
541
  title: text,
543
542
  })
544
543
  return new Promise(() => {
545
544
  Taro.nextTick(() => {
546
545
  setTimeout(() => {
547
546
  Taro.hideLoading(options)
548
547
  }, 300)
549
548
  })
550
549
  })
551
550
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
552
551
  const {
553
552
  tabActive = SECTION_HOME_TAB_NAME_TYPE[
554
553
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
555
554
  ],
556
555
  sceneId,
557
556
  } = query
558
557
  let changeTabActive = tabActive
559
558
  if (sceneId) {
560
559
  if (isH5) {
561
560
  if (sceneId == '1002') {
562
561
  changeTabActive =
563
562
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
564
563
  }
565
564
  else if (sceneId == '1003') {
566
565
  changeTabActive =
567
566
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
568
567
  }
569
568
  } else if (isWxMinAndWxapp) {
570
569
  if (sceneId == '1001' || sceneId == '1002') {
571
570
  changeTabActive =
572
571
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
573
572
  }
574
573
  else if (sceneId == '1003') {
575
574
  changeTabActive =
576
575
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
577
576
  }
578
577
  }
579
578
  }
580
579
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
581
580
  return {
582
581
  menuType: SHOP_MENU_ID_TYPE.HOME,
583
582
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
584
583
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
585
584
  }
586
585
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
587
586
  return {
588
587
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
589
588
  tabActiveType: 0,
590
589
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
591
590
  }
592
591
  } else {
593
592
  return {
594
593
  menuType: SHOP_MENU_ID_TYPE.HOME,
595
594
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
596
595
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
597
596
  }
598
597
  }
599
598
  const deleteKeyList = [
600
599
  '$taroTimestamp',
601
600
  'cookie',
602
601
  'wdref',
603
602
  'navStart',
604
603
  'originOpts',
605
604
  'originParams',
606
605
  'originUrl',
607
606
  'referer',
608
607
  'stamp',
609
608
  ]
610
609
  let changeQueryData: any = { ...queryData }
611
610
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
612
611
  const sceneQuery =
613
612
  qrCodeScene && typeof qrCodeScene == 'string'
614
613
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
615
614
  : {}
616
615
  changeQueryData = { ...changeQueryData, ...sceneQuery }
617
616
  deleteKeyList.forEach((key) => {
618
617
  changeQueryData[key] && delete changeQueryData[key]
619
618
  })
620
619
  changeQueryData['shopid'] &&
621
620
  (changeQueryData['shopId'] = changeQueryData['shopid']) &&
622
621
  delete changeQueryData['shopid']
623
622
  changeQueryData['venderid'] &&
624
623
  (changeQueryData['venderId'] = changeQueryData['venderid']) &&
625
624
  delete changeQueryData['venderid']
626
625
  changeQueryData['vendorId'] &&
627
626
  (changeQueryData['venderId'] = changeQueryData['vendorId']) &&
628
627
  delete changeQueryData['vendorId']
629
628
  return changeQueryData
630
629
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult
631
630
  const modularPackResultObj = formatPackResult(modularPackResult)
632
631
  const bundleUrl = getBundleUrl(modularPackResultObj)
633
632
  const bundleFileName = getBundleFileName(modularPackResultObj)
634
633
  if (bundleUrl && bundleFileName) {
635
634
  isUsable = true
636
635
  }
637
636
  const objContainer = containerListData.find(
638
637
  (item) => item.containerId === containerId,
639
638
  )
640
639
  return (
641
640
  objContainer?.includeUids?.some((itemUid) => {
642
641
  const objectFloor = floorListData.find(
643
642
  (floorItem) => itemUid === floorItem.uid,
644
643
  )
645
644
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
646
645
  }) ?? false
647
646
  )
648
647
  floorListData,
649
648
  containerListData,
650
649
  exceptionReportFn?,
651
650
  const unableIsvFloorListData = floorListData.filter(
652
651
  (floorItem) =>
653
652
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
654
653
  !isIsvFloorUseable(floorItem, exceptionReportFn),
655
654
  )
656
655
  const unableIsvFloorUidList = unableIsvFloorListData.map(
657
656
  (floorItem) => floorItem.uid,
658
657
  )
659
658
  const unableIsvContainerListData = containerListData.filter(
660
659
  (item) =>
661
660
  item.includeUids &&
662
661
  item.includeUids.every(
663
662
  (itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1,
664
663
  ),
665
664
  )
666
665
  return unableIsvContainerListData
667
666
  return customObj
668
667
  isChartH5,
669
668
  isH5AndJdShopViewH5Scroll,
670
669
  isMemberPage,
670
+ import Taro from "@tarojs/taro";
671
671
  SHOP_MENU_ID_TYPE,
672
672
  SHOP_MENU_ID_QUERY_NAME,
673
673
  SECTION_HOME_TAB_TYPE,
674
674
  SECTION_HOME_TAB_NAME_TYPE,
675
675
  SECTION_HOME_TAB_QUERY_TYPE,
676
676
  CHANNEL_TYPE,
677
677
  JDShopViewBusinessPathType,
678
678
  FloorModuleType,
679
679
  RemoteLoadFloorList,
680
680
  getBundleUrl,
681
681
  getBundleFileName,
682
682
  formatPackResult,
683
683
  SgmCustomCode,
684
684
  NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG,
685
685
  if(isH5){
686
686
  const avifCache = getTaroStorageKeyValue(KEY_AVIF)
687
687
  if(avifCache === null || avifCache === ''){
688
688
  const img = new Image()
689
689
  img.onload = function() {
690
690
  if (img.height > 0 && img.width > 0) {
691
691
  setTaroStorage(KEY_AVIF, '1')
692
692
  } else {
693
693
  setTaroStorage(KEY_AVIF, '0')
694
694
  }
695
695
  }
696
696
  img.onerror = () => {
697
697
  setTaroStorage(KEY_AVIF, '0')
698
698
  }
699
699
  img.src = 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
700
700
  }
701
701
  const webpCache = getTaroStorageKeyValue(KEY_WEBP)
702
702
  if(webpCache === null || webpCache === ''){
703
703
  const img = new Image()
704
704
  img.onload = function() {
705
705
  if (img.height > 0 && img.width > 0) {
706
706
  setTaroStorage(KEY_WEBP, '1')
707
707
  } else {
708
708
  setTaroStorage(KEY_WEBP, '0')
709
709
  }
710
710
  }
711
711
  img.onerror = () => {
712
712
  setTaroStorage(KEY_WEBP, '0')
713
713
  }
714
714
  img.src = 'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA=';
715
715
  }
716
716
  }
717
717
  const resultList: Array<any> = [],
718
718
  arrLen = arr.length
719
719
  if (arrLen) {
720
720
  if (arrLen > size) {
721
721
  for (let i = 0; i < arrLen; i = i + size) {
722
722
  resultList.push(arr.slice(i, i + size))
723
723
  }
724
724
  } else {
725
725
  resultList.push(arr)
726
726
  }
727
727
  }
728
728
  return resultList
729
729
  let _address = ids;
730
730
  const _areaAreaSplit = ids.split(".");
731
731
  const _areaAreaSplit2 = ids.split("_");
732
732
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
733
733
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
734
734
  return _address;
735
735
  let paramStr = "";
736
736
  obj &&
737
737
  Object.keys(obj).forEach((key, index) => {
738
738
  const getValue = `${obj[key]}`
739
739
  .replace(/undefined/, "")
740
740
  .replace(/null/, "");
741
741
  paramStr += `${index === 0 ? "" : "&"}${key}=${encodeURIComponent(
742
742
  getValue
743
743
  )}`;
744
744
  });
745
745
  return paramStr;
746
746
  const result = {};
747
747
  if (
748
748
  !urlOrQueryStr ||
749
749
  ("string" !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
750
750
  ) {
751
751
  return result;
752
752
  }
753
753
  if (urlOrQueryStr.indexOf("?") > -1) {
754
754
  const queryStr = urlOrQueryStr.split("?");
755
755
  const queryItemList =
756
756
  queryStr && queryStr.length > 1 ? queryStr[1].split("&") : [];
757
757
  const queryItemListLen = queryItemList.length;
758
758
  queryItemListLen > 0 &&
759
759
  queryItemList.forEach((item) => {
760
760
  const thisItemList = item.split("=");
761
761
  result[thisItemList[0]] = thisItemList[1];
762
762
  });
763
763
  } else {
764
764
  const queryItemList =
765
765
  urlOrQueryStr.indexOf("&") > -1
766
766
  ? urlOrQueryStr.split("&")
767
767
  : [urlOrQueryStr];
768
768
  const queryItemListLen = queryItemList.length;
769
769
  queryItemListLen > 0 &&
770
770
  queryItemList.forEach((item) => {
771
771
  const thisItemList = item.split("=");
772
772
  result[thisItemList[0]] = thisItemList[1];
773
773
  });
774
774
  }
775
775
  return result;
776
776
  url: string,
777
777
  size?: {
778
778
  w: number;
779
779
  h: number;
780
780
  },
781
781
  quality?: number
782
782
  if (url && size) {
783
783
  const _w = Math.floor(size.w);
784
784
  const _h = Math.floor(size.h);
785
785
  if (url.match(/gif$/i)) {
786
786
  return url;
787
787
  } else {
788
788
  if (_w > 0 && _h > 0) {
789
789
  url = url.replace("jfs/", `s${_w}x${_h}_jfs/`);
790
790
  }
791
791
  url += quality != null ? `!q${quality}.dpg` : ".dpg";
792
792
  }
793
793
  }
794
794
  return url;
795
795
  url: string,
796
796
  jfsImgInfo: UtilsInterFace.getJfsImageInfo = {}
797
797
  if (url.match(/\.(jpg|png|dpg)$/i)) {
798
798
  const { width, height, quality } = jfsImgInfo;
799
799
  if (typeof width === "number" || typeof height === "number") {
800
800
  url = url.replace(
801
801
  "/jfs/",
802
802
  `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`
803
803
  );
804
804
  }
805
805
  if (
806
806
  typeof quality === "number" &&
807
807
  quality > 0 &&
808
808
  quality < 100 &&
809
809
  url.match(/\.jpg$/i)
810
810
  ) {
811
811
  url += `!q${quality}.dpg`;
812
812
  }
813
813
  }
814
814
  return addHttps(url);
815
815
  if (imgUrl) {
816
816
  if (
817
817
  !imgUrl.match(
818
818
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i
819
819
  )
820
820
  ) {
821
821
  if (!imgUrl.includes("360buyimg.com")) {
822
822
  imgUrl = "//m.360buyimg.com/cms/" + imgUrl;
823
823
  }
824
824
  if (quality != 100)
825
825
  imgUrl += /\.png/.test(imgUrl) ? ".dpg" : `!q${quality}`;
826
826
  }
827
827
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
828
828
  }
829
829
  return imgUrl;
830
830
  const result = value % step
831
831
  return result === 0? value: (Math.ceil(value / step) * step)
832
832
  const MAX = 3.5
833
833
  return Math.min(window?.devicePixelRatio ?? 2, MAX)
834
834
  isSkuImage: boolean,
835
835
  size: number
836
836
  if (!imgUrl) {
837
837
  console.error('The input parameter imageUrl for the getQualityImage() cannot be empty!')
838
838
  return imgUrl
839
839
  }
840
840
  if(isIgnoreOptimizeFromServer){
841
841
  imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1')
842
842
  }
843
843
  if(!/^((https?):)?\/\//.test(imgUrl)){
844
844
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
845
845
  }
846
846
  const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i
847
847
  if (!imgServerRegExp.test(imgUrl)) {
848
848
  return imgUrl
849
849
  }
850
850
  const {isSkuImage, size} = options || {}
851
851
  const needReduceSize = isSkuImage && size
852
852
  if (needReduceSize){
853
853
  const devicePixelRatio = getDevicePixelRatio()
854
854
  const useWidth = getValueByStep(size * devicePixelRatio, 40)
855
855
  imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useWidth}_jfs/`)
856
856
  }
857
857
  const needCompress = !global?.info?.pageInfo?.isVipShop
858
858
  const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/)
859
859
  if(needCompress && result){
860
860
  if(getAvifSupport() === '1'){
861
861
  imgUrl += '.avif'
862
862
  }else if(getWebpSupport() === '1'){
863
863
  imgUrl += '.webp'
864
864
  }else if(/jpe?g/.test(result[1])){
865
865
  imgUrl += '!q80'
866
866
  }
867
867
  }
868
868
  if (needReduceSize){
869
869
  imgUrl += '!z2'
870
870
  }
871
871
  if(!imgUrl.includes('360buyimg.com')){
872
872
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl
873
873
  }
874
874
  if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
875
875
  return getTaroStorageKeyValue(KEY_AVIF) || '0'
876
876
  return getTaroStorageKeyValue(KEY_WEBP) || '0'
877
877
  count: number,
878
878
  fixedNum = 2,
879
879
  unit = "万",
880
880
  maxNum = 10000
881
881
  count = Number(count);
882
882
  if (count > maxNum) {
883
883
  return (count / maxNum).toFixed(fixedNum) + unit;
884
884
  }
885
885
  return count;
886
886
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
887
887
  platform: "",
888
888
  model: "",
889
889
  system: "",
890
890
  };
891
891
  const isIOS = !!systemInfo.system.match(/ios/i);
892
892
  const isAndroid = !!systemInfo.system.match(/android/i);
893
893
  if (!systemInfo.statusBarHeight) {
894
894
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20;
895
895
  systemInfo.navBarExtendHeight = 0;
896
896
  } else {
897
897
  if (isIOS) {
898
898
  systemInfo.navBarExtendHeight = 4;
899
899
  } else {
900
900
  systemInfo.navBarExtendHeight = 0;
901
901
  }
902
902
  }
903
903
  let rect = Taro.getMenuButtonBoundingClientRect
904
904
  ? Taro.getMenuButtonBoundingClientRect()
905
905
  : null;
906
906
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
907
907
  let gap = 0;
908
908
  let width = 96;
909
909
  if (systemInfo.platform === "android") {
910
910
  gap = 8;
911
911
  width = 96;
912
912
  } else if (systemInfo.platform === "devtools") {
913
913
  if (isIOS) {
914
914
  gap = 5.5;
915
915
  } else {
916
916
  gap = 7.5;
917
917
  }
918
918
  } else {
919
919
  gap = 4;
920
920
  width = 88;
921
921
  }
922
922
  rect = {
923
923
  bottom: systemInfo.statusBarHeight + gap + 32,
924
924
  height: 32,
925
925
  left: systemInfo.windowWidth - width - 10,
926
926
  right: systemInfo.windowWidth - 10,
927
927
  top: systemInfo.statusBarHeight + gap,
928
928
  width,
929
929
  };
930
930
  }
931
931
  const gap = rect.top - systemInfo.statusBarHeight;
932
932
  systemInfo.navBarTopToStatusBar = gap;
933
933
  systemInfo.navBarHeight = 2 * gap + rect.height;
934
934
  systemInfo.capsulePosition = rect;
935
935
  systemInfo.isIOS = isIOS;
936
936
  systemInfo.isAndroid = isAndroid;
937
937
  return systemInfo;
938
938
  if (str.match(/^\/\//)) {
939
939
  str = "https:" + str;
940
940
  }
941
941
  return str;
942
942
  dateTimeOrdate: Date | string | number | null,
943
943
  format = "yyyy-MM-dd HH:mm:ss",
944
944
  noPadStart = {
945
945
  M: "0",
946
946
  d: "0",
947
947
  H: "0",
948
948
  m: "0",
949
949
  s: "0",
950
950
  }
951
951
  let dateResult = "";
952
952
  const padStarts = Object.assign(
953
953
  {
954
954
  M: "0",
955
955
  d: "0",
956
956
  H: "0",
957
957
  m: "0",
958
958
  s: "0",
959
959
  },
960
960
  noPadStart
961
961
  );
962
962
  if (dateTimeOrdate) {
963
963
  let changeDateTimeOrdate = dateTimeOrdate;
964
964
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
965
965
  if (getChangeDateTimeToNumber) {
966
966
  changeDateTimeOrdate = getChangeDateTimeToNumber;
967
967
  } else {
968
968
  changeDateTimeOrdate = `${changeDateTimeOrdate}`
969
969
  .replace(/-/g, "/")
970
970
  .replace(/\./g, "/");
971
971
  }
972
972
  const nowDate =
973
973
  dateTimeOrdate instanceof Date
974
974
  ? dateTimeOrdate
975
975
  : new Date(changeDateTimeOrdate);
976
976
  const dateMap = {
977
977
  y: `${nowDate.getFullYear()}`,
978
978
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts["M"]),
979
979
  d: `${nowDate.getDate()}`.padStart(2, padStarts["d"]),
980
980
  H: `${nowDate.getHours()}`.padStart(2, padStarts["H"]),
981
981
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts["m"]),
982
982
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts["s"]),
983
983
  };
984
984
  const regDate = new RegExp("y+|M+|d+|H+|m+|s+", "g");
985
985
  const regYear = new RegExp("y");
986
986
  dateResult = format.replace(regDate, (v) => {
987
987
  let changeValue = v;
988
988
  if (regYear.test(changeValue)) {
989
989
  const thisYear = dateMap.y;
990
990
  const subValueLen = 4 - changeValue.length;
991
991
  changeValue = thisYear.substr(subValueLen);
992
992
  } else {
993
993
  const dateKey = v.substr(0, 1);
994
994
  changeValue = dateMap[dateKey];
995
995
  }
996
996
  return changeValue;
997
997
  });
998
998
  }
999
999
  return dateResult;
1000
1000
  let timer: any = null;
1001
1001
  let startTime = Date.now();
1002
1002
  return function () {
1003
1003
  const curTime = Date.now();
1004
1004
  const remaining = delay - (curTime - startTime);
1005
1005
  const context = this;
1006
1006
  const args = arguments;
1007
1007
  clearTimeout(timer);
1008
1008
  if (remaining <= 0) {
1009
1009
  func.apply(context, args);
1010
1010
  startTime = Date.now();
1011
1011
  } else {
1012
1012
  timer = setTimeout(func, remaining);
1013
1013
  }
1014
1014
  };
1015
1015
  let context, args, result;
1016
1016
  let timeout = null;
1017
1017
  let previous = 0;
1018
1018
  if (!options) options = {};
1019
1019
  const later = function () {
1020
1020
  previous = options.leading === false ? 0 : Date.now();
1021
1021
  timeout = null;
1022
1022
  result = func.apply(context, args);
1023
1023
  if (!timeout) context = args = null;
1024
1024
  };
1025
1025
  return function () {
1026
1026
  const now = Date.now();
1027
1027
  if (!previous && options.leading === false) previous = now;
1028
1028
  const remaining = wait - (now - previous);
1029
1029
  context = this;
1030
1030
  args = arguments;
1031
1031
  if (remaining <= 0 || remaining > wait) {
1032
1032
  if (timeout) {
1033
1033
  clearTimeout(timeout);
1034
1034
  timeout = null;
1035
1035
  }
1036
1036
  previous = now;
1037
1037
  result = func.apply(context, args);
1038
1038
  if (!timeout) context = args = null;
1039
1039
  } else if (!timeout && options.trailing !== false) {
1040
1040
  timeout = setTimeout(later, remaining);
1041
1041
  }
1042
1042
  return result;
1043
1043
  };
1044
1044
  let timer: any = null;
1045
1045
  return function () {
1046
1046
  const context: any = this;
1047
1047
  const args = arguments;
1048
1048
  timer && clearTimeout(timer);
1049
1049
  timer = setTimeout(function () {
1050
1050
  fn.apply(context, args);
1051
1051
  }, delay);
1052
1052
  };
1053
1053
  if (txt) {
1054
1054
  txt = txt.trim();
1055
1055
  const reg = new RegExp(/[\d-]+/);
1056
1056
  const res = reg.exec(txt);
1057
1057
  if (res && res.length > 0) {
1058
1058
  let tel = res[0];
1059
1059
  if (tel && delSeparator) {
1060
1060
  tel = tel.replace(/-/g, "");
1061
1061
  }
1062
1062
  return tel;
1063
1063
  }
1064
1064
  }
1065
1065
  return "";
1066
1066
  if (rgb) {
1067
1067
  const reg = /^(rgb|RGB)/;
1068
1068
  const color = rgb;
1069
1069
  if (reg.test(color)) {
1070
1070
  let strHex = "#";
1071
1071
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
1072
1072
  for (let i = 0; i < colorArr.length; i++) {
1073
1073
  let hex = Number(colorArr[i]).toString(16);
1074
1074
  if (hex === "0") {
1075
1075
  hex += hex;
1076
1076
  }
1077
1077
  strHex += hex;
1078
1078
  }
1079
1079
  return strHex;
1080
1080
  } else {
1081
1081
  return String(color);
1082
1082
  }
1083
1083
  } else {
1084
1084
  return "";
1085
1085
  }
1086
1086
  if (hex) {
1087
1087
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
1088
1088
  let color = hex.toLowerCase();
1089
1089
  if (reg.test(color)) {
1090
1090
  if (color.length === 4) {
1091
1091
  let colorNew = "#";
1092
1092
  for (let i = 1; i < 4; i += 1) {
1093
1093
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
1094
1094
  }
1095
1095
  color = colorNew;
1096
1096
  }
1097
1097
  const colorChange: number[] = [];
1098
1098
  for (let i = 1; i < 7; i += 2) {
1099
1099
  colorChange.push(parseInt("0x" + color.slice(i, i + 2)));
1100
1100
  }
1101
1101
  if (returnList) {
1102
1102
  return colorChange;
1103
1103
  } else {
1104
1104
  return "RGB(" + colorChange.join(",") + ")";
1105
1105
  }
1106
1106
  } else {
1107
1107
  return color;
1108
1108
  }
1109
1109
  } else {
1110
1110
  return "";
1111
1111
  }
1112
1112
  n: number,
1113
1113
  m: number,
1114
1114
  filterNum: number | undefined = undefined
1115
1115
  const c = m - n + 1;
1116
1116
  const res = Math.floor(Math.random() * c + n);
1117
1117
  if (filterNum && filterNum == res) {
1118
1118
  console.log("随机数二次开始", res, filterNum);
1119
1119
  return getRandom(n, m, filterNum);
1120
1120
  } else {
1121
1121
  return res;
1122
1122
  }
1123
1123
  wqCookieStr: string;
1124
1124
  wqCookie: {
1125
1125
  pin?: string;
1126
1126
  visitkey?: string;
1127
1127
  [key: string]: any;
1128
1128
  };
1129
1129
  const {
1130
1130
  jdpin,
1131
1131
  pinStatus,
1132
1132
  visitkey,
1133
1133
  unionid,
1134
1134
  skey,
1135
1135
  __jda,
1136
1136
  __jdv,
1137
1137
  __wga,
1138
1138
  wid,
1139
1139
  wq_skey,
1140
1140
  wq_uin,
1141
1141
  wq_auth_token,
1142
1142
  wxapp_scene,
1143
1143
  wq_unionid,
1144
1144
  wxapp_openid,
1145
1145
  wxapp_version,
1146
1146
  wxapp_type,
1147
1147
  appType,
1148
1148
  } = cookie;
1149
1149
  const ret: string[] = [];
1150
1150
  const getUserCookieObj = {};
1151
1151
  const createUseCookieArr = [
1152
1152
  jdpin,
1153
1153
  pinStatus,
1154
1154
  visitkey,
1155
1155
  unionid,
1156
1156
  skey,
1157
1157
  __jda,
1158
1158
  __jdv,
1159
1159
  __wga,
1160
1160
  wid,
1161
1161
  wq_skey,
1162
1162
  wq_uin,
1163
1163
  wq_auth_token,
1164
1164
  wxapp_scene,
1165
1165
  wq_unionid,
1166
1166
  wxapp_openid,
1167
1167
  wxapp_version,
1168
1168
  wxapp_type,
1169
1169
  appType,
1170
1170
  ];
1171
1171
  createUseCookieArr.forEach((keyItem) => {
1172
1172
  if (keyItem && keyItem["name"]) {
1173
1173
  let { name, value } = keyItem;
1174
1174
  name = name === "jdpin" ? "pin" : name;
1175
1175
  name === "pin" && ret.push(`pt_pin=${encodeURIComponent(value)}`);
1176
1176
  ret.push(`${name}=${encodeURIComponent(value)}`);
1177
1177
  getUserCookieObj[name] = value;
1178
1178
  }
1179
1179
  });
1180
1180
  return {
1181
1181
  wqCookieStr: ret.join(";"),
1182
1182
  wqCookie: getUserCookieObj,
1183
1183
  };
1184
1184
  num,
1185
1185
  widthSize = 375,
1186
1186
  layoutWidth = windowWidth
1187
1187
  const getNum = Number(num);
1188
1188
  return Math.round((getNum / widthSize) * layoutWidth);
1189
1189
  let checkState = false;
1190
1190
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag;
1191
1191
  if (couponFloorModuleType === FloorModuleType.COUPON) {
1192
1192
  try {
1193
1193
  const dataDefines = getFloorDataToDataDefines(floorData);
1194
1194
  const couponDataDefine = dataDefines
1195
1195
  ? dataDefines.filter((item) => {
1196
1196
  return item.type === "coupon";
1197
1197
  })
1198
1198
  : [],
1199
1199
  couponList = couponDataDefine[0]?.nodeText?.data
1200
1200
  ? couponDataDefine[0]?.nodeText?.data
1201
1201
  : [],
1202
1202
  couponLength = couponList.length,
1203
1203
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
1204
1204
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
1205
1205
  : 0;
1206
1206
  if (numShowPerLine === 0 && couponLength > 3) {
1207
1207
  checkState = true;
1208
1208
  }
1209
1209
  } catch (e) {
1210
1210
  checkState = false;
1211
1211
  }
1212
1212
  return checkState;
1213
1213
  }
1214
1214
  const {
1215
1215
  containers = [],
1216
1216
  floors = [],
1217
1217
  clearFirstContaierMarginTop = false,
1218
1218
  isLuxuryShop = false,
1219
1219
  isShowNativeImmersivePlayer = false,
1220
1220
  screenHeight = null,
1221
1221
  screenWidth = null,
1222
1222
  bottomBarHeight = null,
1223
1223
  } = pageData;
1224
1224
  console.log("dealShopContentData:", pageData, "isvdev:", isvdev);
1225
1225
  const getThisTimeKey = Date.now();
1226
1226
  let shopContentContainerListData = containers?.filter(
1227
1227
  (item) => (!isvdev && item.typeCode !== "mShopHeader") || isvdev
1228
1228
  );
1229
1229
  const shopContentFloorListData = floors?.filter(
1230
1230
  ({ floorPosition }) =>
1231
1231
  (!isvdev && floorPosition !== "header" && floorPosition !== "footer") ||
1232
1232
  isvdev
1233
1233
  );
1234
1234
  const unableIsvContainerListData = getUnableIsvContainerListData(
1235
1235
  shopContentFloorListData,
1236
1236
  shopContentContainerListData,
1237
1237
  exceptionReportFn
1238
1238
  );
1239
1239
  shopContentContainerListData.forEach((item, index) => {
1240
1240
  item.key = `${getThisTimeKey + index}`;
1241
1241
  item.floors = [];
1242
1242
  item.includeUids &&
1243
1243
  item.includeUids.forEach((floorUid) => {
1244
1244
  const getFloorData = shopContentFloorListData.find(
1245
1245
  (floorItem) => floorItem.uid === floorUid
1246
1246
  );
1247
1247
  if (getFloorData) {
1248
1248
  const changeFloorData = {
1249
1249
  containerId: item.containerId,
1250
1250
  containerIndex: index,
1251
1251
  ...getFloorData,
1252
1252
  };
1253
1253
  const getCheckMoreCouponState =
1254
1254
  checkCouponAndChangeContainerSetData(getFloorData);
1255
1255
  if (getCheckMoreCouponState) {
1256
1256
  item.marginLeft && (item.marginLeft = 0);
1257
1257
  item.marginRight && (item.marginRight = 0);
1258
1258
  item.borderRadius && (item.borderRadius = 0);
1259
1259
  }
1260
1260
  if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
1261
1261
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(
1262
1262
  getFloorData,
1263
1263
  exceptionReportFn
1264
1264
  );
1265
1265
  !getSysFloorToLoadTypeRes &&
1266
1266
  (getFloorData.floorExtInfo.floorLoadWay = 1);
1267
1267
  }
1268
1268
  item.floors.push(changeFloorData);
1269
1269
  }
1270
1270
  });
1271
1271
  if (
1272
1272
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
1273
1273
  item?.containerPosition == "content" &&
1274
1274
  item?.marginBottom > 0 &&
1275
1275
  !clearFirstContaierMarginTop
1276
1276
  ) {
1277
1277
  item.marginTop = item.marginBottom;
1278
1278
  }
1279
1279
  });
1280
1280
  shopContentContainerListData = shopContentContainerListData.filter(
1281
1281
  (item) =>
1282
1282
  item.floors.length > 0 &&
1283
1283
  unableIsvContainerListData.every(
1284
1284
  (containerItem) => containerItem.containerId != item.containerId
1285
1285
  )
1286
1286
  );
1287
1287
  console.log(
1288
1288
  "dealShopContentData isWxMinAndWxapp:",
1289
1289
  isWxMinAndWxapp,
1290
1290
  "weappJumpToH5:",
1291
1291
  pageData?.homeExtInfo?.weappJumpToH5
1292
1292
  );
1293
1293
  if (isProd && isWxMinAndWxapp) {
1294
1294
  shopContentContainerListData = shopContentContainerListData.filter(
1295
1295
  (item) =>
1296
1296
  item.floors.length > 0 &&
1297
1297
  !isIsvContainer(
1298
1298
  item.containerId,
1299
1299
  shopContentFloorListData,
1300
1300
  shopContentContainerListData
1301
1301
  )
1302
1302
  );
1303
1303
  }
1304
1304
  shopContentContainerListData = [].concat(shopContentContainerListData);
1305
1305
  return {
1306
1306
  shopContentContainerListData,
1307
1307
  shopContentFloorListData,
1308
1308
  };
1309
1309
  const changeOpts = {
1310
1310
  title: "",
1311
1311
  icon: "success",
1312
1312
  duration: 1500,
1313
1313
  mask: true,
1314
1314
  ...options,
1315
1315
  };
1316
1316
  if (changeOpts.title.length > 7) {
1317
1317
  showNormalToast(options);
1318
1318
  } else {
1319
1319
  Taro.showToast(changeOpts as any);
1320
1320
  }
1321
1321
  const changeOpts = {
1322
1322
  title: "",
1323
1323
  icon: "error",
1324
1324
  duration: 1500,
1325
1325
  mask: true,
1326
1326
  ...options,
1327
1327
  };
1328
1328
  if (changeOpts.title.length > 7) {
1329
1329
  showNormalToast(options);
1330
1330
  } else {
1331
1331
  Taro.showToast(changeOpts as any);
1332
1332
  }
1333
1333
  Taro.showToast({
1334
1334
  title: "",
1335
1335
  icon: "none",
1336
1336
  duration: 1500,
1337
1337
  mask: true,
1338
1338
  ...options,
1339
1339
  });
1340
1340
  return Taro.showLoading({
1341
1341
  title: text,
1342
1342
  });
1343
1343
  return new Promise(() => {
1344
1344
  Taro.nextTick(() => {
1345
1345
  setTimeout(() => {
1346
1346
  Taro.hideLoading(options);
1347
1347
  }, 300);
1348
1348
  });
1349
1349
  });
1350
1350
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
1351
1351
  const {
1352
1352
  tabActive = SECTION_HOME_TAB_NAME_TYPE[
1353
1353
  SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
1354
1354
  ],
1355
1355
  sceneId,
1356
1356
  } = query;
1357
1357
  let changeTabActive = tabActive;
1358
1358
  if (sceneId) {
1359
1359
  if (isH5) {
1360
1360
  if (sceneId == "1002") {
1361
1361
  changeTabActive =
1362
1362
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1363
1363
  }
1364
1364
  else if (sceneId == "1003") {
1365
1365
  changeTabActive =
1366
1366
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
1367
1367
  }
1368
1368
  } else if (isWxMinAndWxapp) {
1369
1369
  if (sceneId == "1001" || sceneId == "1002") {
1370
1370
  changeTabActive =
1371
1371
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1372
1372
  }
1373
1373
  else if (sceneId == "1003") {
1374
1374
  changeTabActive =
1375
1375
  SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
1376
1376
  }
1377
1377
  }
1378
1378
  }
1379
1379
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
1380
1380
  return {
1381
1381
  menuType: SHOP_MENU_ID_TYPE.HOME,
1382
1382
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
1383
1383
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
1384
1384
  };
1385
1385
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
1386
1386
  return {
1387
1387
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
1388
1388
  tabActiveType: 0,
1389
1389
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
1390
1390
  };
1391
1391
  } else {
1392
1392
  return {
1393
1393
  menuType: SHOP_MENU_ID_TYPE.HOME,
1394
1394
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
1395
1395
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
1396
1396
  };
1397
1397
  }
1398
1398
  const deleteKeyList = [
1399
1399
  "$taroTimestamp",
1400
1400
  "cookie",
1401
1401
  "wdref",
1402
1402
  "navStart",
1403
1403
  "originOpts",
1404
1404
  "originParams",
1405
1405
  "originUrl",
1406
1406
  "referer",
1407
1407
  "stamp",
1408
1408
  ];
1409
1409
  let changeQueryData: any = { ...queryData };
1410
1410
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
1411
1411
  const sceneQuery =
1412
1412
  qrCodeScene && typeof qrCodeScene == "string"
1413
1413
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
1414
1414
  : {};
1415
1415
  changeQueryData = { ...changeQueryData, ...sceneQuery };
1416
1416
  deleteKeyList.forEach((key) => {
1417
1417
  changeQueryData[key] && delete changeQueryData[key];
1418
1418
  });
1419
1419
  changeQueryData["shopid"] &&
1420
1420
  (changeQueryData["shopId"] = changeQueryData["shopid"]) &&
1421
1421
  delete changeQueryData["shopid"];
1422
1422
  changeQueryData["venderid"] &&
1423
1423
  (changeQueryData["venderId"] = changeQueryData["venderid"]) &&
1424
1424
  delete changeQueryData["venderid"];
1425
1425
  changeQueryData["vendorId"] &&
1426
1426
  (changeQueryData["venderId"] = changeQueryData["vendorId"]) &&
1427
1427
  delete changeQueryData["vendorId"];
1428
1428
  return changeQueryData;
1429
1429
  let isUsable = false;
1430
1430
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
1431
1431
  const modularPackResultObj = formatPackResult(modularPackResult);
1432
1432
  const bundleUrl = getBundleUrl(modularPackResultObj);
1433
1433
  const bundleFileName = getBundleFileName(modularPackResultObj);
1434
1434
  if (bundleUrl && bundleFileName) {
1435
1435
  isUsable = true;
1436
1436
  }
1437
1437
  if (!isUsable && typeof exceptionReportFn === "function") {
1438
1438
  exceptionReportFn({
1439
1439
  code: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${SgmCustomCode.REMOTEMODULE_DATA}`,
1440
1440
  msg: {
1441
1441
  msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
1442
1442
  floorIdx: floorData?.floorIdx,
1443
1443
  uid: floorData?.uid,
1444
1444
  shopId: floorData?.floorExtInfo?.shopId,
1445
1445
  moduleId: floorData?.moduleId,
1446
1446
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
1447
1447
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
1448
1448
  floorKind: floorData?.floorExtInfo?.floorKind,
1449
1449
  middleTemplateId: floorData?.middleTemplateId,
1450
1450
  modularPackResult: modularPackResult,
1451
1451
  },
1452
1452
  });
1453
1453
  }
1454
1454
  return isUsable;
1455
1455
  const objContainer = containerListData.find(
1456
1456
  (item) => item.containerId === containerId
1457
1457
  );
1458
1458
  return (
1459
1459
  objContainer?.includeUids?.some((itemUid) => {
1460
1460
  const objectFloor = floorListData.find(
1461
1461
  (floorItem) => itemUid === floorItem.uid
1462
1462
  );
1463
1463
  return RemoteLoadFloorList.includes(
1464
1464
  objectFloor?.floorExtInfo?.moduleFlag
1465
1465
  );
1466
1466
  }) ?? false
1467
1467
  );
1468
1468
  floorListData,
1469
1469
  containerListData,
1470
1470
  exceptionReportFn?
1471
1471
  const unableIsvFloorListData = floorListData.filter(
1472
1472
  (floorItem) =>
1473
1473
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
1474
1474
  !isIsvFloorUseable(floorItem, exceptionReportFn)
1475
1475
  );
1476
1476
  const unableIsvFloorUidList = unableIsvFloorListData.map(
1477
1477
  (floorItem) => floorItem.uid
1478
1478
  );
1479
1479
  const unableIsvContainerListData = containerListData.filter(
1480
1480
  (item) =>
1481
1481
  item.includeUids &&
1482
1482
  item.includeUids.every(
1483
1483
  (itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1
1484
1484
  )
1485
1485
  );
1486
1486
  return unableIsvContainerListData;
1487
1487
  return -2;
1488
1488
  return customObj;
1489
1489
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl);
1490
1490
  let getParams = false;
1491
1491
  if (isOpenJdAppUrl(openAppUrl)) {
1492
1492
  try {
1493
1493
  getParams = openAppUrl.replace(
1494
1494
  /openApp\.jdMobile:\/\/virtual\?params=/i,
1495
1495
  ""
1496
1496
  );
1497
1497
  getParams = JSON.parse(String(getParams));
1498
1498
  } catch (e) {
1499
1499
  console.log(e);
1500
1500
  }
1501
1501
  }
1502
1502
  return getParams;
1503
1503
  const getLastParams = Object.assign({}, openParams)
1504
1504
  return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`;
1505
1505
  if (val === null || val === "" || typeof val === "undefined") {
1506
1506
  return true;
1507
1507
  }
1508
1508
  return false;
1509
1509
  const {
1510
1510
  moduleId = "none",
1511
1511
  entrance = "none",
1512
1512
  sourceType = "none",
1513
1513
  sourceValue = "none",
1514
1514
  } = params;
1515
1515
  if (isIosDevice) {
1516
1516
  return `${moduleId}#${entrance}`;
1517
1517
  } else if (isAndroidDevice) {
1518
1518
  return `${sourceType}#${sourceValue}`;
1519
1519
  }
1520
1520
  return "none#none";
1521
1521
  if (data && typeof data === "object") {
1522
1522
  let getOpenAppData = { ...data };
1523
1523
  try {
1524
1524
  const { sourceInfo, designerId, templateId, source } = getOpenAppData;
1525
1525
  if (designerId && templateId) {
1526
1526
  getOpenAppData = Object.assign({}, getOpenAppData, {
1527
1527
  sourceInfo: {
1528
1528
  entrance: "设计师预览",
1529
1529
  },
1530
1530
  });
1531
1531
  } else if (sourceInfo) {
1532
1532
  const { entrance } = sourceInfo;
1533
1533
  getOpenAppData.sourceInfo.entrance =
1534
1534
  entrance && entrance.length > 0 ? entrance : "其他";
1535
1535
  } else if (source && !sourceInfo) {
1536
1536
  if (typeof source === "object") {
1537
1537
  const { sourceType, entrance, sourceValue, moduleId } = source;
1538
1538
  getOpenAppData = Object.assign({}, getOpenAppData, {
1539
1539
  sourceInfo: {
1540
1540
  entrance: sourceType || entrance || "其他",
1541
1541
  moduleId: sourceValue || moduleId || "-100",
1542
1542
  },
1543
1543
  });
1544
1544
  } else {
1545
1545
  getOpenAppData = Object.assign({}, getOpenAppData, {
1546
1546
  sourceInfo: {
1547
1547
  entrance: source,
1548
1548
  },
1549
1549
  });
1550
1550
  }
1551
1551
  } else {
1552
1552
  getOpenAppData = Object.assign({}, getOpenAppData, {
1553
1553
  sourceInfo: {
1554
1554
  entrance: "其他",
1555
1555
  },
1556
1556
  });
1557
1557
  }
1558
1558
  } catch (e) {
1559
1559
  console.log(e);
1560
1560
  }
1561
1561
  return getOpenAppData;
1562
1562
  }
1563
1563
  return data;
1564
1564
  return displayObj;
1565
1565
  if (typeof input === "string") {
1566
1566
  try {
1567
1567
  return JSON.parse(input);
1568
1568
  } catch (e) {
1569
1569
  console.error("JSON解析失败", e);
1570
1570
  return {};
1571
1571
  }
1572
1572
  }
1573
1573
  return input || {};
1574
1574
  return false
1575
1575
  isJdApp,
1576
1576
  isWxApp,
1577
1577
  isIosDevice,
1578
1578
  isAndroidDevice,
1579
1579
  isJdAndIosDevice,
1580
1580
  isJdAndAndroidDevice,
1581
1581
  isWxMin,
1582
1582
  isWxMinAndWxapp,
1583
1583
  isJdMin,
1584
1584
  isMin,
1585
1585
  isJdMinAndHarmony,
1586
1586
  isH5,
1587
1587
  isH5AndJdShopView,
1588
1588
  isImageOptimizeEnable,
1589
1589
  isChartH5,
1590
1590
  isH5AndJdShopViewNativeScroll,
1591
1591
  isH5AndJdShopViewH5Scroll,
1592
1592
  isH5AndJdShopH5CustomScrollView,
1593
1593
  isWxMiniH5View,
1594
1594
  sliceArrToChunkList,
1595
1595
  dealAddress,
1596
1596
  objectToUrlEncode,
1597
1597
  parseQueryUrlString,
1598
1598
  setLowSmallPicUrl,
1599
1599
  getJfsImage,
1600
1600
  getQualityImage,
1601
1601
  countStringify,
1602
1602
  setTaroStorage,
1603
1603
  getTaroStorageKeyValue,
1604
1604
  removeTaroStorageKey,
1605
1605
  clearTaroStorageKey,
1606
1606
  getSystemInfos,
1607
1607
  addHttps,
1608
1608
  dateFormat,
1609
1609
  throttle,
1610
1610
  lodashThrottle,
1611
1611
  debounce,
1612
1612
  getTelephone,
1613
1613
  rgbToHex,
1614
1614
  hexToRgb,
1615
1615
  getRandom,
1616
1616
  getWxAppCookieStr,
1617
1617
  pxTransformFromData,
1618
1618
  dealShopContentData,
1619
1619
  showSuccessToast,
1620
1620
  showFailToast,
1621
1621
  showNormalToast,
1622
1622
  showShopLoading,
1623
1623
  hideShopLoading,
1624
1624
  getAppChannelType,
1625
1625
  formatTabActiveMenuType,
1626
1626
  filterUrlQueryData,
1627
1627
  getAvifSupport,
1628
1628
  getWebpSupport,
1629
1629
  isMemberPage,
1630
1630
  sgmCustomReport,
1631
1631
  isOpenJdAppUrl,
1632
1632
  jdOpenAppParams,
1633
1633
  createJdOpenAppUrl,
1634
1634
  dealJdOpenAppData,
1635
1635
  isEmpty,
1636
1636
  getJdAppReportPageSource,
1637
1637
  isAppClassifyPage,
1638
1638
  getQualityImageNew,
1639
1639
  getQualityImageOld,
1640
1640
  isPc,
1641
1641
  ipLoc_djd,
1642
1642
  jdAppVersionCompare,
1643
1643
  dealNativePixelToCssPixel,
1644
1644
  isAppStowShop,